From 04593db14301a9930506be43f32e450d3c1b7ffb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:33:04 +0000 Subject: [PATCH 1/8] Initial plan From 695146f4e539ee06f6989b1e022a5d67b7a86d89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:38:53 +0000 Subject: [PATCH 2/8] Add user-prompt argument to documentation and fix flag descriptions Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --- README.md | 14 ++++++-- docs/reference/cli.md | 80 ++++++++++++++++++++----------------------- main.go | 2 +- 3 files changed, 50 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 1bf342c..d8ea162 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,17 @@ sudo chmod +x /usr/local/bin/coding-context ``` Usage: - coding-context [options] + coding-context [options] [user-prompt] + +Arguments: + + The name of a task file to look up in task search paths (.agents/tasks). + Task files are matched by filename (without .md extension). + + [user-prompt] (optional) + Optional text to append to the task. It can contain slash commands + (e.g., '/command-name') which will be expanded, and parameter + substitution (${param}). Options: -C string @@ -96,7 +106,7 @@ Options: Include rules with matching frontmatter. Can be specified multiple times as key=value. Note: Only matches top-level YAML fields in frontmatter. -a string - Default agent to use if task doesn't specify one. Excludes that agent's own rule paths (since the agent reads those itself). Supported agents: cursor, opencode, copilot, claude, gemini, augment, windsurf, codex. + Target agent to use (excludes rules from that agent's own paths). 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). ``` diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 1622ccf..df04be2 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -12,7 +12,7 @@ Complete reference for the `coding-context` command-line interface. ## Synopsis ``` -coding-context [options] +coding-context [options] [user-prompt] ``` ## Description @@ -27,13 +27,27 @@ The Coding Context CLI assembles context from rule files and task prompts, perfo Task files can contain slash commands (e.g., `/command-name arg`) which reference command files for modular content reuse. +### `[user-prompt]` (optional) + +**Optional.** Additional text to append to the task content. This text is appended after a delimiter (`---`) and can contain: +- Slash commands (e.g., `/command-name arg`) which will be expanded +- Parameter substitution placeholders (e.g., `${param}`) + +The user-prompt is processed the same way as task file content, allowing you to dynamically extend the task at runtime. + **Examples:** ```bash -# Task name (looks up fix-bug.md task file) +# Task name only (looks up fix-bug.md task file) coding-context fix-bug -# With parameters -coding-context -p issue_key=BUG-123 fix-bug +# Task with user-prompt +coding-context fix-bug "Focus on the authentication module" + +# User-prompt with parameters +coding-context -p issue_key=BUG-123 fix-bug "Check the error logs in /var/log" + +# User-prompt with slash commands +coding-context fix-bug "/pre-checks and then analyze the code" # With selectors coding-context -s languages=go fix-bug @@ -183,6 +197,11 @@ Specify the target agent being used. When set, this excludes that agent's own ru - Generic rules from `.agents/rules` are always included - The agent name is automatically added as a selector for rule filtering +**Agent Precedence:** +- If a task specifies an `agent` field in its frontmatter, that takes precedence over the `-a` flag +- The `-a` flag is used when the task doesn't specify an agent +- Either the task's agent field or `-a` flag can be used to set the agent + **Example:** ```bash # Using Cursor - excludes .cursor/ paths, includes others @@ -240,40 +259,6 @@ coding-context -s languages=go -s priority=high fix-bug coding-context -s environment=production deploy ``` -**Note:** When filtering by language, use `-s languages=go` (plural). The selector key is `languages` (plural), matching the frontmatter field name. - -### `-a ` - -**Type:** String (agent name) -**Default:** (empty) - -Specify the default agent to use. This acts as a fallback if the task doesn't specify an agent in its frontmatter. - -**Supported agents:** -- `cursor` - [Cursor](https://cursor.sh/) -- `opencode` - [OpenCode.ai](https://opencode.ai/) -- `copilot` - [GitHub Copilot](https://github.com/features/copilot) -- `claude` - [Anthropic Claude](https://claude.ai/) -- `gemini` - [Google Gemini](https://gemini.google.com/) -- `augment` - [Augment](https://augmentcode.com/) -- `windsurf` - [Windsurf](https://codeium.com/windsurf) -- `codex` - [Codex](https://codex.ai/) - -**Agent Precedence:** -- If the task specifies an `agent` field in its frontmatter, that agent **overrides** the `-a` flag -- The `-a` flag serves as a **default** agent when the task doesn't specify one -- This allows tasks to specify their preferred agent while supporting a command-line default - -**Examples:** -```bash -# Use copilot as the default agent -coding-context -a copilot fix-bug - -# Task with agent field will override -a flag -# If fix-bug.md has "agent: claude", it will use claude instead of copilot -coding-context -a copilot fix-bug -``` - ### `-w` **Type:** Boolean flag @@ -372,15 +357,18 @@ coding-context fix-bug # Bootstrap scripts can use these variables ### Basic Usage ```bash -# Free-text prompt (used directly as task content) -coding-context "Please help me review this code for security issues" - # Task name lookup coding-context code-review +# Task with user-prompt +coding-context code-review "Focus on security vulnerabilities" + # With parameters coding-context -p pr_number=123 code-review +# User-prompt with parameters +coding-context -p issue=BUG-456 fix-bug "Check the database connection logic" + # With selectors coding-context -s languages=python fix-bug @@ -390,6 +378,9 @@ coding-context \ -s stage=implementation \ -p feature_name="Authentication" \ implement-feature + +# User-prompt with slash commands +coding-context implement-feature "/pre-checks and validate the requirements" ``` ### Working Directory @@ -440,6 +431,9 @@ coding-context -r implement-feature | ai-agent # Claude coding-context fix-bug | claude +# With user-prompt +coding-context fix-bug "Focus on edge cases" | claude + # LLM tool coding-context fix-bug | llm -m claude-3-5-sonnet-20241022 @@ -450,8 +444,8 @@ coding-context code-review | openai api completions.create -m gpt-4 coding-context fix-bug > context.txt cat context.txt | your-ai-agent -# Free-text prompt -coding-context "Please help me debug the auth module" | claude +# User-prompt with parameters +coding-context -p issue=123 fix-bug "Check logs in /var/log" | claude ``` ### Token Monitoring diff --git a/main.go b/main.go index 9004881..2d95098 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ func main() { flag.StringVar(&workDir, "C", ".", "Change to directory before doing anything.") flag.BoolVar(&resume, "r", false, "Resume mode: skip outputting rules and select task with 'resume: true' in frontmatter.") - flag.BoolVar(&writeRules, "w", false, "Write rules to the agent's user rules path and only print the prompt to stdout. Requires -a flag.") + flag.BoolVar(&writeRules, "w", false, "Write rules to the agent's user rules path and only print the prompt to stdout. Requires agent (via task 'agent' field or -a flag).") flag.Var(&agent, "a", "Target agent to use (excludes rules from other agents). Supported agents: cursor, opencode, copilot, claude, gemini, augment, windsurf, codex.") flag.Var(¶ms, "p", "Parameter to substitute in the prompt. Can be specified multiple times as key=value.") flag.Var(&includes, "s", "Include rules with matching frontmatter. Can be specified multiple times as key=value.") From 2fe0ca6b50362f84c9f50522ddf04acaf5e26b8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:41:01 +0000 Subject: [PATCH 3/8] Fix search paths documentation to match code implementation Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --- README.md | 16 ++++++++-------- docs/reference/file-formats.md | 18 +++++++----------- docs/reference/search-paths.md | 4 +--- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d8ea162..4ea5a42 100644 --- a/README.md +++ b/README.md @@ -189,14 +189,15 @@ Each of these would have a corresponding `.md` file (e.g., `triage-bug.md`, `fix The tool assembles the context in the following order: -1. **Rule Files**: It searches a list of predefined locations for rule files (`.md` or `.mdc`). These locations include the current directory, ancestor directories, user's home directory, and system-wide directories. +1. **Rule Files**: It searches for rule files (`.md` or `.mdc`) in directories specified via `-d` flags and automatically-added working directory and home directory. 2. **Rule Bootstrap Scripts**: For each rule file found (e.g., `my-rule.md`), it looks for an executable script named `my-rule-bootstrap`. If found, it runs the script before processing the rule file. These scripts are meant for bootstrapping the environment (e.g., installing tools) and their output is sent to `stderr`, not into the main context. 3. **Filtering**: If `-s` (include) flag is used, it parses the YAML frontmatter of each rule file to decide whether to include it. Note that selectors can only match top-level YAML fields (e.g., `language: go`), not nested fields. 4. **Task Prompt**: It searches for a task file matching the filename (without `.md` extension). Tasks are matched by filename, not by `task_name` in frontmatter. If selectors are provided with `-s`, they are used to filter between multiple task files with the same filename. 5. **Task Bootstrap Script**: For the task file found (e.g., `fix-bug.md`), it looks for an executable script named `fix-bug-bootstrap`. If found, it runs the script before processing the task file. This allows task-specific environment setup or data preparation. -6. **Parameter Expansion**: It substitutes variables in the task prompt using the `-p` flags. -7. **Output**: It prints the content of all included rule files, followed by the expanded task prompt, to standard output. -8. **Token Count**: A running total of estimated tokens is printed to standard error. +6. **User Prompt Appending**: If a user-prompt argument is provided, it is appended to the task content after a delimiter (`---`). +7. **Parameter Expansion**: It substitutes variables in the task prompt and user-prompt using the `-p` flags. +8. **Output**: It prints the content of all included rule files, followed by the expanded task prompt, to standard output. +9. **Token Count**: A running total of estimated tokens is printed to standard error. ### File Search Paths @@ -204,7 +205,6 @@ The tool looks for task and rule files in the following locations, in order of p **Tasks:** - `./.agents/tasks/*.md` (task name matches filename without `.md` extension) -- `~/.agents/tasks/*.md` **Commands** (reusable content blocks referenced via slash commands like `/command-name` inside task content): - `./.agents/commands/*.md` @@ -214,9 +214,9 @@ The tool looks for task and rule files in the following locations, in order of p **Rules:** The tool searches for a variety of files and directories, including: - `CLAUDE.local.md` -- `.agents/rules`, `.cursor/rules`, `.augment/rules`, `.windsurf/rules`, `.opencode/agent`, `.opencode/rules` -- `.github/copilot-instructions.md`, `.github/agents`, `.gemini/styleguide.md` -- `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.codex/AGENTS.md` +- `.agents/rules`, `.cursor/rules`, `.augment/rules`, `.windsurf/rules`, `.opencode/agent` +- `.github/copilot-instructions.md`, `.github/agents`, `.gemini/styleguide.md`, `.augment/guidelines.md` +- `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules` - User-specific rules in `~/.agents/rules`, `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, `~/.gemini/GEMINI.md`, `~/.opencode/rules`, etc. ### Remote File System Support diff --git a/docs/reference/file-formats.md b/docs/reference/file-formats.md index 807240e..c1ad24b 100644 --- a/docs/reference/file-formats.md +++ b/docs/reference/file-formats.md @@ -442,13 +442,10 @@ This prevents command injection where expanded content could trigger further, un ### File Location -Task files must be in one of these directories: -- `./.agents/tasks/` -- `./.cursor/commands/` -- `./.opencode/command/` -- `~/.agents/tasks/` +Task files must be in these directories within any search path directory: +- `.agents/tasks/` -Tasks are matched by filename (without `.md` extension). The `task_name` field in frontmatter is optional and used only for metadata. For example, a file named `fix-bug.md` is matched by the command `/fix-bug`, regardless of whether it has `task_name` in its frontmatter. +Tasks are matched by filename (without `.md` extension). The `task_name` field in frontmatter is optional and used only for metadata. For example, a file named `fix-bug.md` is matched by the task name `fix-bug`, regardless of whether it has `task_name` in its frontmatter. ## Command Files @@ -523,11 +520,10 @@ Commands can also receive inline parameters: ### File Locations -Command files must be in one of these directories: -- `./.agents/commands/` -- `./.cursor/commands/` -- `./.opencode/command/` -- `~/.agents/commands/` +Command files must be in these directories within any search path directory: +- `.agents/commands/` +- `.cursor/commands/` +- `.opencode/command/` Commands are matched by filename (without `.md` extension). For example, a file named `deploy.md` is matched by the slash command `/deploy`. diff --git a/docs/reference/search-paths.md b/docs/reference/search-paths.md index b354675..0ffd7c6 100644 --- a/docs/reference/search-paths.md +++ b/docs/reference/search-paths.md @@ -81,10 +81,7 @@ Rule files are discovered from directories specified via the `-d` flag (plus aut .augment/rules/ .windsurf/rules/ .opencode/agent/ -.opencode/command/ -.opencode/rules/ .github/agents/ -.codex/ ``` **Specific files:** @@ -92,6 +89,7 @@ Rule files are discovered from directories specified via the `-d` flag (plus aut CLAUDE.local.md .github/copilot-instructions.md .gemini/styleguide.md +.augment/guidelines.md ``` **Standard files:** From 5521426055fa3493fbbd8c287be487d8a6218afd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:43:09 +0000 Subject: [PATCH 4/8] Fix task invocation examples - remove incorrect slash prefix Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --- README.md | 22 ++++++++-------------- docs/how-to/create-tasks.md | 4 ++-- docs/how-to/github-actions.md | 2 +- docs/index.md | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4ea5a42..fe88ec2 100644 --- a/README.md +++ b/README.md @@ -310,10 +310,10 @@ Deploy the application to production with all safety checks. You can then select the appropriate task using: ```bash # Deploy to staging -coding-context -s environment=staging /deploy +coding-context -s environment=staging deploy # Deploy to production -coding-context -s environment=production /deploy +coding-context -s environment=production deploy ``` #### Task Frontmatter Selectors @@ -338,11 +338,6 @@ When you run this task, it automatically applies the selectors: coding-context implement-feature ``` -This is equivalent to: -```bash -coding-context -s languages=go -s stage=implementation /implement-feature -``` - **Selectors support OR logic for the same key using arrays:** ```markdown --- @@ -404,13 +399,12 @@ This is particularly useful in agentic workflows where an AI agent has already b - Skipping all rules output **Example usage:** - ```bash # Initial task invocation (includes all rules, uses task with resume: false) -coding-context -s resume=false /fix-bug | ai-agent +coding-context -s resume=false fix-bug | ai-agent # Resume the task (skips rules, uses task with resume: true) -coding-context -r /fix-bug | ai-agent +coding-context -r fix-bug | ai-agent ``` **Example task files for resume mode:** @@ -459,7 +453,7 @@ languages: To include this rule only when working on Go code, you would use `-s languages=go`: ```bash -coding-context -s languages=go /fix-bug +coding-context -s languages=go fix-bug ``` This will include all rules with `languages: [ go ]` in their frontmatter, excluding rules for other languages. @@ -478,10 +472,10 @@ Then select only the relevant rules: ```bash # Work on Python code with Python-specific rules -coding-context -s languages=python /fix-bug +coding-context -s languages=python fix-bug # Work on JavaScript code with JavaScript-specific rules -coding-context -s languages=javascript /enhance-feature +coding-context -s languages=javascript enhance-feature ``` **Language Values** @@ -530,7 +524,7 @@ When working with a specific AI coding agent, the agent itself will read its own ```bash # When using Cursor, exclude .cursor/ and .cursorrules (Cursor reads those itself) # But include rules from other agents and generic rules -coding-context -a cursor /fix-bug +coding-context -a cursor fix-bug ``` **How it works:** diff --git a/docs/how-to/create-tasks.md b/docs/how-to/create-tasks.md index de12dbd..b88e8d5 100644 --- a/docs/how-to/create-tasks.md +++ b/docs/how-to/create-tasks.md @@ -22,7 +22,7 @@ Please review the code changes with focus on: - Security implications ``` -Save as `.agents/tasks/code-review.md` (or `.agents/commands/code-review.md`). +Save as `.agents/tasks/code-review.md`. Use with: ```bash @@ -51,7 +51,7 @@ coding-context \ -p feature_name="User Authentication" \ -p requirements="OAuth2 support, secure password storage" \ -p success_criteria="All tests pass, security audit clean" \ - /implement-feature + implement-feature ``` ## Multiple Tasks with Selectors diff --git a/docs/how-to/github-actions.md b/docs/how-to/github-actions.md index 901658a..0aa8fc8 100644 --- a/docs/how-to/github-actions.md +++ b/docs/how-to/github-actions.md @@ -209,7 +209,7 @@ Use the `-C` flag to run from a different directory: ```yaml - name: Assemble Context run: | - coding-context -C ./backend -s languages=go /fix-bug > context.txt + coding-context -C ./backend -s languages=go fix-bug > context.txt ``` ## Best Practices diff --git a/docs/index.md b/docs/index.md index 2fcf929..f6bc387 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,7 +19,7 @@ sudo curl -fsL -o /usr/local/bin/coding-context \ sudo chmod +x /usr/local/bin/coding-context # Use with an AI agent -coding-context -p issue_key=BUG-123 -s languages=go /fix-bug | llm -m claude-3-5-sonnet-20241022 +coding-context -p issue_key=BUG-123 -s languages=go fix-bug | llm -m claude-3-5-sonnet-20241022 ``` ## Documentation Structure From d0523cbe10ed3ae9b55c94ccc454c748453db3b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:47:53 +0000 Subject: [PATCH 5/8] Correct agent flag documentation to match actual behavior Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --- README.md | 41 +++++++++++++++++------------------------ docs/reference/cli.md | 16 +++++++++------- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index fe88ec2..d1a6bc0 100644 --- a/README.md +++ b/README.md @@ -507,32 +507,33 @@ If you need to filter on nested data, flatten your frontmatter structure to use ### Targeting a Specific Agent -When working with a specific AI coding agent, the agent itself will read its own configuration files. The `-a` flag lets you specify which agent you're using, automatically excluding that agent's specific rule paths while including rules from other agents and generic rules. +The `-a` flag specifies which AI coding agent you're using. This information is used in two ways: + +1. **Rule Filtering**: The agent name is automatically added as a selector, allowing rules to filter themselves based on the agent +2. **Write Rules Mode**: With the `-w` flag, determines where to write rules (e.g., `~/.github/agents/AGENTS.md` for copilot) **Supported agents:** -- `cursor` - Excludes `.cursor/rules`, `.cursorrules`; includes other agents and generic rules -- `opencode` - Excludes `.opencode/agent`, `.opencode/command`; includes other agents and generic rules -- `copilot` - Excludes `.github/copilot-instructions.md`, `.github/agents`; includes other agents and generic rules -- `claude` - Excludes `.claude/`, `CLAUDE.md`, `CLAUDE.local.md`; includes other agents and generic rules -- `gemini` - Excludes `.gemini/`, `GEMINI.md`; includes other agents and generic rules -- `augment` - Excludes `.augment/`; includes other agents and generic rules -- `windsurf` - Excludes `.windsurf/`, `.windsurfrules`; includes other agents and generic rules -- `codex` - Excludes `.codex/`, `AGENTS.md`; includes other agents and generic rules +- `cursor` - Cursor IDE +- `opencode` - OpenCode.ai +- `copilot` - GitHub Copilot +- `claude` - Anthropic Claude +- `gemini` - Google Gemini +- `augment` - Augment +- `windsurf` - Windsurf +- `codex` - Codex -**Example: Using Cursor:** +**Example: Agent-specific rules:** ```bash -# When using Cursor, exclude .cursor/ and .cursorrules (Cursor reads those itself) -# But include rules from other agents and generic rules +# Specify the agent coding-context -a cursor fix-bug ``` **How it works:** - The `-a` flag sets the target agent -- The target agent's own paths are excluded (e.g., `.cursor/` for cursor) -- Rules from other agents are included (e.g., `.opencode/`, `.github/copilot-instructions.md`) -- Generic rules (from `.agents/rules`) are always included -- The agent name is automatically added as a selector, so generic rules can filter themselves with `agent: cursor` in frontmatter +- The agent name is automatically added as a selector for rule filtering +- Rules can use `agent: cursor` in frontmatter to match only when that agent is specified +- Generic rules (without an agent field) are always included **Example generic rule with agent filtering:** @@ -557,14 +558,6 @@ agent: cursor This is useful for tasks designed for specific agents, ensuring the correct agent context is used regardless of command-line flags. -**Use cases:** -- **Avoid duplication**: The agent reads its own config, so exclude it from the context -- **Cross-agent rules**: Include rules from other agents that might be relevant -- **Generic rules**: Always include generic rules, with optional agent-specific filtering -- **Task-specific agents**: Tasks can enforce a specific agent context - -The exclusion happens before rule processing, so excluded paths are never loaded or counted toward token estimates. - ### Bootstrap Scripts A bootstrap script is an executable file that has the same name as a rule or task file but with a `-bootstrap` suffix. These scripts are used to prepare the environment, for example by installing necessary tools. The output of these scripts is sent to `stderr` and is not part of the AI context. diff --git a/docs/reference/cli.md b/docs/reference/cli.md index df04be2..5c53723 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -187,15 +187,17 @@ coding-context \ **Type:** String **Default:** (empty) -Specify the target agent being used. When set, this excludes that agent's own rule paths (since the agent reads those itself) while including rules from other agents and generic rules. +Specify the target agent being used. This information is used for: +1. **Rule Filtering**: The agent name is automatically added as a selector, allowing rules to filter based on agent +2. **Write Rules Mode**: With `-w` flag, determines where to write rules **Supported agents:** `cursor`, `opencode`, `copilot`, `claude`, `gemini`, `augment`, `windsurf`, `codex` **How it works:** -- When `-a cursor` is specified, paths like `.cursor/rules` and `.cursorrules` are excluded -- Rules from other agents (e.g., `.opencode/agent`, `.github/copilot-instructions.md`) are included -- Generic rules from `.agents/rules` are always included - The agent name is automatically added as a selector for rule filtering +- Rules with matching `agent` field in frontmatter are included +- Generic rules (without an agent field) are always included +- With `-w` flag, determines the user rules path (e.g., `~/.github/agents/AGENTS.md` for copilot) **Agent Precedence:** - If a task specifies an `agent` field in its frontmatter, that takes precedence over the `-a` flag @@ -204,11 +206,11 @@ Specify the target agent being used. When set, this excludes that agent's own ru **Example:** ```bash -# Using Cursor - excludes .cursor/ paths, includes others +# Specify agent for rule filtering coding-context -a cursor fix-bug -# Using GitHub Copilot - excludes .github/copilot-instructions.md, includes others -coding-context -a copilot implement-feature +# Use with write rules mode +coding-context -a copilot -w implement-feature ``` **Note:** Task files can override this with an `agent` field in their frontmatter. From fe96dff6edaeb80b1cda3fb60268ef036a2a7227 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Wed, 17 Dec 2025 11:49:43 -0800 Subject: [PATCH 6/8] Update main.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 2d95098..58e4279 100644 --- a/main.go +++ b/main.go @@ -35,7 +35,7 @@ func main() { flag.StringVar(&workDir, "C", ".", "Change to directory before doing anything.") flag.BoolVar(&resume, "r", false, "Resume mode: skip outputting rules and select task with 'resume: true' in frontmatter.") flag.BoolVar(&writeRules, "w", false, "Write rules to the agent's user rules path and only print the prompt to stdout. Requires agent (via task 'agent' field or -a flag).") - flag.Var(&agent, "a", "Target agent to use (excludes rules from other agents). Supported agents: cursor, opencode, copilot, claude, gemini, augment, windsurf, codex.") + flag.Var(&agent, "a", "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.") flag.Var(¶ms, "p", "Parameter to substitute in the prompt. Can be specified multiple times as key=value.") flag.Var(&includes, "s", "Include rules with matching frontmatter. Can be specified multiple times as key=value.") flag.Func("d", "Directory containing rules and tasks. Can be specified multiple times. Supports various protocols via go-getter (http://, https://, git::, s3::, file:// etc.).", func(s string) error { From 79010f6181365b1a0b9650dfbefc73f2413bfa9d Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Wed, 17 Dec 2025 11:50:28 -0800 Subject: [PATCH 7/8] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d1a6bc0..c3ecf6a 100644 --- a/README.md +++ b/README.md @@ -507,11 +507,11 @@ If you need to filter on nested data, flatten your frontmatter structure to use ### Targeting a Specific Agent -The `-a` flag specifies which AI coding agent you're using. This information is used in two ways: +The `-a` flag specifies which AI coding agent you're using. This information is currently used in one way: -1. **Rule Filtering**: The agent name is automatically added as a selector, allowing rules to filter themselves based on the agent -2. **Write Rules Mode**: With the `-w` flag, determines where to write rules (e.g., `~/.github/agents/AGENTS.md` for copilot) +1. **Write Rules Mode**: With the `-w` flag, determines where to write rules (e.g., `~/.github/agents/AGENTS.md` for `copilot`) +> Note: Agent-based rule filtering is not implemented. All rules are currently included regardless of the `-a` value. **Supported agents:** - `cursor` - Cursor IDE - `opencode` - OpenCode.ai From 315bb6b5153fe37d159c453731fb7caa309c9fd7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:54:39 +0000 Subject: [PATCH 8/8] Remove incorrect agent filtering claims from documentation Agent filtering is not implemented - agent is only used for -w write path Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --- README.md | 31 +++++++++++-------------------- docs/reference/cli.md | 17 +++++++---------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index c3ecf6a..cfac78e 100644 --- a/README.md +++ b/README.md @@ -507,11 +507,12 @@ If you need to filter on nested data, flatten your frontmatter structure to use ### Targeting a Specific Agent -The `-a` flag specifies which AI coding agent you're using. This information is currently used in one way: +The `-a` flag specifies which AI coding agent you're using. This information is currently used for: 1. **Write Rules Mode**: With the `-w` flag, determines where to write rules (e.g., `~/.github/agents/AGENTS.md` for `copilot`) -> Note: Agent-based rule filtering is not implemented. All rules are currently included regardless of the `-a` value. +> **Note:** Agent-based rule filtering is not currently implemented. All rules are included regardless of the `-a` value. + **Supported agents:** - `cursor` - Cursor IDE - `opencode` - OpenCode.ai @@ -522,28 +523,18 @@ The `-a` flag specifies which AI coding agent you're using. This information is - `windsurf` - Windsurf - `codex` - Codex -**Example: Agent-specific rules:** +**Example:** ```bash -# Specify the agent -coding-context -a cursor fix-bug +# Use with write rules mode +coding-context -a copilot -w fix-bug ``` **How it works:** -- The `-a` flag sets the target agent -- The agent name is automatically added as a selector for rule filtering -- Rules can use `agent: cursor` in frontmatter to match only when that agent is specified -- Generic rules (without an agent field) are always included - -**Example generic rule with agent filtering:** - -```markdown ---- -agent: cursor ---- -# This rule only applies when using Cursor -Use Cursor-specific features... -``` +- The `-a` flag sets the target agent value +- The agent value is stored in the context for use by the `-w` flag +- With `-w`, the agent determines where to write rules to the user's home directory +- All rules are currently included regardless of agent value **Agent field in task frontmatter:** @@ -556,7 +547,7 @@ agent: cursor # This task automatically sets the agent to cursor ``` -This is useful for tasks designed for specific agents, ensuring the correct agent context is used regardless of command-line flags. +This is useful for tasks designed for specific agents, ensuring the correct agent is set for determining the write path with `-w`. ### Bootstrap Scripts diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 5c53723..9cf9398 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -187,17 +187,17 @@ coding-context \ **Type:** String **Default:** (empty) -Specify the target agent being used. This information is used for: -1. **Rule Filtering**: The agent name is automatically added as a selector, allowing rules to filter based on agent -2. **Write Rules Mode**: With `-w` flag, determines where to write rules +Specify the target agent being used. This is currently used for: +1. **Write Rules Mode**: With `-w` flag, determines where to write rules (e.g., `~/.github/agents/AGENTS.md` for copilot) + +> **Note:** Agent-based rule filtering is not currently implemented. All rules are included regardless of the `-a` value. **Supported agents:** `cursor`, `opencode`, `copilot`, `claude`, `gemini`, `augment`, `windsurf`, `codex` **How it works:** -- The agent name is automatically added as a selector for rule filtering -- Rules with matching `agent` field in frontmatter are included -- Generic rules (without an agent field) are always included -- With `-w` flag, determines the user rules path (e.g., `~/.github/agents/AGENTS.md` for copilot) +- The agent value is stored in the context (can come from `-a` flag or task frontmatter) +- With `-w` flag, the agent determines the user rules path for writing +- All rules are currently included regardless of agent value **Agent Precedence:** - If a task specifies an `agent` field in its frontmatter, that takes precedence over the `-a` flag @@ -206,9 +206,6 @@ Specify the target agent being used. This information is used for: **Example:** ```bash -# Specify agent for rule filtering -coding-context -a cursor fix-bug - # Use with write rules mode coding-context -a copilot -w implement-feature ```