Skip to content
Draft
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
34 changes: 34 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# https://golangci-lint.run/usage/linters/
# The goal here is to:
# (a) reduce bugs
# (b) make code more readable to make code reviews faster
# (c) speed up development by catching some things that would otherwise be caught by the compiler
# (d) prefer automatically fixing code
version: "2"
linters:
default: all
enable:
- wsl_v5
disable:
- wsl
- depguard
- noinlineerr
- exhaustruct
- testpackage
- varnamelen
settings:
funlen:
lines: 100
gocognit:
min-complexity: 50
cyclop:
max-complexity: 15
wsl_v5:
allow-first-in-block: true
allow-whole-block: false
branch-max-lines: 2
tagliatelle:
case:
rules:
json: snake
yaml: snake
94 changes: 74 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ The tool assembles context into a structured prompt with the following component
- **Task-Specific Prompts**: Use different prompts for different tasks (e.g., `feature`, `bugfix`).
- **Rule-Based Context**: Define reusable context snippets (rules) that can be included or excluded.
- **Skills System**: Progressive disclosure of specialized capabilities via skill directories.
- **Namespaces**: Isolate multiple teams' assets under `.agents/namespaces/<team>/` while sharing a global layer.
- **Frontmatter Filtering**: Select rules based on metadata using frontmatter selectors (matches top-level YAML fields only).
- **Bootstrap Scripts**: Run scripts to fetch or generate context dynamically.
- **Parameter Substitution**: Inject values into your task prompts.
Expand All @@ -66,14 +67,14 @@ This tool is compatible with configuration files from various AI coding agents a

### Primary Supported Agents (with dedicated `-a` flag)

- **[GitHub Copilot](https://github.com/features/copilot)**: `.github/copilot-instructions.md`, `.github/agents` (`-a copilot`)
- **[Anthropic Claude](https://claude.ai/)**: `CLAUDE.md`, `CLAUDE.local.md`, `.claude/CLAUDE.md` (`-a claude`)
- **[Cursor](https://cursor.sh/)**: `.cursor/rules`, `.cursorrules` (`-a cursor`)
- **[Google Gemini](https://gemini.google.com/)**: `GEMINI.md`, `.gemini/styleguide.md` (`-a gemini`)
- **[Augment](https://augmentcode.com/)**: `.augment/rules`, `.augment/guidelines.md` (`-a augment`)
- **[Windsurf](https://codeium.com/windsurf)**: `.windsurf/rules`, `.windsurfrules` (`-a windsurf`)
- **[OpenCode.ai](https://opencode.ai/)**: `.opencode/agent`, `.opencode/command`, `.opencode/rules` (`-a opencode`)
- **[Codex](https://codex.ai/)**: `AGENTS.md`, `.codex/AGENTS.md` (`-a codex`)
- **[GitHub Copilot](https://github.com/features/copilot)**: `.github/copilot-instructions.md`, `.github/agents/` (`-a copilot`)
- **[Anthropic Claude](https://claude.ai/)**: `CLAUDE.md`, `CLAUDE.local.md`, `.claude/` (directory) (`-a claude`)
- **[Cursor](https://cursor.sh/)**: `.cursor/rules/`, `.cursorrules` (`-a cursor`)
- **[Google Gemini](https://gemini.google.com/)**: `GEMINI.md`, `.gemini/styleguide.md`, `.gemini/` (directory) (`-a gemini`)
- **[Augment](https://augmentcode.com/)**: `.augment/rules/`, `.augment/guidelines.md` (`-a augment`)
- **[Windsurf](https://codeium.com/windsurf)**: `.windsurf/rules/`, `.windsurfrules` (`-a windsurf`)
- **[OpenCode.ai](https://opencode.ai/)**: `.opencode/agent/`, `.opencode/rules/` (rules); `.opencode/command/` (commands) (`-a opencode`)
- **[Codex](https://codex.ai/)**: `AGENTS.md`, `.codex/` (directory) (`-a codex`)

### Additional Compatible Agents

Expand Down Expand Up @@ -158,13 +159,15 @@ Options:
Go Getter URL to a manifest file containing search paths (one per line). Every line is included as-is.
-p value
Parameter to substitute in the prompt. Can be specified multiple times as key=value.
-r Resume mode: skip outputting rules and select task with 'resume: true' in frontmatter.
-r Resume mode: set 'resume=true' selector to filter tasks by their frontmatter resume field. Does not skip rules; use --skip-bootstrap to skip rule discovery.
-s value
Include rules with matching frontmatter. Can be specified multiple times as key=value.
Note: Only matches top-level YAML fields in frontmatter.
-a string
Target agent to use. Required when using -w to write rules to the agent's user rules path. Supported agents: cursor, opencode, copilot, claude, gemini, augment, windsurf, codex.
-w Write rules to agent's config file and output only task to stdout. Requires agent (via task or -a flag).
--skip-bootstrap
Skip discovering rules, skills, and running bootstrap scripts.
```

### Examples
Expand Down Expand Up @@ -325,6 +328,57 @@ coding-context \
/implement-feature
```

## Namespaces

Namespaces let multiple teams share a single `.agents/` directory without conflicts. Select a namespace by prefixing the task name with `namespace/`:

```bash
# Global task (existing behaviour)
coding-context fix-bug

# Namespaced task — activates the "myteam" namespace
coding-context myteam/fix-bug
```

**Directory structure:**

```
.agents/
├── tasks/ # Global tasks
├── rules/ # Global rules (always included)
├── commands/ # Global commands
├── skills/ # Global skills
└── namespaces/ # Namespace root (new)
├── myteam/
│ ├── tasks/ # Tasks accessed as "myteam/<name>"
│ ├── rules/ # Namespace rules (included first)
│ ├── commands/ # Override global commands
│ └── skills/
└── otherteam/
└── ...
```

**Resolution rules:**
- **Tasks**: Namespace directory first, falls back to global if not found
- **Rules**: Namespace rules included first, then all global rules (both always included)
- **Commands**: Namespace command wins over global command with the same name
- **Skills**: Namespace and global skills both discovered; namespace listed first

**Scoping rules to a namespace** — add `namespace: myteam` to a rule's frontmatter:

```markdown
---
namespace: myteam
---
# myteam Internal Standards

Only included for myteam/* tasks.
```

Rules with no `namespace` field are always included regardless of namespace.

For a complete guide, see [How to Use Namespaces](https://kitproj.github.io/coding-context-cli/how-to/use-namespaces).

## File Formats

### Task Files
Expand Down Expand Up @@ -438,23 +492,23 @@ The `expand` field works in:

### Resume Mode

Resume mode is designed for continuing work on a task where you've already established context. When using the `-r` flag:
Resume mode is designed for continuing work on a task where you've already established context. The `-r` flag adds a `resume=true` selector, which filters tasks to those with `resume: true` in their frontmatter.

1. **Rules are skipped**: All rule files are excluded from output, saving tokens and reducing context size
2. **Resume-specific task prompts are selected**: Automatically adds `-s resume=true` selector to find task files with `resume: true` in their frontmatter
**What the `-r` flag does:**
- Adds `-s resume=true` selector to find task files with `resume: true` in their frontmatter

This is particularly useful in agentic workflows where an AI agent has already been primed with rules and is continuing work from a previous session.

**The `-r` flag is shorthand for:**
- Adding `-s resume=true` selector
- Skipping all rules output
**What the `-r` flag does NOT do:**
- It does **not** skip rules or bootstrap scripts. To skip those, use `--skip-bootstrap`.

**Example usage:**
```bash
# Initial task invocation (includes all rules, uses task with resume: false)
# Initial task invocation (includes all rules and bootstrap)
coding-context -s resume=false fix-bug | ai-agent

# Resume the task (skips rules, uses task with resume: true)
# Resume the task with rules skipped (uses resume task, skips rules and bootstrap)
coding-context -r --skip-bootstrap fix-bug | ai-agent

# Resume the task keeping rules (just selects the resume variant of the task)
coding-context -r fix-bug | ai-agent
```

Expand Down Expand Up @@ -482,7 +536,7 @@ Continue working on the bug fix.
Review your previous work and complete remaining tasks.
```

With this approach, you can have multiple task prompts for the same task name, differentiated by the `resume` frontmatter field. Use `-s resume=false` to select the initial task (with rules), or `-r` to select the resume task (without rules).
With this approach, you can have multiple task prompts for the same task name, differentiated by the `resume` frontmatter field. Use `-s resume=false` to select the initial task, or `-r` to select the resume task. Combine with `--skip-bootstrap` to also skip rules.

### Rule Files

Expand Down
18 changes: 18 additions & 0 deletions docs/how-to/create-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,24 @@ coding-context implement-feature

The frontmatter (with `selectors`, `languages`, etc.) is parsed and used to filter rules and control behavior, but it does not appear in the final output sent to the AI agent.

## Namespaced Tasks

If your project uses namespaces (multiple teams sharing `.agents/`), create team-specific tasks under `.agents/namespaces/<team>/tasks/`:

```
.agents/namespaces/myteam/tasks/build.md
```

Invoke with the `team/task` format:

```bash
coding-context myteam/build
```

If the task file doesn't exist in the namespace directory, the tool automatically falls back to `.agents/tasks/build.md`.

See [How to Use Namespaces](./use-namespaces) for a full guide including rules, commands, and skills.

## Best Practices

1. **Use descriptive task names**: Make them clear and specific
Expand Down
1 change: 1 addition & 0 deletions docs/how-to/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ These guides are problem-oriented and help you achieve specific goals.
- [Create Rule Files](./create-rules) - Provide reusable context
- [Create Skills](./create-skills) - Organize specialized capabilities with progressive disclosure
- [Use Frontmatter Selectors](./use-selectors) - Filter rules and tasks
- [Use Namespaces](./use-namespaces) - Isolate team assets in a shared repository
- [Use Remote Directories](./use-remote-directories) - Load rules from Git, HTTP, or S3
- [Use with AI Agents](./use-with-ai-agents) - Integrate with various AI tools
- [Integrate with GitHub Actions](./github-actions) - Automate with CI/CD
Loading
Loading