From b606e9c037b89a5a8c07acf325f9e3d3d16bcd91 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sun, 15 Nov 2026 15:52:56 -0500 Subject: [PATCH] feat(reconcile-docs,gitea-plan,implement-slice): wire read-only Gitea ingestion and drift hooks - reconcile-docs: ingest merged PRs, published code-review comments, milestones, and Project Board column placement (Completed vs. Backlog/Ready) read-only via gt; include active design specs (docs/designs/*.md) and Mid-Slice Spec Drift resolution; hand off to gitea-plan when reconciled docs require tracker updates. - gitea-plan: hand off to reconcile-docs at milestone boundaries or when canonical docs lag behind Completed board cards. - implement-slice: check for upstream design spec drift in Step 1 preflight and prompt to run reconcile-docs at Step 7 when Scope Drift evolves a contract in docs/designs/*.md or ARCHITECTURE.md. - tests: add test_reconcile_docs_gitea_ingestion_and_hooks. --- skills/gitea-plan/SKILL.md | 9 ++++--- skills/implement-slice/SKILL.md | 5 ++-- .../references/handoff-contracts.md | 2 +- skills/reconcile-docs/SKILL.md | 24 +++++++++++-------- .../references/doc-contracts.md | 11 +++++++++ .../references/reconciliation-matrix.md | 11 +++++++-- .../test_skills_behavioral_contracts.py | 24 +++++++++++++++++++ 7 files changed, 68 insertions(+), 18 deletions(-) diff --git a/skills/gitea-plan/SKILL.md b/skills/gitea-plan/SKILL.md index 63b8d6d..0ee105c 100644 --- a/skills/gitea-plan/SKILL.md +++ b/skills/gitea-plan/SKILL.md @@ -19,9 +19,11 @@ description: >- ## Steps 1. **Reconcile artifacts bidirectionally.** Check specs, roadmaps, assets, and Gitea - state for contradictions. Flag zombie in-progress, premature done, or horizon - divergence conflicts before planning new work. See - [references/decomposition-tiers.md](references/decomposition-tiers.md). + state for contradictions. Flag zombie in-progress, premature completed, or horizon + divergence conflicts before planning new work. When closing a milestone or before + decomposing the next rolling milestone, if `ARCHITECTURE.md`, `ROADMAP.md`, or + `docs/designs/*.md` lag behind `Completed` board cards, hand off to `reconcile-docs` + first. See [references/decomposition-tiers.md](references/decomposition-tiers.md). 2. **Assess scope and select tier.** Assign `Small`, `Medium`, or `Large`. Emit explicit `### Project Board Policy: (Rationale)`. 3. **Decompose into deliverable outcome slices.** Map work into verifiable issues @@ -70,3 +72,4 @@ description: >- - `implement-slice`: to orchestrate end-to-end delivery of an approved issue or slice. - `git-manager`: to create dedicated branches or worktrees for decomposed issues. - `gitea-pr`: to link, review, and close issues via pull requests. +- `reconcile-docs`: when canonical docs or design specs lag behind completed slices or milestone boundaries. diff --git a/skills/implement-slice/SKILL.md b/skills/implement-slice/SKILL.md index b4e31b2..0a28982 100644 --- a/skills/implement-slice/SKILL.md +++ b/skills/implement-slice/SKILL.md @@ -17,13 +17,13 @@ description: >- - Not inside an already-delegated implementation worker task: follow the assigned worker contract (`tdd`, `git-manager`) without re-invoking `implement-slice`. ## Steps -1. **Preflight branch check, readiness audit, and `Backlog -> Ready`.** Check session mode per `profile/AGENTS.md`. Classify working tree per [handoff-contracts](references/handoff-contracts.md) (`CLEAN_BASE`, `ADOPTABLE_DIFF`, `CONFLICTING_STATE`, `WRONG_BASE`). Stop on conflicts. Read target Gitea issue/milestone/board state via `gt issue`, `gt milestone`, direction docs (`ARCHITECTURE.md`, `ROADMAP.md`, `AGENTS.md`), and `git status --short`. Reconcile issue acceptance criteria against current `HEAD` (updating the Gitea issue after owner approval if earlier slices shifted contracts) and, when `--dry-run` is not active, move the issue card `Backlog -> Ready` on the project board. Hand off to `gitea-plan` if tracking issues must be created first. +1. **Preflight branch check, readiness audit, and `Backlog -> Ready`.** Check session mode per `profile/AGENTS.md`. Classify working tree per [handoff-contracts](references/handoff-contracts.md) (`CLEAN_BASE`, `ADOPTABLE_DIFF`, `CONFLICTING_STATE`, `WRONG_BASE`). Stop on conflicts. Read target Gitea issue/milestone/board state via `gt issue`, `gt milestone`, direction docs (`ARCHITECTURE.md`, `ROADMAP.md`, `docs/designs/*.md`, `AGENTS.md`), and `git status --short`. Reconcile issue acceptance criteria against current `HEAD` (handing off to `reconcile-docs` if canonical design docs drifted during upstream slices, or updating the Gitea issue after owner approval) and, when `--dry-run` is not active, move the issue card `Backlog -> Ready` on the project board. Hand off to `gitea-plan` if tracking issues must be created first. 2. **Select orchestration topology (`complexity x risk`).** Combine planning size with assurance risk per [orchestration-tiers](references/orchestration-tiers.md). Keep pure-orchestrator invariants: retain plan, status, commit SHAs, QA dispositions, blockers; never edit implementation files, repair Git via code edits, self-certify QA, or ingest full test logs unless resolving a failure. 3. **Lock Planned Workflow and pre-committed rubrics.** Formulate the Planned Workflow using the Canonical Node Schema (5-tuples: `node_id`, `claim`, `method`, `executor`, `pass_condition`). Project a dynamic Mermaid diagram deriving directly from node IDs with visible rework edges. If `--dry-run` is active, halt after displaying the plan (enforce 0 file changes, 0 commits, 0 remote calls). Hard gate: pause for human approval. 4. **Move card `Ready -> Work in Progress`, assign workspaces, and delegate.** Once the human approves Step 3, move the issue card `Ready -> Work in Progress` on the project board per [handoff-contracts](references/handoff-contracts.md). Govern branch/worktree lifecycle through `git-manager` per [orchestration-tiers](references/orchestration-tiers.md). Dispatch worker subagent(s) with the Implementation Assignment in [handoff-contracts](references/handoff-contracts.md). Never run concurrent workers in the same working tree. Update the runtime Execution Record table as nodes change state. 5. **Audit worker reports and run rubric QA.** Verify worker reports via read-only Git checks. Spawn read-only QA subagents running `verify-slice` against pre-committed rubrics. Update Execution Record with concrete evidence (SHA, exit codes). 6. **Triage outcomes and route rework.** Classify failures using [handoff-contracts](references/handoff-contracts.md): route code defects to existing worker via `send_message`; record justified rubric amendments if criteria change. Loop Steps 4-6 until all nodes pass. -7. **Enforce final-HEAD evidence, move card `Work in Progress -> Review`, and integrate.** Confirm `code-review` (`Ready`) and `verify-slice` match the exact final `HEAD` and base, then move the issue card `Work in Progress -> Review` on the project board. Present the Execution Deviation Report (skipped/added checks, rework iterations, scope drift). Integrate per [orchestration-tiers](references/orchestration-tiers.md) Policy Matrix: fast-forward merge (and move card `Review -> Completed`) if repo `AGENTS.md` permits and user approves, else hand off to `gitea-pr`. +7. **Enforce final-HEAD evidence, move card `Work in Progress -> Review`, and integrate.** Confirm `code-review` (`Ready`) and `verify-slice` match the exact final `HEAD` and base, then move the issue card `Work in Progress -> Review` on the project board. Present the Execution Deviation Report (skipped/added checks, rework iterations, scope drift; if scope drift evolved a contract in `docs/designs/*.md` or `ARCHITECTURE.md`, prompt to run `reconcile-docs` before the next slice). Integrate per [orchestration-tiers](references/orchestration-tiers.md) Policy Matrix: fast-forward merge (and move card `Review -> Completed`) if repo `AGENTS.md` permits and user approves, else hand off to `gitea-pr`. ## Your call - **Session mode**: decide whether to switch from `learning` to `delivery` before autonomous delegation. @@ -42,3 +42,4 @@ description: >- - `code-review`: for final-slice 4-axis static and strategic alignment inspection. - `diagnose`: when an unexpected failure requires evidence-first root-cause investigation. - `gitea-pr`: when policy or remote CI mandates a pull request and final-`HEAD` packets are ready. +- `reconcile-docs`: when upstream slices or approved scope drift leave canonical docs or design specs out of sync with `HEAD`. diff --git a/skills/implement-slice/references/handoff-contracts.md b/skills/implement-slice/references/handoff-contracts.md index 27a5c55..308fe54 100644 --- a/skills/implement-slice/references/handoff-contracts.md +++ b/skills/implement-slice/references/handoff-contracts.md @@ -89,7 +89,7 @@ Updated dynamically in orchestrator turns: - **Skipped Checks**: - **Added Checks**: - **Rework Iterations**: <0 | Details of remediation loops and commit references> -- **Scope Drift**: +- **Scope Drift**: ``` ### Dynamic Mermaid Projection Rules diff --git a/skills/reconcile-docs/SKILL.md b/skills/reconcile-docs/SKILL.md index c1aa1ac..9eed253 100644 --- a/skills/reconcile-docs/SKILL.md +++ b/skills/reconcile-docs/SKILL.md @@ -2,30 +2,33 @@ name: reconcile-docs description: >- Audit, reconcile, and generate canonical repository documentation (README.md, - ARCHITECTURE.md, docs/adr/, ROADMAP.md) against commit history, code reality, - and active plans. Use when updating a repository's official documentation. - For capturing session notes or personal insights into the vault, use document. + ARCHITECTURE.md, docs/adr/, ROADMAP.md, docs/designs/*.md) against commit + history, code reality, Gitea delivery state, and active plans. Use when + updating a repository's official documentation. For capturing session notes + or personal insights into the vault, use document. --- # Reconcile Docs ## Use when -- `/reconcile-docs [history-path]`: audit or reconcile repository documentation against history and active plans. +- `/reconcile-docs [history-path]`: audit or reconcile repository documentation against history, Gitea state, and active plans. +- Closing a milestone or resolving mid-milestone design spec drift flagged by `code-review` or `implement-slice`. - Not for capturing a single session's insight (use `/document`). - Not for triaging inbox notes into vault directories (use `draft-curation`). ## Steps -1. **Discover Present State.** Inspect working-tree status, repository source, tests, configuration, and existing docs. Build a present-state inventory of components, responsibilities, boundaries, and dependencies. -2. **Reconstruct History.** Read chronological notes and commit history from the provided history source (vault records, discussions, previous ADRs). Extract decisions, rejected alternatives, migrations, constraints, and incidents. Classify each observation. -3. **Extract Future Intent.** Identify active plans, roadmaps, and open proposals. Classify each as committed, planned, exploratory, or superseded. -4. **Reconcile and Detect Conflicts.** Correlate past claims, present code reality, and future plans using [references/reconciliation-matrix.md](references/reconciliation-matrix.md). Flag contradictions (such as historical claims contradicted by code, or plans masquerading as current implementation). +1. **Discover Present State.** Inspect working-tree status, repository source, tests, configuration, `AGENTS.md`, and existing docs. Build a present-state inventory of components, responsibilities, boundaries, and dependencies. +2. **Reconstruct History.** Read chronological notes and commit history from the provided history source (vault records, discussions, previous ADRs) and, when a Gitea remote exists, read merged PRs and published `code-review` PR comments/reviews via `gt` (using `gt-usage` read-only queries). Extract decisions, accepted trade-offs, mid-slice contract pivots, rejected alternatives, migrations, and incidents. +3. **Extract Future Intent.** Identify active plans, roadmaps (`ROADMAP.md`, `docs/designs/*.md`), and, when a Gitea remote exists, read open/closed Gitea milestones, issues, and Project Board column placement (`Completed` vs. `Backlog`, `Ready`, `Work in Progress`, `Review`) read-only via `gt`. Classify each item as committed, planned, exploratory, or superseded. Never mutate Gitea issues, PRs, or board cards. +4. **Reconcile and Detect Conflicts.** Correlate past claims, present code reality, and future plans using [references/reconciliation-matrix.md](references/reconciliation-matrix.md). Flag contradictions (historical claims contradicted by code, mid-slice spec drift in `docs/designs/*.md`, or `Backlog` plans masquerading as current implementation). 5. **Human Checkpoint.** Present a Reconciliation Report following [references/checkpoint-format.md](references/checkpoint-format.md) listing present architecture, recovered decisions, resolved and unresolved conflicts, and proposed document mutations. Stop for user approval. 6. **Draft or Update Canonical Docs.** Once approved, generate or update target artifacts following [references/doc-contracts.md](references/doc-contracts.md) in order: - `README.md` (identity, purpose, high-level navigation) - `ARCHITECTURE.md` (canonical present-state system model only) - `docs/adr/` (accepted or superseded decision records with context) - - `ROADMAP.md` (intentional future direction only) -7. **Verify Consistency.** Run cross-document consistency checks: verify no future claims in ARCHITECTURE, no obsolete claims in README, consistent terminology, and valid links. + - `ROADMAP.md` (intentional future direction and completed milestones) + - `docs/designs/*.md` (when an active multi-slice design spec has drifted behind merged slices) +7. **Verify Consistency.** Run cross-document consistency checks: verify no future claims in ARCHITECTURE, no obsolete claims in README or active design specs, consistent terminology, and valid links. ## Your call - History source location if not specified or ambiguous. @@ -38,3 +41,4 @@ description: >- ## Hands off to - `git-manager`: for branch setup or committing updated documentation files. +- `gitea-plan`: when reconciled `ROADMAP.md` or `docs/designs/*.md` require new or updated Gitea milestones, issues, or board reconciliation. diff --git a/skills/reconcile-docs/references/doc-contracts.md b/skills/reconcile-docs/references/doc-contracts.md index 7d86515..fa23274 100644 --- a/skills/reconcile-docs/references/doc-contracts.md +++ b/skills/reconcile-docs/references/doc-contracts.md @@ -99,3 +99,14 @@ Only items that represent intentional, validated future trajectory belong here. ### Contract Invariants - Never include implemented features as active roadmap items. - Avoid dumping every scratchpad TODO into the roadmap; include only items with deliberate commitment or research interest. + + +--- + +## 5. Active Design Specifications (docs/designs/*.md) + +**Core Question**: What is the approved technical specification for an active multi-slice feature or epic? + +### Contract Invariants +- When an earlier slice in a multi-slice milestone intentionally evolves a shared interface, config schema, or error taxonomy on `main` (and codifies it in `AGENTS.md` or PR review comments), update the affected sections of `docs/designs/*.md` so subsequent slices (`implement-slice` Step 1) do not build against stale contracts. +- Never modify read-only historical proof-of-concept directories (`docs/poc/`). diff --git a/skills/reconcile-docs/references/reconciliation-matrix.md b/skills/reconcile-docs/references/reconciliation-matrix.md index 14c3442..4f9260c 100644 --- a/skills/reconcile-docs/references/reconciliation-matrix.md +++ b/skills/reconcile-docs/references/reconciliation-matrix.md @@ -9,8 +9,10 @@ Treat each source according to its temporal role and authority: | Source | Temporal role | Epistemic authority | | :--- | :--- | :--- | | Chronological records (vault notes, logs, discussions) | Past | Historical evidence. Explains how the system arrived here. | -| Repository implementation (code, tests, configuration) | Present | Canonical technical truth. Determines what the system is right now. | -| Existing repository documentation | Present | Canonical unless contradicted by current implementation. | +| Merged PRs & published `code-review` comments (`gt pr`) | Past -> Present | Primary record of slice-level contract evolutions, accepted trade-offs, and deferred nits. | +| Repository implementation (code, tests, configuration, `AGENTS.md`) | Present | Canonical technical truth. Determines what the system is right now. | +| Existing repository documentation (`ARCHITECTURE.md`, `docs/designs/*.md`) | Present | Canonical unless contradicted by current implementation. | +| Gitea Milestones & Project Board (`Completed` vs. `Backlog`/`Ready`) | Present -> Future | Read-only delivery state: `Completed` cards are present truth; `Backlog`/`Ready` cards are future intent. | | Active plans (roadmaps, proposals, pending designs) | Future | Planned intent. Describes where the system may go next. | | ADRs | Past -> Present | Historical decision record that remains valid until superseded. | | ROADMAP | Future | Intended technical trajectory. | @@ -53,3 +55,8 @@ Flag contradictions explicitly during reconciliation rather than quietly smoothi ### Amnesiac Implementation - *Symptom*: The codebase contains complex boundaries, non-standard conventions, or unusual workarounds, but history contains no explanation. - *Resolution*: Document the current reality in `ARCHITECTURE.md` and surface an ADR candidate during the Step 5 human checkpoint so the engineer can supply the missing rationale. + + +### Mid-Slice Spec Drift +- *Symptom*: A merged slice intentionally evolved a shared type, configuration model, error class, or boundary (documented in `AGENTS.md` or PR review comments), leaving an active design specification (`docs/designs/*.md`) or `ARCHITECTURE.md` referencing the pre-slice contract. +- *Resolution*: Reconcile the affected sections of `docs/designs/*.md` and `ARCHITECTURE.md` to match the merged implementation on `main` before downstream slices execute. diff --git a/tests/fixtures/test_skills_behavioral_contracts.py b/tests/fixtures/test_skills_behavioral_contracts.py index 8798186..9d19625 100755 --- a/tests/fixtures/test_skills_behavioral_contracts.py +++ b/tests/fixtures/test_skills_behavioral_contracts.py @@ -15,6 +15,7 @@ Verifies: 9. Skill inventory, line count (<= 80), em-dash absence, and path portability 10. Review comment publishing ownership (code-review drafts, gitea-pr posts with guards) 11. Project board 5-column reconciliation, semantic hex colors, and transition ownership +12. reconcile-docs read-only Gitea ingestion and bidirectional hooks with gitea-plan / implement-slice """ import os @@ -428,6 +429,29 @@ class TestSkillsBehavioralContracts(unittest.TestCase): "code-review must remain read-only and never execute project board card moves", ) + def test_reconcile_docs_gitea_ingestion_and_hooks(self): + """Proves reconcile-docs ingests Gitea state read-only and hooks into gitea-plan and implement-slice.""" + rd_dir = REPO_ROOT / "skills" / "reconcile-docs" + rd_skill = (rd_dir / "SKILL.md").read_text() + rd_all = "\n".join(p.read_text() for p in rd_dir.rglob("*.md")) + plan_skill = (REPO_ROOT / "skills" / "gitea-plan" / "SKILL.md").read_text() + impl_skill = (REPO_ROOT / "skills" / "implement-slice" / "SKILL.md").read_text() + + # 1. reconcile-docs reads Gitea PR comments and board state, and targets docs/designs/*.md + self.assertIn("docs/designs/*.md", rd_skill) + self.assertIn("Project Board", rd_skill) + self.assertIn("Never mutate Gitea issues, PRs, or board cards", rd_skill) + self.assertIn("Mid-Slice Spec Drift", rd_all) + self.assertIsNone( + re.search(r"(/projects/[^\n]*/move|gt (issue|pr|project) (create|edit|close|merge))", rd_all), + "reconcile-docs must never mutate Gitea issues, PRs, or project boards", + ) + + # 2. Bidirectional hooks across reconcile-docs, gitea-plan, and implement-slice + self.assertIn("gitea-plan", rd_skill) + self.assertIn("reconcile-docs", plan_skill) + self.assertIn("reconcile-docs", impl_skill) + def test_skill_inventory_and_skeletons(self): """Proves all 17 active skills meet line count (<= 80), em-dash, and path portability rules.""" for skill_name in EXPECTED_SKILLS: