Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This tool is compatible with configuration files from various AI coding agents a
- **[Google Gemini](https://gemini.google.com/)**: `GEMINI.md`, `.gemini/styleguide.md`
- **Generic AI Agents**: `AGENTS.md`, `.agents/rules`

The tool automatically discovers and includes rules from these locations in your project, parent directories, user home directory (`~`), and system-wide directories (`/etc`).
The tool automatically discovers and includes rules from these locations in your project, parent directories, and user home directory (`~`).

## Agentic Workflows

Expand Down Expand Up @@ -142,7 +142,6 @@ The tool looks for task and rule files in the following locations, in order of p
**Tasks:**
- `./.agents/tasks/*.md` (any `.md` file with matching `task_name` in frontmatter)
- `~/.agents/tasks/*.md`
- `/etc/agents/tasks/*.md`

**Rules:**
The tool searches for a variety of files and directories, including:
Expand All @@ -151,7 +150,6 @@ The tool searches for a variety of files and directories, including:
- `.github/copilot-instructions.md`, `.gemini/styleguide.md`
- `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (and in parent directories)
- User-specific rules in `~/.agents/rules`, `~/.claude/CLAUDE.md`, `~/.opencode/rules`, etc.
- System-wide rules in `/etc/agents/rules`, `/etc/opencode/rules`.

### Remote File System Support

Expand Down
3 changes: 0 additions & 3 deletions docs/explanation/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Search paths (in order):
1. Project-specific: ./.agents/rules/, ./.cursor/rules/, etc.
2. Parent directories: ../AGENTS.md, ../../AGENTS.md, etc.
3. User-specific: ~/.agents/rules/, ~/.claude/CLAUDE.md, etc.
4. System-wide: /etc/agents/rules/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this list mention remote systems?

```

For each location:
Expand Down Expand Up @@ -114,7 +113,6 @@ Search task file locations for files with matching `task_name`:
Search paths:
1. ./.agents/tasks/*.md
2. ~/.agents/tasks/*.md
3. /etc/agents/tasks/*.md
```

For each `.md` file:
Expand Down Expand Up @@ -332,7 +330,6 @@ Error: no task found with task_name: fix-bug
Searched:
- ./.agents/tasks/
- ~/.agents/tasks/
- /etc/agents/tasks/

Tip: Check that your task file has 'task_name: fix-bug' in frontmatter
```
Expand Down
1 change: 0 additions & 1 deletion docs/reference/file-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ coding-context-cli \
Task files must be in one of these directories:
- `./.agents/tasks/`
- `~/.agents/tasks/`
- `/etc/agents/tasks/`

The filename itself doesn't matter; only the `task_name` frontmatter field is used for selection.

Expand Down
11 changes: 0 additions & 11 deletions docs/reference/search-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Task files are searched in the following directories, in order of precedence:

1. `./.agents/tasks/`
2. `~/.agents/tasks/`
3. `/etc/agents/tasks/`

### Discovery Rules

Expand All @@ -28,12 +27,10 @@ Task files are searched in the following directories, in order of precedence:
Project structure:
./.agents/tasks/fix-bug.md (task_name: fix-bug)
~/.agents/tasks/code-review.md (task_name: code-review)
/etc/agents/tasks/deploy.md (task_name: deploy)

Commands:
coding-context-cli fix-bug → Uses ./.agents/tasks/fix-bug.md
coding-context-cli code-review → Uses ~/.agents/tasks/code-review.md
coding-context-cli deploy → Uses /etc/agents/tasks/deploy.md
```

## Rule File Search Paths
Expand Down Expand Up @@ -84,13 +81,6 @@ Rule files are discovered from multiple locations supporting various AI agent fo
~/.gemini/styleguide.md
```

### System-Wide Rules (Lowest Precedence)

```
/etc/agents/rules/
/etc/opencode/rules/
```

## Supported AI Agent Formats

The CLI automatically discovers rules from configuration files for these AI coding agents:
Expand Down Expand Up @@ -144,7 +134,6 @@ When multiple rule files exist:
1. Project-specific (`./.agents/rules/`)
2. Parent directories (moving up)
3. User-specific (`~/.agents/rules/`)
4. System-wide (`/etc/agents/rules/`)

All matching files are included (unless filtered by selectors).

Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ module github.com/kitproj/coding-context-cli

go 1.24.4

require go.yaml.in/yaml/v2 v2.4.2
require (
github.com/hashicorp/go-getter/v2 v2.2.3
go.yaml.in/yaml/v2 v2.4.2
)

require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.0 // indirect
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.1.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig=
Expand Down
1 change: 0 additions & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,4 +1117,3 @@ Please help with this task.
t.Errorf("task content not found in stdout")
}
}

17 changes: 5 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
)

var (
workDir string
resume bool
params = make(paramMap)
includes = make(selectorMap)
remotePaths []string
workDir string
resume bool
params = make(paramMap)
includes = make(selectorMap)
remotePaths []string
)

func main() {
Expand Down Expand Up @@ -94,13 +94,11 @@ func run(ctx context.Context, args []string) error {
taskSearchDirs := []string{
filepath.Join(".agents", "tasks"),
filepath.Join(homeDir, ".agents", "tasks"),
filepath.Join("/etc", "agents", "tasks"),
}

// Add downloaded remote directories to task search paths
for _, dir := range downloadedDirs {
taskSearchDirs = append(taskSearchDirs, filepath.Join(dir, ".agents", "tasks"))
taskSearchDirs = append(taskSearchDirs, filepath.Join(dir, "agents", "tasks"))
}

var matchingTaskFile string
Expand Down Expand Up @@ -204,17 +202,12 @@ func run(ctx context.Context, args []string) error {
filepath.Join(homeDir, ".codex", "AGENTS.md"),
filepath.Join(homeDir, ".gemini", "GEMINI.md"),
filepath.Join(homeDir, ".opencode", "rules"),

// system
"/etc/agents/rules",
"/etc/opencode/rules",
}

// Append remote directories to rule paths
for _, dir := range downloadedDirs {
rulePaths = append(rulePaths,
filepath.Join(dir, ".agents", "rules"),
filepath.Join(dir, "agents", "rules"),
filepath.Join(dir, ".cursor", "rules"),
filepath.Join(dir, ".augment", "rules"),
filepath.Join(dir, ".windsurf", "rules"),
Expand Down
2 changes: 1 addition & 1 deletion remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func downloadRemoteDirectory(ctx context.Context, src string) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to create temp dir: %w", err)
}

// go-getter requires the destination to not exist, so create a subdirectory
tmpDir := filepath.Join(tmpBase, "download")

Expand Down