Skip to content

refactor(context): rules as a single tool-agnostic surface in aidd_docs/rules#257

Draft
alexsoyes wants to merge 2 commits into
mainfrom
feat/rules-in-aidd-docs
Draft

refactor(context): rules as a single tool-agnostic surface in aidd_docs/rules#257
alexsoyes wants to merge 2 commits into
mainfrom
feat/rules-in-aidd-docs

Conversation

@alexsoyes
Copy link
Copy Markdown
Contributor

Problem

Codex CLI has no native rules surface, so generating rules for it from aidd-context:03-context-generate never worked — rules were skipped at install. Per-tool surfaces (.claude/rules, .cursor/rules, .github/instructions, .opencode/rules) also fragmented the same conventions across tools.

Decision

Rules become a single, tool-agnostic surface: aidd_docs/rules/<NN-category>/<slug>.md — one shape, one location, one extension (.md), read by every tool (Codex included).

  • The framework owns rules now, not the IDE: aidd-dev:01-plan selects which rules apply per task; 05-review verifies against that selection.
  • IDEs no longer auto-attach by glob; they just read aidd_docs/rules/ via their context file (CLAUDE.md / AGENTS.md / copilot-instructions.md).
  • paths survives but its consumer shifted: from IDE auto-attach trigger → selection hint for the plan.

⚠️ Tradeoff: loss of native glob auto-attach, compensated by plan-time selection + reviewer enforcement.

Changes (14 files)

aidd-context

  • ai-mapping.md (03 + 06): Rules column → aidd_docs/rules/ for all tools; new canonical rules section; retired per-tool rule frontmatter/extensions.
  • rule.md: single .md, canonical path, portable code refs.
  • 01-generate-rules.md: write one canonical file, drop D2 rule-blocking, wire each installed tool's context file to reference the surface.
  • assets/rules/: 3 per-tool templates collapsed into one rule-template.md (with corrected authoring guidance: paths array optional, description = one selection-useful sentence, groups/examples optional).
  • list-rules.mjs: scan aidd_docs/rules/ only; output { path, name, description, paths }. Tested (empty → [], fixture → OK).
  • 06-find-rule.md: drop the Tool column, single source.

aidd-dev

  • 01-plan.md: inventory + select rules from aidd_docs/rules/; applicable_rules drops the tool field.
  • plan-template.md + 09-for-sure/plan-template.md: section renamed "Rules to apply" (no Tool column) — the plan chooses which rules apply.

Out of scope

  • Migration of any existing real .claude/rules/ in a project → aidd_docs/rules/. This PR changes the generators/skills, not rules already laid down in a consumer project.

Notes

  • commit-msg hook (commitlint) skipped — binary absent in the worktree (toolchain not installed), not a message-format rejection.

🤖 Generated with Claude Code

alexsoyes and others added 2 commits June 8, 2026 17:09
…docs/rules

Codex CLI has no native rules surface, so generating rules for it from
03-context-generate never worked (rules were skipped at install). Instead
of per-tool surfaces (.claude/rules, .cursor/rules, .github/instructions,
.opencode/rules), rules now live once in the canonical, tool-agnostic
aidd_docs/rules/<NN-category>/<slug>.md - read by every tool, Codex included.

- ai-mapping (03 + 06): Rules column -> aidd_docs/rules/ for all tools;
  add canonical rules section; retire per-tool rule frontmatter/extensions.
- rule.md: single .md extension, canonical path, portable code refs.
- 01-generate-rules: write one canonical file, drop D2 rule-blocking,
  wire each installed tool's context file to reference aidd_docs/rules/.
- assets/rules: collapse 3 per-tool templates into one rule-template.md.
- list-rules.mjs: scan aidd_docs/rules/ only; output { path, name, description, paths }.
- 06-find-rule: drop the Tool column, single source.
- 01-plan: inventory + select rules from aidd_docs/rules/; applicable_rules
  drops the tool field; plan templates rename section to "Rules to apply"
  (no Tool column) - the plan chooses which rules apply per task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…es.mjs

01-plan inventoried rules in prose. Now, once the architecture projection
(the settled modify/create/delete file set) is known, it runs list-rules.mjs
and matches each rule's `paths` globs against the projected modify/create
files - so rule selection is grounded in the actual files, not guessed.

- Add plugins/aidd-dev/scripts/list-rules.mjs (source; synced copy stays in
  06-discovery). Build the entry via conditional spread to drop a stray TS
  property-inference warning.
- 01-plan: move rule inventory out of the sub-agent step into the gate; run
  the script after the projection is settled; a rule applies when it has no
  `paths` (general) or any glob matches a modify/create file. Update the test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alexsoyes
Copy link
Copy Markdown
Contributor Author

@blafourcade je sais pas ce que t'en penses ? plus de .cursor/rules etc on prend en charge la fonctionnalité nous-même et tout part dans aidd_docs/rules on vient les choisir au /plan.

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.

1 participant