Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

Replaces the Kit workflow engine with a CLI tool to import/export coding rules across AI agents (Claude, Gemini, Cursor, GitHub Copilot, Windsurf, Goose, Augment, Codex). Rules are normalized to AGENTS.md as a single source of truth.

Core Changes

  • New CLI: import, export <agent>, bootstrap, prompt commands
  • Agent Configuration: Map of 9 agents to their rule path discovery functions
  • Hierarchical Discovery: 4-level priority (Project → Ancestor → User → System)
  • Import: Aggregates rules from all agents into AGENTS.md with source annotations, avoids recursion
  • Export: Distributes AGENTS.md to agent-specific formats (direct files, directories, or no-op for agents using normalized format)

Agent Path Patterns

// Claude: hierarchical concatenation
~/.claude/CLAUDE.md           // Global
./CLAUDE.md                   // Ancestor
./CLAUDE.local.md            // Local override

// Cursor: declarative injection  
./.cursor/rules/*.{md,mdc}    // Project
./AGENTS.md                   // Compatibility

// Gemini: strategic layer
~/.gemini/GEMINI.md           // Global
./GEMINI.md                   // Ancestor
./.gemini/styleguide.md       // Project

Usage

coding-context bootstrap              # Initialize structure
coding-context import                 # Aggregate all agent rules → AGENTS.md
coding-context export Gemini          # AGENTS.md → GEMINI.md
coding-context prompt                 # View aggregated rules

Implementation Notes

  • .mdc files handled transparently during import
  • Agents sharing normalized format (Codex, Cursor, Goose) export as no-op
  • Cross-platform path handling via filepath.Join
  • Content deduplication deferred to future iteration per spec
Original prompt

We going to add the ability to "import" and "export" rules between different coding agents.

We're starting with importing.

This will be a substantial re-write of the codebase.

Later on will be adding content based deduplication, so it is fine to append the same content to a file many times.

Persona

Remove support for personas. We're going to add this back later on.

Default Command

Remove the default command. We're going to change this into many commands

  • "export" will export the rules for whatever agent we're using
  • "bootstrap" will bootstrap the rules.
  • "prompt" will find the prompt and print it to stdout.

Rule Description

To do this, we need to be able to describe each agent and the rules files they use:

Project Rules (level 0 - most important)

A specific path in PWD containing rules. AGENTS.md, ./.gem ini/styleguide.md
A sub-directory of PWD that contain rules. .github/agents

Ancestor Rules (level 1 - next most important)

File with a specific name in the PWD folder hierarchy. E.g. AGENTS.md

User Rules (level 2)

A specific path in HOME containing rules. ~/.codex/AGENTS.md
A sub-directory of HOME that contain rules.

System Rules (level 3)

/usr/local/prompts-rules

Common Agents

ToolAlgorithm (Algo)Parameters for the AlgoClaude CodeHierarchical ConcatenationRules are merged top-down. The process involves searching for .md files in three main locations:Global: ~/.claude/CLAUDE.md (Universal base persona/instructions) [1]Ancestor: ./CLAUDE.md (Project-wide guidance, checked into Git) [2]Project/Local Override: ./CLAUDE.local.md (Highest precedence, personal instructions, typically .gitignore'd) [2]Gemini CLIHierarchical Concatenation (Strategic Layer)The CLI searches for the GEMINI.md file in ancestor directories to define the agent's persona ("Strategic Layer") and project context.Global: ~/.gemini/GEMINI.md (Universal persona definition) [[3]],Ancestor: Project/Ancestor ./GEMINI.md (Project-specific persona and mission) [3, 4]Simple System Prompt (Specialized)Injects context for specific workflows like code review.Project: ./.gemini/styleguide.md (Custom style guidelines for code review) [5, 6]Codex CLIHierarchical ConcatenationRules in AGENTS.md are loaded and merged top-down based on proximity to the CWD.User: ~/.codex/AGENTS.md (Global personal guidance) [7]Ancestor/Project: AGENTS.md at repository root and in the current working directory (CWD) (Merged for shared project notes and subfolder specifics) [7]CursorDeclarative Context Injection (Structured)Uses files with metadata to control application type, optimizing context limits.Project: Files within nested directories ./.cursor/rules/. Rules are written in .mdc format and controlled by metadata (e.g., alwaysApply, globs, Agent Requested) [8, 9]Simple System Prompt (Compatibility)Loads a flat file for general instructions as an alternative to structured rules.Project: Project Root AGENTS.md (Plain Markdown, simple alternative) [8]Augment CLIDeclarative Context Injection (Structured & Compatibility)Rules are evaluated top-to-bottom, with the first matching rule determining permission.Project: <workspace_root>/.augment/rules/ (Files support YAML frontmatter: always_apply, agent_requested) [10]Ancestor (Compatibility): Searches for standard files like CLAUDE.md and AGENTS.md in the PWD hierarchy. [10]Project (Legacy): <workspace_root>/.augment/guidelines.md (Legacy rule format) [10]GitHub CopilotSimple System Prompt (Repository)Loads specific file content and injects it as a system prompt, applied automatically to all chat requests in the workspace.Ancestor: ./.github/copilot-instructions.md (Requires setting github.copilot.chat.codeGeneration.useInstructionFiles to be enabled) [11, 12]Hierarchical Concatenation (Compatibility)Supports industry-standard instruction files.Ancestor/Project: Repository-wide ./AGENTS.md (Nearest file in the directory tree takes precedence) [13]Agent Definition/ConfigurationUses a dedicated folder structure to define entire custom agent personas.Project: .github/agents (Configuration files defining custom agent personas, tool selection, and workflows)Windsurf (Codeium)Declarative Context Injection (Structured)Rules are automatically discovered across the workspace hierarchy.Project/Ancestor: Nested directories ./.windsurf/rules/ (Rules are stored in .md files; searched from the current workspace up to the Git root) [14]GooseCompatibility (External Standard)Goose relies primarily on its dynamic Memory Extension. For static instructions, it uses industry standards.Project/Ancestor: Relies on standard mechanisms (e.g., AGENTS.md) found in related projects/extensions for static guidance., [[15]]

Agent Names

Use Golang symbols, e.g. Gemini, Cursor etc

Configuration

Let's have a single global variable that is a map from agent to a list of possible rules file paths.

This will need to be populated on start-up based on the cwd, for hierarchical rules, the number of entries will depend on the ...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 2, 2025 18:16
…d prompt commands

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
…ion clarity

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
if err != nil {
return fmt.Errorf("failed to open AGENTS.md: %w", err)
}
defer f.Close()
Copilot AI changed the title [WIP] Add ability to import rules for coding agents Transform Kit into coding-context CLI for managing AI agent rules Nov 2, 2025
Copilot AI requested a review from alexec November 2, 2025 18:26
@alexec
Copy link
Collaborator

alexec commented Nov 2, 2025

@copilot You made the change to the wrong ducking project. Again. These need to be made to coding-context-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants