Skip to content

fix(aidd-context): generate rules through a standalone skill script - #979

Merged
blafourcade merged 6 commits into
nextfrom
fix/opencode-rule-discovery
Oct 12, 2026
Merged

blafourcade merged 6 commits into
nextfrom
fix/opencode-rule-discovery

Conversation

@blafourcade

@blafourcade blafourcade commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🎯 What & why

Creating a project rule should work from the installed skill and preserve its full content across Claude Code, Cursor, GitHub Copilot, Codex and OpenCode V2. The skill now owns publication without requiring the AIDD CLI, and shared guidance uses readable titles and concise scopes.

🛠️ How it works

The standalone writer accepts explicit JSON metadata and the complete Markdown body. Editable canonical sources live in aidd_docs/rules/. Claude, Cursor and Copilot receive native files; Codex and OpenCode share a signed contribution in root AGENTS.md.

The skill resolves the writer beside its loaded SKILL.md, so native and flat installations support create, update, publish and delete. Validation happens before mutation; signatures protect generated outputs, while user guidance, memory, exact literals and body bytes survive. Shared publication omits taxonomy identifiers from added headings, avoids adding a title before a leading ATX/single-line Setext title, and preserves literal glob text.

The official Codex contract and OpenCode V2 instructions underpin the active surfaces. cli/ is unchanged from 12777d03; the initial CLI coupling and budget increase are removed.

🧪 How to verify

  • node scripts/check-tests-leave-git-alone.js -- node --test 'scripts/__tests__/**/*.test.js': 624 tests pass, including 61 rule-generation tests and nine reproduction-security/capability tests. Native YAML is parsed independently with the existing dependency.
  • Portable sandbox: six projects, ten identical delivered writers, 78 lifecycle operations, 12 refusals with unchanged project bytes, 54 application tests and cleanup ownership checks. Repeated after the filesystem-safety correction.
  • Current Claude, Codex, OpenCode V2 and Copilot binaries: 32 native sessions and 65 captured local-provider requests. Complete bodies, replacement and deletion are checked in actual model-request inputs. Copilot scoped retrieval is explicit; automatic attachment is not established.
  • Official contracts, current verification and independent review: no open local finding. All 238 indexed archived evidence hashes match staged Git blobs; raw receipts retain exact bytes.
  • The reproduction scripts now bind ownership/snapshot reads to validated descriptors with no symlink following and guaranteed closure. Eight POSIX regression tests, a cross-platform refusal test and three deliberately broken disposable copies exercise these protections; runtime guards refuse FIFOs and terminate both parent and child on timeout. Reproduction reads fail before any open when no-follow/nonblocking protections are unavailable; the eight POSIX cases are explicitly skipped on unsupported platforms.

⚠️ Heads-up

Current mock-provider captures prove host input loading, not semantic model enforcement. Historical subscription-model evidence retains its previous writer hash and incomplete Cursor quota-limited control; it is not presented as a complete five-host model test of this revision. A current Cursor Auto attempt also stops on the existing Free quota before an assistant tool call; no upgrade or fallback follows. No complete current five-host model-enforcement pass or Linux/Windows native-host runtime claim.

Codex/OpenCode scopes are model guidance rather than native glob filtering. Mixed hosts may discover both shared and native guidance. The conservative Codex guard cannot measure other project documents or an overridden project-document budget; verified Codex versions assemble global instructions separately from that project counter. Publication preserves bodies without implementing a full Markdown parser.

No automatic legacy migration, multi-file disk-failure rollback or concurrent-writer guarantee. Comma-containing globs are refused; use separate patterns. OpenCode V1, lifecycle synchronization, standalone-rule flat archives (#789) and Kilo (#914) remain outside scope. Archived CRLF fixtures and raw receipts have scoped Git attributes preserving their exact bytes.

🔗 Linked issue

Refs #913. This PR implements the selected V2 contract and the five-host autonomous skill; it does not claim the original V1 configuration.instructions/JSONC criteria.

✅ I certify

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

OpenCode V2 ignores config.instructions, leaving modular rules inactive. Publish a validated contribution in AGENTS.md while preserving user guidance and ownership boundaries.

Refs #913

AIDD-Session-Id: 01a11d17-ccfd-7c83-98ac-c1f872b125ed
AIDD-Session-Id: 01a11d17-ccfd-7c83-98ac-c1f872b125ed
@blafourcade blafourcade changed the title fix(cli): activate project rules in OpenCode V2 fix(aidd-context): generate rules through a standalone skill script Oct 9, 2026
…dance

Resolve the writer beside the installed skill so native and flat layouts
support rule creation, update, publication and deletion without a checkout.
Preserve exact requirements and body bytes while keeping shared guidance
readable, with reproducible and bounded native validation.

Refs #913

AIDD-Session-Id: 01a11d17-ccfd-7c83-98ac-c1f872b125ed
@waewoo

waewoo commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Hi @blafourcade,

I'm starting work on #914 (Kilo-native generation targets), and I've noticed that this PR introduces a standalone rule writer that overlaps with the rule-generation part of my implementation.

My plan is to extend the new writer with Kilo support rather than introduce a separate implementation, particularly for .kilo/rules/ generation and safe kilo.json[c] updates.

Since this PR is still in Draft, do you have any recommendations on how best to coordinate these changes? Would you suggest waiting for #979 to merge before implementing the rule-generation part of #914, while I work on the other independent generators in the meantime?

I'd appreciate your guidance to avoid conflicts or duplicated work.

Thanks!

Prevent ownership and snapshot checks from following a replaced pathname. Exercise descriptor closure, symlink refusal and replacement races.

Refs #913
Parse native metadata independently and archive realistic installed-skill and current native-input checks. Correct the Codex project-budget guidance and retain explicit Cursor quota and Copilot retrieval limits.

Refs #913
Missing open flags must never silently enable symlink following on Windows. Keep unsupported POSIX scenarios explicit and verify that the real helper refuses before opening a file.

Refs #913
@blafourcade
blafourcade marked this pull request as ready for review October 12, 2026 03:28
@blafourcade
blafourcade requested a review from a team as a code owner October 12, 2026 03:28
@blafourcade
blafourcade enabled auto-merge (squash) October 12, 2026 03:28
@blafourcade

Copy link
Copy Markdown
Contributor Author

@waewoo Thanks for coordinating. Yes: please extend the existing rule writer and its tests in #914 rather than introduce a second rule-generation implementation. Reuse its canonical sources, publication lifecycle and ownership/preservation checks, and add the Kilo-specific adapter according to Kilo's official contract.

#979 is now ready for review, with all 18 executed CI checks green, and I am merging it into next. You can work on the independent generators now and base the rule-generation changes on the updated next once this merge lands.

One boundary to keep explicit: the current writer has no Kilo support or JSON/JSONC configuration updater. Any required kilo.json[c] wiring belongs to #914 and should preserve user-owned comments, formatting and unrelated values, with refusal tests for unsafe edits. Kilo support remains outside #979.

@blafourcade
blafourcade merged commit c827990 into next Oct 12, 2026
25 checks passed
@aidd-bot aidd-bot Bot mentioned this pull request Oct 16, 2026
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.

3 participants