feat(internal-artifacts): persist specs/plans/reports to gitignored .internal/ #6

Merged
MillasAgent merged 2 commits from feat/internal-artifacts into main 2026-08-23 13:40:45 +00:00
Owner

Summary

Move user-written specs, architect plans, and reviewer reports into a gitignored .internal/ directory at the repo root. The orchestrator becomes the sole writer (subagents retain edit: deny). Existing tracked spec_installer.md and spec_memory.md move out of the index; PLAN_installer.md moves into .internal/plans/. Workflow prose for the 7 orchestrator flows gains explicit "Persist …" sub-steps.

Why

Specs, plans, and reviewer reports are working artifacts — they help the orchestrator's iterations but don't belong in the public bundle. Pushing them to Forgejo exposes internal design decisions and review trails that the user wants kept local. This branch makes the convention a first-class artifact of the workflow.

What ships

Modified

  • workspace/opencode/agents/orchestrator.md — frontmatter edit: askedit: allow; new "Persistence discipline" section; per-flow "Persist …" sub-steps for all 7 flows (sub-step suffixes 4a, 5a, etc. — no renumbering).
  • workspace/opencode/agents/architect.md, code-analyzer.md, security-auditor.md, arch-quality-reviewer.md — each gains a one-line "Output persistence" note pointing at .internal/.
  • .gitignorePLAN_installer.md entry replaced with .internal/.
  • AGENTS.md — 3 stale spec.md references dropped; new §5.8 "Internal artifacts (.internal/)" documents the convention.
  • README.md — stale spec.md tree entry dropped.
  • CHANGELOG.md[Unreleased] block updated with the convention.

Removed (from tracked tree)

  • spec_installer.md.internal/specs/installer.md
  • spec_memory.md.internal/specs/memory.md

New

  • .internal/ (gitignored) with specs/, plans/, reports/ subdirs.
  • workspace/opencode/tests/test_internal.sh — structural validator. 8 assertions: .gitignore entry, orchestrator edit: allow, every flow references .internal/, no stale spec.md in shipped docs, every reporting agent has Output persistence note, files relocated, files removed from index, git status clean for the affected paths.

Design decisions resolved

Question Resolution Rationale
Orchestrator edit permission (ask vs allow vs per-path allowlist) edit: allow Matches code-implementer.md:84 precedent. Per-path allowlists are NOT supported by opencode's schema (same constraint as webfetch at agents/architect.md:95).
Plan format (JSON vs Markdown vs both) Both — .internal/plans/<slug>.json (raw Mode B output) + .internal/plans/<slug>.md (orchestrator-generated Markdown wrapper) Preserves machine-readability for future iterations AND gives the user a human-readable artifact. The orchestrator owns the wrapper; the architect stays as-is.
Cross-flow artifact referencing Read-only lookup at the start of any flow with <slug> Pre-existing spec is read-only context for the next analyzer/architect; stale plan triggers a user warning.
Pre-existing spec handling at repo root Detect + relocate with explicit user consent git rm --cached (not git rm) preserves the file until the explicit mv, in case the move fails mid-flight.

Verification

$ bash workspace/opencode/deploy.sh --check
[deploy] validation OK

$ bash workspace/opencode/tests/test_install.sh
================================
PASS: 20    FAIL: 0
================================
ALL TESTS PASS

$ bash workspace/opencode/tests/test_internal.sh
PASS: .gitignore: .internal/ entry present, PLAN_installer.md entry retired
PASS: orchestrator.md frontmatter: edit: allow
PASS: orchestrator.md: all 7 flows reference .internal/
PASS: no stale spec.md references in shipped docs
PASS: all 4 reporting agents have 'Output persistence' note
PASS: files relocated: .internal/specs/{installer,memory}.md + .internal/plans/installer.md
PASS: files removed from index and from repo root
PASS: git status clean (no untracked spec_*, PLAN_*, .internal)
ALL INTERNAL-ARTIFACTS TESTS PASS

Compatibility

  • Existing bash workspace/opencode/install.sh users: no change (the installer does not create or read .internal/).
  • Future /feature <description> invocations: persist artifacts to .internal/ automatically; the user still sees the chat-thread summary; the persistence is for traceability.
  • The 8 CodeGraph commands (/review, /audit, /explain, /onboard, /update, /status, /next, /continue) bypass the orchestrator and have edit: deny on their agent; they remain chat-only outputs. Out of scope for this branch.

Out of scope

  • The 8 CodeGraph commands' persistence (they bypass the orchestrator; out of scope per analyzer's appendix B).
  • Per-path edit allowlists for subagents (opencode schema does not support them).
  • A future feature for "auto-clean stale .internal/ entries" — the user owns their .internal/ directory.
  • Rewriting the spec content itself — we're moving files, not editing prose. spec_installer.md and spec_memory.md move verbatim.

How to review

git checkout feat/internal-artifacts
bash workspace/opencode/deploy.sh --check
bash workspace/opencode/tests/test_install.sh
bash workspace/opencode/tests/test_internal.sh
# Verify the .internal/ directory layout:
ls -la .internal/specs/ .internal/plans/

Commits

61440b3 feat(orchestrator): persist workflow artifacts to .internal/
54631e8 chore(internal-artifacts): move specs and plans to gitignored .internal/
## Summary Move user-written specs, architect plans, and reviewer reports into a gitignored `.internal/` directory at the repo root. The orchestrator becomes the sole writer (subagents retain `edit: deny`). Existing tracked `spec_installer.md` and `spec_memory.md` move out of the index; `PLAN_installer.md` moves into `.internal/plans/`. Workflow prose for the 7 orchestrator flows gains explicit "Persist …" sub-steps. ## Why Specs, plans, and reviewer reports are working artifacts — they help the orchestrator's iterations but don't belong in the public bundle. Pushing them to Forgejo exposes internal design decisions and review trails that the user wants kept local. This branch makes the convention a first-class artifact of the workflow. ## What ships **Modified** - `workspace/opencode/agents/orchestrator.md` — frontmatter `edit: ask` → `edit: allow`; new "Persistence discipline" section; per-flow "Persist …" sub-steps for all 7 flows (sub-step suffixes `4a`, `5a`, etc. — no renumbering). - `workspace/opencode/agents/architect.md`, `code-analyzer.md`, `security-auditor.md`, `arch-quality-reviewer.md` — each gains a one-line "Output persistence" note pointing at `.internal/`. - `.gitignore` — `PLAN_installer.md` entry replaced with `.internal/`. - `AGENTS.md` — 3 stale `spec.md` references dropped; new §5.8 "Internal artifacts (`.internal/`)" documents the convention. - `README.md` — stale `spec.md` tree entry dropped. - `CHANGELOG.md` — `[Unreleased]` block updated with the convention. **Removed (from tracked tree)** - `spec_installer.md` → `.internal/specs/installer.md` - `spec_memory.md` → `.internal/specs/memory.md` **New** - `.internal/` (gitignored) with `specs/`, `plans/`, `reports/` subdirs. - `workspace/opencode/tests/test_internal.sh` — structural validator. 8 assertions: `.gitignore` entry, orchestrator `edit: allow`, every flow references `.internal/`, no stale `spec.md` in shipped docs, every reporting agent has Output persistence note, files relocated, files removed from index, git status clean for the affected paths. ## Design decisions resolved | Question | Resolution | Rationale | |---|---|---| | Orchestrator `edit` permission (`ask` vs `allow` vs per-path allowlist) | `edit: allow` | Matches `code-implementer.md:84` precedent. Per-path allowlists are NOT supported by opencode's schema (same constraint as `webfetch` at `agents/architect.md:95`). | | Plan format (JSON vs Markdown vs both) | Both — `.internal/plans/<slug>.json` (raw Mode B output) + `.internal/plans/<slug>.md` (orchestrator-generated Markdown wrapper) | Preserves machine-readability for future iterations AND gives the user a human-readable artifact. The orchestrator owns the wrapper; the architect stays as-is. | | Cross-flow artifact referencing | Read-only lookup at the start of any flow with `<slug>` | Pre-existing spec is read-only context for the next analyzer/architect; stale plan triggers a user warning. | | Pre-existing spec handling at repo root | Detect + relocate with explicit user consent | `git rm --cached` (not `git rm`) preserves the file until the explicit `mv`, in case the move fails mid-flight. | ## Verification ```bash $ bash workspace/opencode/deploy.sh --check [deploy] validation OK $ bash workspace/opencode/tests/test_install.sh ================================ PASS: 20 FAIL: 0 ================================ ALL TESTS PASS $ bash workspace/opencode/tests/test_internal.sh PASS: .gitignore: .internal/ entry present, PLAN_installer.md entry retired PASS: orchestrator.md frontmatter: edit: allow PASS: orchestrator.md: all 7 flows reference .internal/ PASS: no stale spec.md references in shipped docs PASS: all 4 reporting agents have 'Output persistence' note PASS: files relocated: .internal/specs/{installer,memory}.md + .internal/plans/installer.md PASS: files removed from index and from repo root PASS: git status clean (no untracked spec_*, PLAN_*, .internal) ALL INTERNAL-ARTIFACTS TESTS PASS ``` ## Compatibility - Existing `bash workspace/opencode/install.sh` users: no change (the installer does not create or read `.internal/`). - Future `/feature <description>` invocations: persist artifacts to `.internal/` automatically; the user still sees the chat-thread summary; the persistence is for traceability. - The 8 CodeGraph commands (`/review`, `/audit`, `/explain`, `/onboard`, `/update`, `/status`, `/next`, `/continue`) bypass the orchestrator and have `edit: deny` on their agent; they remain chat-only outputs. Out of scope for this branch. ## Out of scope - The 8 CodeGraph commands' persistence (they bypass the orchestrator; out of scope per analyzer's appendix B). - Per-path edit allowlists for subagents (opencode schema does not support them). - A future feature for "auto-clean stale `.internal/` entries" — the user owns their `.internal/` directory. - Rewriting the spec content itself — we're moving files, not editing prose. `spec_installer.md` and `spec_memory.md` move verbatim. ## How to review ```bash git checkout feat/internal-artifacts bash workspace/opencode/deploy.sh --check bash workspace/opencode/tests/test_install.sh bash workspace/opencode/tests/test_internal.sh # Verify the .internal/ directory layout: ls -la .internal/specs/ .internal/plans/ ``` ## Commits ``` 61440b3 feat(orchestrator): persist workflow artifacts to .internal/ 54631e8 chore(internal-artifacts): move specs and plans to gitignored .internal/ ```
- .gitignore: replace PLAN_installer.md entry with .internal/ (directory-level
  ignore subsumes the legacy one-off plan ignore).
- README.md: drop the stale 'spec.md' tree entry.
- AGENTS.md: drop 3 stale 'spec.md' references; add new §5.8 'Internal
  artifacts (.internal/)' documenting the convention.
- CHANGELOG.md: add [Unreleased] entries under ### Added and ### Changed
  documenting the new convention, the orchestrator frontmatter change,
  the agent note additions, and the spec_*.md removal.
- git rm --cached spec_installer.md spec_memory.md + mv to .internal/specs/.
- mv PLAN_installer.md (untracked) to .internal/plans/installer.md.

After this commit:
- spec_*.md no longer exists in the repo root or in the index.
- .internal/{specs,plans,reports}/ are gitignored.
- spec.md references in shipped docs are gone (4 references dropped).
The orchestrator becomes the sole writer to the gitignored .internal/
directory. Subagents (analyzer, architect, security-auditor,
arch-quality-reviewer, code-implementer, codegraph) all retain edit: deny
and return content in their output; the orchestrator persists it.

Changes:
- agents/orchestrator.md frontmatter: edit: ask → edit: allow (matches the
  code-implementer precedent; the orchestrator is gated by user approvals
  at every flow gate, not by per-edit dialogs. Object-form per-path edit
  allowlists are not supported by opencode's schema, same constraint as
  webfetch documented at agents/architect.md:95).
- agents/orchestrator.md body: new 'Persistence discipline' section names
  the four .internal/ destinations and the read-only pre-existing-artifact
  lookup convention. Each of the 7 flows (/init, /feature, /bugfix,
  /code-review, /deep-analyze, /security-scan, /implement) gains explicit
  'Persist …' sub-steps using sub-step suffixes (4a, 5a, 5b, 6a, 10a)
  to keep the diff additive.
- agents/architect.md, code-analyzer.md, security-auditor.md,
  arch-quality-reviewer.md: each gains a one-line 'Output persistence'
  note in the body, after the closing ``` of the output template.
  No frontmatter change; edit: deny preserved.
- tests/test_internal.sh: new structural validator. 8 assertions check
  the convention end-to-end: .gitignore entry, orchestrator edit: allow,
  every flow references .internal/, no stale spec.md in shipped docs,
  every reporting agent has the Output persistence note, files relocated,
  files removed from the index, git status clean for the affected paths.

Naming: <slug> matches the kebab-case regex ^[a-z0-9]+(-[a-z0-9]+)*$.
<flow> in {init, feature, bugfix, code-review, deep-analyze,
security-scan, implement}. <role> in {diff-context, analyzer, architect,
security, arch}.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MillasDev/memory!6
No description provided.