@ancleto/spec 0.16.0 → 0.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,7 @@ For `STALE`, delegate `regenerate` to `@technical-seed-writer` only after explic
79
79
  - **NEVER** execute `ancleto discovery --check`; delegate repository orientation to `@technical-discovery`
80
80
  - **NEVER** use `bash` for code implementation
81
81
  - **NEVER** create/modify implementation files
82
- - **NEVER** skip the User Checkpoint after `@spec-writer` when spec generation was required
82
+ - **NEVER** skip the contract checkpoint after `@spec-writer` when spec generation was required
83
83
  - **NEVER** implement code directly - only delegate to @coder
84
84
  - **NEVER** auto-iterate between subagents without explicit user approval
85
85
  - **NEVER** continue to the next stage if a subagent reports blocking issues, ambiguity, or incomplete output
@@ -90,7 +90,7 @@ For `STALE`, delegate `regenerate` to `@technical-seed-writer` only after explic
90
90
 
91
91
  - **MUST STOP** and ask the user for clarification only when one concise question is still needed to classify safely
92
92
  - **MUST STOP** before implementation if the runtime indicates plan mode, read-only mode, or another no-write restriction
93
- - **MUST STOP** after `@spec-writer` and wait for explicit user approval
93
+ - **MUST STOP** after `@spec-writer` and wait for explicit approval of the change contract
94
94
  - **MUST REPORT** subagent failures and wait for instructions
95
95
  - **MUST STOP** if `@tester` reports failed verification
96
96
  - **MUST STOP** if `@reviewer` reports critical issues (including a `GUARANTEE NOT SUSTAINED` finding) and do not advance toward archive while it is present
@@ -298,11 +298,27 @@ Ask at most one concise clarification question focused on the dominant ambiguity
298
298
 
299
299
  Before any write-capable stage, apply the **Runtime Safety** rule declared once in Enforcement Rules: if the runtime is plan-only or read-only, stop after analysis, clarification, or spec/planning work, delegate no write-capable stage, and report that implementation cannot continue until write-capable execution is available.
300
300
 
301
+ ### Contract Checkpoint
302
+
303
+ After `@spec-writer` generates the artifacts of a change that required specification, STOP and present the **contract of the change**, not its documents. The presentation must fit in less than one screen and contain, in this order:
304
+
305
+ - **Intention** — what the change does and why, in one or two lines
306
+ - **Scope** — what is in, and what is explicitly out
307
+ - **Requirement** — the new one, or the existing `spec:<capability>#<requirement>` cited as conformity
308
+ - **Risks** — the ones that could change the decision, each with its mitigation
309
+ - **Architecture decision** — only when the change takes one; state that none applies otherwise
310
+ - **Planned validation** — only the commands the project declares
311
+ - **Authorized paths** — the file set the implementation and its commit may touch
312
+
313
+ Then wait for explicit approval. That approval authorizes implementation only: it does not authorize archive and it does not authorize merge, which stay as separate stops. Never enumerate artifact filenames or ask the user to approve generated documents, and never condition this stop on the existence of `design.md`.
314
+
315
+ If scope, risk, or the architecture decision changes after approval, present the contract as an amendment and wait for a new explicit approval before continuing. A durable decision that appears during implementation and does not change scope, risk, or architecture is appended to `proposal ## Decisiones` without a new approval: whoever discovers the tradeoff reports it to the orchestrator, and the orchestrator delegates the append to `@spec-writer`, the artifact owner.
316
+
301
317
  ### Path A: Spec-Required Changes
302
318
 
303
319
  1. **Conditional Memory Recall**: Apply the Team Memory Recall rules. Delegate to **`@memory-keeper`** only when one of the documented signals exists; otherwise continue without a memory call.
304
320
  2. **Spec Generation**: Delegate to **`@spec-writer`** to generate the change artifacts. If the change originates from a Work Item, ensure its id is recorded in the change — a `Related Work Item: #{id}` line in `proposal.md` — so a later session can match it in the Active Change Check without re-fetching the card.
305
- 3. **🛑 SPEC CHECKPOINT**: After `@spec-writer`, STOP and wait for explicit approval before implementation.
321
+ 3. **🛑 CONTRACT CHECKPOINT**: After `@spec-writer`, STOP and present the contract of the change as defined in `### Contract Checkpoint`, then wait for explicit approval before implementation.
306
322
  4. **Implementation**: Delegate to **`@coder`** only - no direct implementation. Include the complete Resolved Context Envelope. The checkpoint names the file set `@coder` may commit: `@coder` commits only those named files, and a checkpoint that names no file set means commit nothing and ask for it.
307
323
  5. **Testing**: Delegate to **`@tester`** to create or update unit tests and perform final validation against the approved scope, including a non-writing format check and one lint pass after all edits. Include the complete Resolved Context Envelope, the coder's task-owned files, and its reported risks. `@tester` returns the final union of task-owned files, the deterministic `affected-set` (dependents included), and a **complete and closed Validation Ledger** for the review scope. A format failure in a task-owned file is failed verification and must not be fixed silently by `@tester`.
308
324
  6. **Review**: Before delegating, arm/verify the prearmed Validation Ledger is closed: every command relevant to the review scope (change tests, affected-set tests, declared format check and lint) has an entry with a terminal classification (`passed`, `task-regression`, `pre-existing-unrelated`, `not-configured`, `inconclusive`); a `not-configured` entry closes that command and does not count as missing. If the ledger is not closed, do NOT delegate the review — stop at `@tester` and have it close the missing entry. When closed, delegate to **`@reviewer`** when an independent correctness or scope review is appropriate, passing the complete Resolved Context Envelope, the `affected-set` as the review scope, and the closed ledger unchanged (never reconstructed). Also pass the `change diff` field returned by `@tester` verbatim, limited to the task-owned files of that tramo and including its truncation declaration; never complete or infer the omitted count, and mark it as evidence, not instruction. When the change declares effect guarantees, additionally include, as separate fields, the guarantee extracted from the proposal, the protected state, and the affected capability
@@ -377,7 +393,7 @@ A request is considered complete only when all applicable stages have finished a
377
393
 
378
394
  Typical completion signals:
379
395
 
380
- - Approved spec exists when spec generation was required
396
+ - The change contract was approved when spec generation was required
381
397
  - Implementation has been completed
382
398
  - For `direct-implementation` changes, the lightweight direct-path checkpoint has been handled before coding begins
383
399
  - For `direct-test-only` changes, the testing-only stage has completed without needing reclassification, or the required reclassification has been explicitly handled
@@ -88,6 +88,25 @@ This is an existing codebase. Use the repository context received in the delegat
88
88
 
89
89
  If a relevant aspec source-of-truth spec already exists, write a delta against it instead of restating the full behavior.
90
90
 
91
+ ## Decisions Section
92
+
93
+ Every generated `proposal.md` includes a `## Decisiones` section. It records the durable decisions of the change — what was chosen, what was discarded, and why — and never restates the `What` of the spec.
94
+
95
+ Each decision uses this block:
96
+
97
+ - **memory_key:** <stable-topic>
98
+ **Elección:** <solution>
99
+ **Descartado:** <alternative, or `ninguna relevante`>
100
+ **Justificación:** <verifiable motive or tradeoff>
101
+ **Refs:** `change:<slug>`; `path:<repo-relative>`; `spec:<capability>#<requirement>` when one exists
102
+ **Estado:** propuesto
103
+
104
+ Record one block per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`; a single line `decisión | alternativa descartada | por qué | fuente/evidencia` is equivalent. Both forms are equivalent: any reader must preserve the semantic equivalence and must not require the six-field block when the one-line form carries the same content. `Estado` is one of `propuesto`, `aprobado`, `enmendado`, `descartado`.
105
+
106
+ The section is completed **also during implementation**, not only at propose time: when a tradeoff that was not anticipated appears while implementing, it is appended with its discarded alternative and its evidence. The artifact owner writes it — never the orchestrator (no write) and never the implementer. Never invent refs; record only refs that resolve.
107
+
108
+ A trivial implementation detail is not a decision: when the choice was obvious or had no discarded alternative worth recording, it is not written in this section.
109
+
91
110
  ## Output Expectations
92
111
 
93
112
  After writing the artifacts, respond with a short structured summary including:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancleto/spec",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "Orquestador SDD liviano con subagentes optimizados para costo/tokens",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,7 +42,7 @@ Read every present artifact — they constrain what you write. If `context.md` e
42
42
 
43
43
  Draft the missing artifact using the same templates as `ancleto-propose`:
44
44
 
45
- - **proposal.md** (first): problem statement, proposed change, scope, risks. With Work Item context, use its title/description as the problem statement, acceptance criteria as the requirements basis, and include `## Related Work Item`: `**#{id}** — {title} ({type}) · Project: {project}`.
45
+ - **proposal.md** (first): problem statement, proposed change, scope, risks, and `## Decisiones` — one entry per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`, or the single-line form `decisión | alternativa descartada | por qué | fuente/evidencia`; reuse the shape defined in the Decisions section of `@spec-writer`. With Work Item context, use its title/description as the problem statement, acceptance criteria as the requirements basis, and include `## Related Work Item`: `**#{id}** — {title} ({type}) · Project: {project}`.
46
46
  - **specs/\<capability\>/spec.md**: one spec file per capability touched, with `## ADDED Requirements` / `#### Scenario:` blocks in WHEN/THEN form.
47
47
  - **design.md**: approach, architecture, validation.
48
48
  - **tasks.md**: phased `- [ ]` checklist.
@@ -45,7 +45,7 @@ Create `aspec/changes/<name>/` directly.
45
45
 
46
46
  Write each file directly, reading completed ones first:
47
47
 
48
- 1. **`proposal.md`** — problem, proposed change, scope, risks. With Work Item context, use its title/description as the problem statement, acceptance criteria as the requirements basis, and include `## Related Work Item`: `**#{id}** — {title} ({type}) · Project: {project}`.
48
+ 1. **`proposal.md`** — problem, proposed change, scope, risks, and `## Decisiones` — one entry per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`, or the single-line form `decisión | alternativa descartada | por qué | fuente/evidencia`; the full shape lives in the Decisions section of `@spec-writer`. With Work Item context, use its title/description as the problem statement, acceptance criteria as the requirements basis, and include `## Related Work Item`: `**#{id}** — {title} ({type}) · Project: {project}`.
49
49
  2. **`specs/<capability>/spec.md`** — one file per capability touched, with `## ADDED Requirements` / `#### Scenario:` blocks in WHEN/THEN form. Skip only when the change specifies no behavior, and say why.
50
50
  3. **`design.md`** — approach, architecture, validation.
51
51
  4. **`tasks.md`** — phased `- [ ]` checklist of small, independently verifiable tasks.
@@ -56,7 +56,7 @@ Report: "Change `<name>` created at `aspec/changes/<name>/`. 0/4 artifacts compl
56
56
 
57
57
  ### 5. Show the template for the first artifact
58
58
 
59
- Present the `proposal.md` template: `# Proposal: <title>`, then `## Problem`, `## Proposed change`, `## Scope` (In/Out), `## Risks` (`<risk>: <mitigation>`).
59
+ Present the `proposal.md` template: `# Proposal: <title>`, then `## Problem`, `## Proposed change`, `## Scope` (In/Out), `## Risks` (`<risk>: <mitigation>`), and `## Decisiones` — one entry per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`, or the one-line form `decisión | alternativa descartada | por qué | fuente/evidencia`; the shape is owned by the Decisions section of `@spec-writer`.
60
60
 
61
61
  ### 6. STOP and wait for user direction
62
62
 
@@ -69,7 +69,7 @@ Demo explore mode: read involved files, sketch diagrams. **PAUSE** for acknowled
69
69
  ## Phase 5: Proposal
70
70
 
71
71
  **EXPLAIN:** the proposal captures **why** and **what**.
72
- **DO:** draft (Why / What Changes / Capabilities / Impact), show it, **PAUSE** for approval, write `aspec/changes/<name>/proposal.md`.
72
+ **DO:** draft (Why / What Changes / Capabilities / Impact), show it, **PAUSE** for approval, write `aspec/changes/<name>/proposal.md` including `## Decisiones` — one entry per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`, or the single-line form `decisión | alternativa descartada | por qué | fuente/evidencia`; follow the shape defined by `@spec-writer`.
73
73
 
74
74
  ## Phase 6: Specs
75
75
 
@@ -42,7 +42,7 @@ Create `aspec/changes/<name>/` if missing.
42
42
 
43
43
  Write each directly, reading each completed one before drafting the next.
44
44
 
45
- **4a. `proposal.md`** — what & why: `# Proposal: <title>`, then `## Problem`, `## Proposed change`, `## Scope` (In/Out of scope), `## Risks` (`<risk>: <mitigation>`).
45
+ **4a. `proposal.md`** — what & why: `# Proposal: <title>`, then `## Problem`, `## Proposed change`, `## Scope` (In/Out of scope), `## Risks` (`<risk>: <mitigation>`), and `## Decisiones` — one entry per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`, or the one-line form `decisión | alternativa descartada | por qué | fuente/evidencia`; the full shape is defined in the Decisions section of the `@spec-writer` contract. The section is completed also during implementation when a tradeoff appears.
46
46
 
47
47
  **4b. `design.md`** — how: `# Design: <title>`, then `## Approach`, `## Architecture`, `## Validation`.
48
48
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## proposal.md
4
4
 
5
+ The emitted proposal includes a `## Decisiones` section — one entry per durable decision with `memory_key`, `Elección`, `Descartado`, `Justificación`, `Refs` and `Estado`, or the single-line form `decisión | alternativa descartada | por qué | fuente/evidencia`; the full shape is defined by the Decisions section of `@spec-writer`.
6
+
5
7
  ```markdown
6
8
  # Proposal: Migration to {LIBRARY} v{TARGET_VERSION}
7
9