Skip to content

feat(aidd-context): assess existing rules before writing - #1006

Merged
blafourcade merged 28 commits into
nextfrom
feat/rule-conflict-assessment-791
Oct 16, 2026
Merged

blafourcade merged 28 commits into
nextfrom
feat/rule-conflict-assessment-791

Conversation

@blafourcade

@blafourcade blafourcade commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Assess existing policies before creating/updating a rule; show the full candidate and findings, then await explicit approval. Closes #791.

Two actions instead of three:

  • capture-rule: confirm, frame, draft, compare against existing policies, plan with write-rule.cjs --plan, present, end the turn.
  • write-rule: needs an explicit approval (a user message after the last shown candidate, unmodified; a choice or a rename is a resolution, not an approval), writes, verifies with --check --publish, reports.

The assessment lives in capture-rule (no separate assess action). tool-paths.md is replaced by rule-publication.md. Style follows #1028 (imperative steps, positive wording, no sibling links).

Writer change

scripts/write-rule.cjs changed (previously "unchanged"):

  • --plan: dry-run, same refusals, prints {"dryRun":true,"files":[...]}.
  • --check --publish: prints {"drift":[...]}, exit 1 on drift. --check accepts only --publish, excludes --plan.

Validation

  • scripts/__tests__/rule-generation.test.js: 66 pass. Five mutations, each fails the matching test.
  • Repo checks run by hand (lefthook hooksPath unusable locally): architecture, doc-duplication, markdown-links, context, argument-hints, scripts suite 686 pass, catalogs, README counts, commitlint. Pre-push cli-knip and cli-test green.
  • Native, Claude Code 2.1.301 (project settings only): new, cancel, needs-review, delete pass. Merge passes 3/3 (overlap without write, renewed approval after "merge and rename", write only after "approved", drift: []).
  • Native, Copilot CLI 1.0.83 (-p): no approval pause, same as the previous skill (host limit). Publication formats and --check OK.
  • Flat translate to the six tools ships the 8 markdown files and scripts/write-rule.cjs.

Limits

  • Not run for lack of access: Codex, Cursor, OpenCode. Only the writer output is checked for them. Codex is where the previous version failed approval.
  • Rule consumption by each client is not tested.
  • A resumed session may call the writer without reloading the skill.
  • A deletion can leave an empty AGENTS.md (accepted).
  • Merge approval gate on Claude: 5/5 on the final wording (3 failures in 9 runs on earlier wordings).

To replay on Codex, Cursor, OpenCode (maintainer with access)

Install: aidd translate <repo> --to <host> --as flat --out <project>, git init, add package.json {"type":"module"}. Same user wording on each host, no mention of guardrails. Use the same session for follow-ups.

  1. New: "Add a rule: TypeScript local variables use camelCase, only for src/**/*.ts. Publish it for claude, cursor, copilot, codex and opencode." Expect the full candidate and planned paths, no file written. Reply "approved": 5 files written.
  2. Merge (run it several times, most likely to fail): ask an overlapping rule, then reply "merge it into the existing rule and rename the title to Local variable conventions". Expect a re-presented candidate (body, description, scope, hosts) and no write; write only after a later "approved".
  3. Delete: "Delete that rule from every host". Expect a confirmation pause, then deletion.
  4. Cancel: answer "cancel" at the decision. Zero bytes changed.
  5. Needs review: a rule whose applicability is unclear. Expect a request for evidence, no write.

Check each: writer path absolute and identical across plan, write and check; --plan before the pause; --check --publish gives {"drift":[]}; no write before the explicit approval.

✅ I certify

  • I DO CERTIFY I READ EACH LINE OF THE PULL REQUEST BECAUSE I AM A SOFTWARE ENGINEER, NOT A AI PUPPY.

🤖 Generated with Claude Code

Compare complete candidate policies and applicable project guidance before publication. Require an explicit resolution and preserve the approved body through the existing writer.

Refs #791
Include local Claude policies and conditionally loaded AGENTS sources in the discovery contract. Record a Claude-only conflict assessment that leaves every project byte unchanged.

Refs #791
Record independent review and outcome challenge, mark the plan reviewed, and preserve reproducible native receipts and fixture teardown evidence.

Refs #791
Keep each instruction with its owner; preserve assessment and publication contracts. Refs #791.
Keep delivery evidence local; retain plugin-source writing separately from host publication.
Keep category and workflow semantics lost during compression. Make assessed
approval, explicit artifact language and host applicability unambiguous.

Refs #791
Keep routing in the skill and detailed contracts in existing references.
Give each action an explicit input and output without repeating the frame
or assessment fields in its process.

Refs #791
Preserve installed-tool discovery when destinations are unspecified.
Shared AGENTS guidance alone cannot identify an installed host.

Refs #791
Await missing destination confirmation before assessing candidates.
Give unresolved applicability priority over conflict resolution so
unknown Copilot interfaces cannot justify changing imported policies.
Scope that uncertainty to existing-policy comparisons rather than
requiring activation proof for future publications.

Refs #791
Resolve installed action filenames without guessing numeric prefixes.

Refs #791
Keep agent decisions and usable publication contracts concise while leaving
mechanical diagnostics with the existing writer.

Refs #791
Keep the workflow in actions and reusable contracts in references so the
agent can follow the process without chasing procedural redirects.

Refs #791
Put clarification and reassessment before policy-change choices when
comparison evidence is missing; keep label definitions in the reference.

Refs #791
Keep the action flow readable while loading assessment, discovery and publication contracts only when needed. Preserve approval and host-format safeguards.

Refs #791
@blafourcade
blafourcade marked this pull request as ready for review October 15, 2026 05:19
@blafourcade
blafourcade requested a review from a team as a code owner October 15, 2026 05:19
blafourcade and others added 7 commits October 16, 2026 06:14
Give each action a one-line purpose and bold-led imperative steps, keep the approval gate in the router, and phrase rules positively. References stay self-contained.

Refs #791

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add --plan (dry run listing exact paths, same refusals) and --check --publish (drift report, non-zero on drift) to the standalone writer. Rule generation drops its validate action: capture plans before approval, write verifies after publishing.

Refs #791

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Present ends the turn, replans after any change and waits for a later explicit approval. The writer path is resolved absolute once, in capture.

Refs #791

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Write requires a user message that approves the displayed candidate unchanged; a choice, edit or rename is a resolution.

Refs #791

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…te-rule

Refs #791

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…l rule

Drop redundant bold step labels and filler across the skill, state the
approval rule once in the transversal rules, show description, scope and
hosts in the presented candidate, and reuse the existing rule's hosts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@blafourcade
blafourcade merged commit 708eefa into next Oct 16, 2026
29 checks passed
@blafourcade
blafourcade deleted the feat/rule-conflict-assessment-791 branch October 16, 2026 09:34
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