@imix-js/taproot 0.3.0 → 0.5.0

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.
Files changed (52) hide show
  1. package/README.md +30 -0
  2. package/dist/adapters/index.d.ts +11 -1
  3. package/dist/adapters/index.js +113 -1
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/cli.js +2 -0
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/commithook.js +39 -2
  8. package/dist/commands/commithook.js.map +1 -1
  9. package/dist/commands/dod.d.ts +1 -0
  10. package/dist/commands/dod.js +24 -2
  11. package/dist/commands/dod.js.map +1 -1
  12. package/dist/commands/init.js +46 -1
  13. package/dist/commands/init.js.map +1 -1
  14. package/dist/commands/truth-sign.d.ts +5 -0
  15. package/dist/commands/truth-sign.js +58 -0
  16. package/dist/commands/truth-sign.js.map +1 -0
  17. package/dist/commands/update.js +22 -5
  18. package/dist/commands/update.js.map +1 -1
  19. package/dist/core/configuration.js +25 -0
  20. package/dist/core/configuration.js.map +1 -1
  21. package/dist/core/dod-runner.d.ts +4 -2
  22. package/dist/core/dod-runner.js +30 -1
  23. package/dist/core/dod-runner.js.map +1 -1
  24. package/dist/core/fs-walker.js +1 -1
  25. package/dist/core/fs-walker.js.map +1 -1
  26. package/dist/core/test-cache.d.ts +39 -0
  27. package/dist/core/test-cache.js +187 -0
  28. package/dist/core/test-cache.js.map +1 -0
  29. package/dist/core/truth-checker.d.ts +45 -0
  30. package/dist/core/truth-checker.js +152 -0
  31. package/dist/core/truth-checker.js.map +1 -0
  32. package/dist/validators/types.d.ts +4 -0
  33. package/docs/agents.md +11 -0
  34. package/docs/cli.md +18 -2
  35. package/docs/configuration.md +45 -1
  36. package/docs/patterns.md +75 -0
  37. package/docs/workflows.md +14 -0
  38. package/package.json +1 -1
  39. package/skills/backlog.md +7 -3
  40. package/skills/behaviour.md +7 -1
  41. package/skills/bug.md +13 -0
  42. package/skills/commit.md +27 -2
  43. package/skills/define-truth.md +96 -0
  44. package/skills/discover-truths.md +129 -0
  45. package/skills/grill-me.md +1 -0
  46. package/skills/guide.md +3 -0
  47. package/skills/implement.md +24 -1
  48. package/skills/intent.md +5 -0
  49. package/skills/refine.md +5 -0
  50. package/skills/review-all.md +30 -2
  51. package/skills/review.md +1 -0
  52. package/skills/status.md +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imix-js/taproot",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "AI-driven specs, enforced at commit time. Code without traceability doesn't merge.",
5
5
  "type": "module",
6
6
  "bin": {
package/skills/backlog.md CHANGED
@@ -33,12 +33,16 @@ Capture ideas, findings, and deferred work mid-session with a single command —
33
33
  ```
34
34
  Non-standard lines (not matching `- [YYYY-MM-DD] <text>`) are silently skipped in the display but preserved in the file.
35
35
 
36
- 3. Offer: `D <n>` discard · `P <n>` promote · `A <n>` analyze · `done` finish
36
+ 3. Offer: `D <n>` discard · `P <n>` promote to /tr-ineed · `A <n>` analyze · `done` finish
37
37
 
38
38
  4. Accept commands one at a time:
39
39
  - **`D <n>`** — remove item n from `.taproot/backlog.md`. Confirm: *"✓ Discarded #n"*. Redisplay the updated numbered list.
40
- - **`P <n>`** — remove item n from `.taproot/backlog.md`. Invoke `/tr-ineed` with the item text. On return, redisplay the updated numbered list.
41
- - **`A <n>`**display the full text of item n and ask: *"[P] Promote · [K] Keep · [D] Discard"*. After the choice, redisplay the updated numbered list.
40
+ - **`P <n>` promote to /tr-ineed** — remove item n from `.taproot/backlog.md`. Invoke `/tr-ineed` with the item text. On return, redisplay the updated numbered list.
41
+ - **`A <n>` analyze** produce a structured analysis of the item:
42
+ - A short description of what the item is or could be (2–4 sentences)
43
+ - A complexity signal: **simple** / **moderate** / **significant**
44
+ - An impact assessment: **minor addition** / **meaningful improvement** / **major capability**
45
+ Then ask: *"[P] Promote to /tr-ineed · [K] Keep · [D] Discard"*. After the choice, redisplay the updated numbered list.
42
46
  - **`done`** — end triage. Items not acted on are kept implicitly.
43
47
 
44
48
  5. After `done`: *"Triage complete — X discarded, Y promoted, Z kept."*
@@ -27,7 +27,13 @@ Define a UseCase (observable system behaviour) under an intent or another behavi
27
27
  > **[B] Continue writing the spec** — the spec is distinct from the pattern
28
28
 
29
29
  - **[A]**: guide the user through applying the pattern. Do not write a new `usecase.md`.
30
- - **[B]** or no match: proceed to step 2.
30
+ - **[B]** or no match: proceed to step 1b.
31
+
32
+ 1b. **Load applicable truths.** If `taproot/global-truths/` exists, collect truth files applicable at behaviour level:
33
+ - Include files with `_intent` or `_behaviour` suffix, in an `intent/` or `behaviour/` sub-folder, or with no scope signal (treat as intent-scoped; note inline: "Applied `global-truths/<file>` as intent-scoped (no explicit scope signal)")
34
+ - Do not include files scoped to `_impl` / `impl/` only
35
+ - Read each applicable file; note defined terms, business rules, and conventions
36
+ - If the draft spec contradicts an applicable truth, surface the conflict before saving: "This spec uses `<term>` in a way that conflicts with `global-truths/<file>`: `<excerpt>`. [A] update spec to align, [B] update the truth, [C] proceed with the conflict noted."
31
37
 
32
38
  2. Read all sibling `usecase.md` files (other behaviours already under the same parent). Identify any overlap with the described behaviour and flag it: "There's an existing behaviour `<slug>` that covers X — should this new behaviour focus on Y specifically?"
33
39
 
package/skills/bug.md CHANGED
@@ -31,6 +31,19 @@ Diagnose a defect through structured root cause analysis (5-Why) and delegate to
31
31
  - **External cause** — dependency, environment, or configuration outside the hierarchy
32
32
  - If categories overlap, use this priority: **Spec gap > Implementation gap > Missing test**
33
33
 
34
+ 4a. **Recurrence check.** Ask: *"Could this class of bug happen again — is there a missing gate or outdated guideline that would prevent it?"*
35
+
36
+ - **No (clearly one-off** — typo, isolated misconfiguration, external incident): note this and continue to step 5.
37
+ - **Yes**: propose prevention across one or more of:
38
+ - A new DoR or DoD condition to add to `.taproot/settings.yaml`
39
+ - An update to `docs/architecture.md`, `docs/security.md`, or `docs/patterns.md`
40
+
41
+ If a satisfactory measure is found: present it — e.g. *"I'll add `check-if-affected-by: <gate>` to `.taproot/settings.yaml`"* or *"I'll add to `docs/security.md`: `<constraint>`"* — and wait for actor confirmation.
42
+ - On **confirm**: apply the change, then continue to step 5.
43
+ - On **reject**: record the recurrence concern in the implicated impl.md `## Notes` and continue to step 5.
44
+
45
+ If no satisfactory measure can be identified: invoke `/tr-grill-me` seeded with *"How do we prevent `<root-cause>` from recurring?"* — incorporate the answer and apply it before continuing to step 5.
46
+
34
47
  5. **Locate the implicated artifact.** Use reverse lookup:
35
48
  - Scan all `impl.md` files in `taproot/` for `## Source Files` entries matching the files involved in the root cause
36
49
  - If a match is found: that impl.md is implicated
package/skills/commit.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Skill: commit
2
2
 
3
+ ## Autonomous mode
4
+
5
+ Before following any steps, check whether autonomous mode is active:
6
+ - `TAPROOT_AUTONOMOUS=1` is set in the environment, **or**
7
+ - `--autonomous` was passed as an argument to this skill invocation, **or**
8
+ - `.taproot/settings.yaml` contains `autonomous: true`
9
+
10
+ If any of these is true, **autonomous mode is active** — apply autonomous notes where they appear. If none is true, show confirmation prompts as normal.
11
+
3
12
  ## Description
4
13
 
5
14
  Execute the full commit procedure: classify the commit type, run the appropriate gate proactively, resolve all conditions before staging, and commit. Handles implementation, declaration, requirement, and plain commits. Invoke this skill whenever you are about to commit, or when the user says "commit", "let's commit", "commit that", or similar.
@@ -20,7 +29,11 @@ Execute the full commit procedure: classify the commit type, run the appropriate
20
29
 
21
30
  To identify impl.md ownership, run `grep -rl "<filename>" taproot/` for each candidate source file.
22
31
 
23
- 3. If nothing is staged yet, announce: "Nothing staged yet. Here's what's changed: [list]. Should I stage these and proceed with the commit?" Wait for confirmation before proceeding.
32
+ 3. If nothing is staged yet, announce: "Nothing staged yet. Here's what's changed: [list]."
33
+
34
+ **Interactive mode:** ask "Should I stage these and proceed with the commit?" and wait for confirmation before proceeding.
35
+
36
+ **Autonomous mode:** stage all relevant files and proceed directly without waiting for confirmation.
24
37
 
25
38
  4. Read `.taproot/settings.yaml` to identify all configured `definitionOfDone` and `definitionOfReady` conditions. If the file does not exist or has no `definitionOfDone`/`definitionOfReady` sections, note: "No user-configured conditions — baseline hook checks only." and proceed to the appropriate sub-flow below.
26
39
 
@@ -77,7 +90,19 @@ Execute the full commit procedure: classify the commit type, run the appropriate
77
90
 
78
91
  4. Fix any violations before staging — the hook enforces these checks and will block the commit if they fail.
79
92
 
80
- 5. Stage the hierarchy files and commit.
93
+ 5. **Truth consistency check** if `taproot/global-truths/` exists:
94
+ a. For each staged hierarchy document, determine its level (intent, behaviour, impl) and collect applicable truth files using scope rules (intent-scoped truths apply to all levels; behaviour-scoped to behaviour+impl; impl-scoped to impl only; unscoped defaults to intent-scoped).
95
+ b. Read each applicable truth file. If a file is unreadable, note it and skip.
96
+ c. Check each staged document for semantic consistency with applicable truths:
97
+ - Are defined terms used consistently with their definitions?
98
+ - Are stated business rules respected in acceptance criteria and main flow?
99
+ - Are project conventions followed?
100
+ d. If a conflict is found, surface it before proceeding:
101
+ > "Truth conflict in `<file>`: `<excerpt>` conflicts with `<truth file>`: `<truth excerpt>`. [A] Fix the spec | [B] Update the truth | [C] Proceed with conflict noted"
102
+ Wait for the developer's choice. Do not proceed to step 6 until resolved.
103
+ e. If no conflicts (or all resolved): run `taproot truth-sign` to record the session marker the hook validates.
104
+
105
+ 6. Stage the hierarchy files and commit.
81
106
 
82
107
  ### Plain commit
83
108
 
@@ -0,0 +1,96 @@
1
+ # Skill: define-truth
2
+
3
+ ## Description
4
+
5
+ Create or update a truth entry in `taproot/global-truths/` — a fact, business rule, glossary term, or convention that applies across the project. Accepts a pre-populated candidate from `/tr-discover-truths` or runs interactively.
6
+
7
+ ## Inputs
8
+
9
+ - `candidate` (optional): Pre-populated context from `/tr-discover-truths` or `/tr-ineed` — includes term/rule, proposed scope, and evidence. If omitted, the skill asks interactively.
10
+
11
+ ## Steps
12
+
13
+ ### Phase 1 — Establish Content
14
+
15
+ 1. If `candidate` was provided, display it:
16
+ ```
17
+ Candidate: `<term or rule>`
18
+ Proposed scope: <intent | behaviour | impl>
19
+ Evidence: <spec paths where this appeared>
20
+ ```
21
+ Ask: "Does this look right, or would you like to adjust the content or scope before I write the file?"
22
+
23
+ If no `candidate`, ask:
24
+ > "What truth do you want to capture? Describe the term, rule, or convention — and any context that would help scope it."
25
+
26
+ Wait for the developer's description before continuing.
27
+
28
+ 2. Confirm the truth content — the actual text to write into the file. Ask if not already clear:
29
+ > "How would you like to phrase this truth? (Free-form markdown — prose, table, bullet list, or heading are all valid.)"
30
+
31
+ ### Phase 2 — Determine Scope
32
+
33
+ 3. If scope is not already confirmed, ask:
34
+ > "What scope should this truth have?
35
+ > - **intent** — applies to intent, behaviour, and implementation levels (broadest)
36
+ > - **behaviour** — applies to behaviour and implementation levels
37
+ > - **impl** — applies to implementation level only (narrowest)"
38
+
39
+ Wait for the developer's choice.
40
+
41
+ ### Phase 3 — Choose Convention
42
+
43
+ 4. Ask which storage convention to use:
44
+ > "Which convention do you prefer?
45
+ > - **[S] Suffix** — `<name>_<scope>.md` in `taproot/global-truths/` (e.g. `glossary_intent.md`)
46
+ > - **[F] Sub-folder** — `<scope>/<name>.md` in `taproot/global-truths/` (e.g. `intent/glossary.md`)
47
+ >
48
+ > Both are valid. Use suffix if you have few truths; sub-folder if you expect many."
49
+
50
+ If the project already has truth files using one convention, note it:
51
+ > "Your project currently uses the <suffix|sub-folder> convention — using it here keeps things consistent."
52
+
53
+ ### Phase 4 — Write the File
54
+
55
+ 5. Determine the file path:
56
+ - **Suffix**: `taproot/global-truths/<name>_<scope>.md`
57
+ - **Sub-folder**: `taproot/global-truths/<scope>/<name>.md`
58
+
59
+ Create `taproot/global-truths/` if it does not exist.
60
+
61
+ 6. If the file already exists, read it and present:
62
+ > "A truth file already exists at `<path>`. Here's the current content: [excerpt]. Do you want to [A] append to it, [B] replace it, or [C] cancel?"
63
+ Wait for the developer's choice.
64
+
65
+ 7. Write the truth file with the confirmed content. Report:
66
+ > "✓ Written: `<path>` (scope: <scope>)"
67
+
68
+ 8. **Scope ambiguity check** — if the file was placed directly in `taproot/global-truths/` with no `_<scope>` suffix and not inside a scoped sub-folder, warn:
69
+ > "`<filename>` has no scope signal — it defaults to intent scope (applies everywhere). Add a `_intent`, `_behaviour`, or `_impl` suffix, or move it to a scoped sub-folder, to make the scope explicit."
70
+
71
+ 9. **Conflicting scope signals check** — if the file has both a suffix and is inside a scoped sub-folder that disagree, warn:
72
+ > "`<path>` has conflicting scope signals — sub-folder (`<folder-scope>`) is more restrictive than suffix (`<suffix-scope>`). The restrictive scope (`<folder-scope>`) applies. Rename or move the file to resolve."
73
+
74
+ > 💡 If this session is getting long, consider running `/compact` or starting a fresh context before the next task.
75
+
76
+ **What's next?**
77
+ [A] `/tr-discover-truths` — scan the hierarchy for more truth candidates
78
+ [B] `/tr-commit` — commit the new truth file
79
+ [C] Define another truth — run `/tr-define-truth` again
80
+
81
+ ## Output
82
+
83
+ - A truth file written to `taproot/global-truths/<name>_<scope>.md` or `taproot/global-truths/<scope>/<name>.md`
84
+ - Any scope ambiguity or conflict warnings surfaced inline
85
+
86
+ ## CLI Dependencies
87
+
88
+ None.
89
+
90
+ ## Notes
91
+
92
+ - Truth content is free-form — no schema is enforced. The developer chooses prose, tables, bullet lists, or headings.
93
+ - Both conventions (suffix and sub-folder) may coexist in the same project. Neither is preferred.
94
+ - Scope resolution precedence: sub-folder takes precedence over suffix when they conflict (most restrictive wins).
95
+ - This skill is the target of `/tr-ineed` routing when a requirement is classified as a project-wide truth.
96
+ - When invoked from `/tr-discover-truths`, the `candidate` argument pre-populates steps 1–3, making the interaction faster.
@@ -0,0 +1,129 @@
1
+ # Skill: discover-truths
2
+
3
+ ## Description
4
+
5
+ Scan the taproot hierarchy for implicit facts — recurring terms, business rules, and conventions — that are not yet captured as global truths. Present candidates to the developer for promotion, backlogging, or dismissal. Invoke standalone or as a final pass within `/tr-review-all`.
6
+
7
+ ## Inputs
8
+
9
+ - None required. Operates on the current `taproot/` directory.
10
+
11
+ ## Autonomous mode
12
+
13
+ Before following any steps, check whether autonomous mode is active:
14
+ - `TAPROOT_AUTONOMOUS=1` is set in the environment, **or**
15
+ - `--autonomous` was passed as an argument to this skill invocation, **or**
16
+ - `.taproot/settings.yaml` contains `autonomous: true`
17
+
18
+ If any of these is true, **autonomous mode is active** — skip interactive prompts and defer all candidates to `.taproot/backlog.md` as "truth candidate: `<term>`" entries, then report the summary.
19
+
20
+ ## Steps
21
+
22
+ ### Phase 1 — Pre-flight
23
+
24
+ 1. Verify `taproot/global-truths/` exists. If not, stop:
25
+ > "taproot/global-truths/ does not exist. Run `taproot init` or create it manually."
26
+
27
+ 2. Collect all `intent.md` and `usecase.md` files under `taproot/`, excluding `taproot/global-truths/` and any unreadable files (warn per skipped path). If the count of readable files is fewer than 3, stop:
28
+ > "Too few specs to surface patterns reliably (found N). Run discovery again after adding more specs."
29
+
30
+ ### Phase 2 — Load Existing Truths and Dismissed Entries
31
+
32
+ 3. Read all files in `taproot/global-truths/` (excluding `intent.md` and subdirectory `usecase.md` files — truth files are files that are NOT named `intent.md` or `usecase.md`). Collect defined terms and rules from them.
33
+
34
+ 4. Read `.taproot/backlog.md` if it exists. Extract all lines matching `reviewed — not a truth: <term>` — these are permanently dismissed candidates. Build a suppression list from them.
35
+
36
+ ### Phase 3 — Identify Candidates
37
+
38
+ 5. Read all collected hierarchy files and scan for three candidate categories:
39
+
40
+ **Recurring terms** — domain-specific nouns (not generic words like "user", "system", "file") that appear in 2 or more specs but have no canonical definition in `taproot/global-truths/`.
41
+
42
+ **Business rules** — constraints or invariants stated in acceptance criteria or main flows (phrases like "must", "must not", "always", "never", "only if", "requires") that appear across 2 or more specs.
43
+
44
+ **Implicit conventions** — patterns using "always", "never", "must not", "we use", "we don't" that recur across specs without being formally declared.
45
+
46
+ For each candidate, determine proposed scope using these heuristics:
47
+ - Appears in any `intent.md` → scope: `intent`
48
+ - Appears only in `usecase.md` files → scope: `behaviour`
49
+ - Appears only in implementation-adjacent contexts → scope: `impl`
50
+ - Mixed → default to `intent`
51
+
52
+ 6. Filter out:
53
+ - Candidates already defined in `taproot/global-truths/`
54
+ - Candidates matching any entry in the suppression list from step 4
55
+
56
+ If no candidates remain after filtering, report:
57
+ > "No new truth candidates found — the hierarchy appears consistent with existing global truths."
58
+ Then go to Phase 5.
59
+
60
+ ### Phase 4 — Present Candidates
61
+
62
+ 7. Group remaining candidates by category. If more than 10 total, present in batches of 5. After each batch, ask: "[C] Continue to next batch [D] Done — stop here".
63
+
64
+ For each candidate, present:
65
+ ```
66
+ Candidate: `<term or rule>`
67
+ Category: <recurring term | business rule | implicit convention>
68
+ Proposed scope: <intent | behaviour | impl>
69
+ Heuristic: <why this scope was proposed>
70
+ Evidence:
71
+ - `<spec path>`: "<excerpt showing the term/rule>"
72
+ - `<spec path>`: "<excerpt showing the term/rule>"
73
+
74
+ [P] Promote → /tr-ineed [S] Skip [B] Backlog [D] Dismiss
75
+ ```
76
+
77
+ **Autonomous mode:** defer all candidates to backlog as "truth candidate: `<term>`" and skip to Phase 5.
78
+
79
+ 8. Handle each developer choice:
80
+
81
+ **Promote [P]:**
82
+ - Invoke `/tr-ineed` with the candidate term, proposed scope, and evidence pre-populated as context
83
+ - If `/tr-ineed` routes to a location other than `define-truth`, surface the routing decision:
84
+ > "This candidate was routed to `<location>`. [A] Accept routing [B] Override — invoke define-truth directly"
85
+ - If the developer abandons `/tr-ineed` mid-flow: treat the candidate as skipped for this session (no truth file created; candidate reappears on next run)
86
+ - After `/tr-ineed` completes (or is abandoned), return to the candidate list
87
+
88
+ **Skip [S]:**
89
+ - No record written; candidate reappears on next discovery run
90
+
91
+ **Backlog [B]:**
92
+ - Append to `.taproot/backlog.md`: `- [YYYY-MM-DD] truth candidate: <term>`
93
+ - Move to next candidate
94
+
95
+ **Dismiss [D]:**
96
+ - Append to `.taproot/backlog.md`: `- [YYYY-MM-DD] reviewed — not a truth: <term>`
97
+ - This entry suppresses the candidate on all future discovery runs
98
+ - Move to next candidate
99
+
100
+ ### Phase 5 — Wrap Up
101
+
102
+ 9. Report:
103
+ > "Discovery complete — N promoted, N skipped, N backlogged, N dismissed[, N remaining]."
104
+ > (Include "N remaining" only if the developer ended the session early.)
105
+
106
+ > 💡 If this session is getting long, consider running `/compact` or starting a fresh context before the next task.
107
+
108
+ **What's next?**
109
+ [A] `/tr-ineed <candidate>` — promote a kept candidate now
110
+ [B] `/tr-status` — see current project health
111
+ [C] `/tr-review-all` — run a full review (includes another truth discovery pass)
112
+
113
+ ## Output
114
+
115
+ - Zero or more truth files created in `taproot/global-truths/` (via `/tr-ineed` → define-truth)
116
+ - `.taproot/backlog.md` updated with any backlogged or dismissed candidates
117
+ - Summary report: N promoted, N skipped, N backlogged, N dismissed
118
+
119
+ ## CLI Dependencies
120
+
121
+ None.
122
+
123
+ ## Notes
124
+
125
+ - Truth files in `taproot/global-truths/` are any files that are NOT named `intent.md` or `usecase.md`. They may have any name (e.g. `glossary.md`, `pricing-rules.md`, `entity-model.md`).
126
+ - "Recurring" means 2 or more specs — not just repeated within a single spec.
127
+ - Skip generic language-level words ("the", "a", "is", "not") and taproot structural terms ("intent", "behaviour", "usecase", "implementation") — these are not domain truths.
128
+ - Dismissed entries in `.taproot/backlog.md` are matched by the literal string "reviewed — not a truth: `<term>`" — the suppression logic is substring-match on the candidate term.
129
+ - This skill is read-only on the hierarchy — it never modifies `intent.md` or `usecase.md` files directly.
@@ -46,6 +46,7 @@ Based on Matt Pocock's `grill-me` skill (MIT licensed, https://github.com/mattpo
46
46
  **What's next?**
47
47
  [A] `/tr-ineed "<clarified requirement>"` — route the sharpened requirement into the hierarchy
48
48
  [B] `/tr-behaviour <path>/` — write the spec now that the design is clear
49
+ [C] `/tr-backlog <deferred question>` — capture an unresolved question for later without routing it now
49
50
 
50
51
  ## Output
51
52
 
package/skills/guide.md CHANGED
@@ -56,6 +56,8 @@ ineed → intent → behaviour → implement → trace → status
56
56
  | `/tr-status` | Generate a health dashboard for the hierarchy |
57
57
  | `/tr-review` | Stress-test a spec with adversarial questions |
58
58
  | `/tr-review-all` | Run review across an entire subtree |
59
+ | `/tr-discover-truths` | Scan the hierarchy for implicit facts and promote them to global truths |
60
+ | `/tr-define-truth` | Create or update a truth entry in `taproot/global-truths/` |
59
61
  | `/tr-browse` | Read a hierarchy document section by section in the terminal — with inline editing via `[M] Modify` |
60
62
  | `/tr-backlog` | Capture an idea or finding instantly mid-session; called with no args opens triage to discard, keep, or promote items |
61
63
  | `/tr-grill-me` | Interview the user relentlessly to sharpen a plan or design |
@@ -105,6 +107,7 @@ ineed → intent → behaviour → implement → trace → status
105
107
  **What's next?**
106
108
  [A] `/tr-ineed` — capture your first (or next) requirement
107
109
  [B] `/tr-status` — see the current project health at a glance
110
+ [C] `/tr-backlog` — triage captured ideas (only if `.taproot/backlog.md` is non-empty)
108
111
 
109
112
  ## Output
110
113
 
@@ -9,6 +9,15 @@ Implement a behaviour spec: write the code, write the tests, create the `impl.md
9
9
  - `path` (required): Path to the behaviour folder containing `usecase.md` to implement.
10
10
  - `name` (optional): Slug for the implementation folder (e.g., `rest-api`, `background-job`). If omitted, derive from the implementation approach chosen.
11
11
 
12
+ ## Autonomous mode
13
+
14
+ Before following any steps, check whether autonomous mode is active:
15
+ - `TAPROOT_AUTONOMOUS=1` is set in the environment, **or**
16
+ - `--autonomous` was passed as an argument to this skill invocation, **or**
17
+ - `.taproot/settings.yaml` contains `autonomous: true`
18
+
19
+ If any of these is true, **autonomous mode is active** — apply the autonomous notes at each step where they appear. If none is true, autonomous mode is **inactive** — show confirmation prompts as normal.
20
+
12
21
  ## Steps
13
22
 
14
23
  1. Read `<path>/usecase.md` thoroughly. Understand:
@@ -22,6 +31,11 @@ Implement a behaviour spec: write the code, write the tests, create the `impl.md
22
31
 
23
32
  3. Walk up the hierarchy: read the parent `intent.md` to understand the broader goal. This context should inform design decisions (e.g., if the intent has a constraint about performance, that should influence implementation choices).
24
33
 
34
+ 3a. **Load applicable truths.** If `taproot/global-truths/` exists, collect truth files applicable at impl level:
35
+ - Include files with `_intent`, `_behaviour`, or `_impl` suffix, in an `intent/`, `behaviour/`, or `impl/` sub-folder, or with no scope signal (treat as intent-scoped; note inline: "Applied `global-truths/<file>` as intent-scoped (no explicit scope signal)")
36
+ - Read each applicable file; apply defined terms and conventions when choosing the implementation approach, naming, and design decisions
37
+ - If the implementation plan contradicts an applicable truth, surface the conflict before proceeding: "This implementation contradicts `global-truths/<file>`: `<excerpt>`. [A] update plan to align, [B] update the truth, [C] proceed with the conflict noted."
38
+
25
39
  4. **Pattern check + plan mode.** Before proposing the plan: if `.taproot/docs/patterns.md` exists, scan the behaviour description and any design notes for semantic matches. Match signals:
26
40
  - "applies to all implementations / cross-cutting concern" → `check-if-affected-by`
27
41
  - "enforce a rule on all future work" → `check-if-affected-by`
@@ -38,7 +52,9 @@ Implement a behaviour spec: write the code, write the tests, create the `impl.md
38
52
  - Any design decisions that need to be made (with options and recommendation)
39
53
  - The implementation folder slug and path
40
54
 
41
- Present the plan. Do not proceed to writing code until the user approves.
55
+ **Autonomous mode:** form the plan internally, record it in the `impl.md` Design Decisions section, and proceed directly to step 5 without pausing for approval.
56
+
57
+ **Interactive mode:** present the plan. Do not proceed to writing code until the user approves.
42
58
 
43
59
  5. Create the implementation folder `<path>/<impl-slug>/` and write `impl.md`:
44
60
  - **Behaviour**: relative path to `../usecase.md`
@@ -99,8 +115,15 @@ Implement a behaviour spec: write the code, write the tests, create the `impl.md
99
115
  b. Write the tests — each test should be traceable to a specific UseCase step, postcondition, error condition, or alternate flow trigger. Name tests descriptively.
100
116
  c. Verify the tests pass
101
117
 
118
+ **Autonomous mode — if tests fail:** record the full test output in `impl.md` under a `## Notes` entry headed `Autonomous execution — test failure`, set `**State:** needs-rework`, and stop. Do not attempt to fix tests autonomously without context from the developer.
119
+
102
120
  8. Run `taproot dod <impl-path>` to evaluate the Definition of Done. For agent-driven conditions (`check-if-affected`, `document-current`): reason about each, apply any needed changes, then record your resolution with `taproot dod <impl-path> --resolve "<condition>" --note "<reasoning>"`. Re-run until all conditions pass. `taproot dod` marks `impl.md` state `complete` when all pass.
103
121
 
122
+ **Autonomous mode — DoD self-resolution:**
123
+ - For every `check-if-affected-by`, `check-if-affected`, `check:`, and `document-current` condition: reason through it by reading the spec and source, then record the resolution with `--resolve` and `--note` without prompting.
124
+ - For any `check:` condition where the answer cannot be determined from the code and spec alone: write a `<!-- autonomous: pending-review -->` comment in `## DoD Resolutions` alongside the unresolved condition entry, with the question text. Continue evaluating remaining conditions. After all conditions are processed, if any remain marked pending-review, set `**State:** in-progress` and commit — the developer will complete them on return.
125
+ - For `run:` conditions that exit non-zero: record the output in `impl.md`, mark `needs-rework`, and stop.
126
+
104
127
  9. **Implementation commit** — commit source files and `impl.md` together:
105
128
 
106
129
  Before staging:
package/skills/intent.md CHANGED
@@ -20,6 +20,11 @@ Create a new business intent or refine an existing one. An intent captures the "
20
20
 
21
21
  2. Search existing intents under `taproot/` for overlap. Read each `intent.md` found. If a closely related intent exists, show it to the user and ask: "This looks related to existing intent at `<path>`. Should I refine that one, or create a separate intent for a genuinely different goal?"
22
22
 
23
+ 2a. **Load applicable truths.** If `taproot/global-truths/` exists, collect truth files applicable at intent level:
24
+ - Include files with `_intent` suffix, in an `intent/` sub-folder, or with no scope signal (treat as intent-scoped; note inline: "Applied `global-truths/<file>` as intent-scoped (no explicit scope signal)")
25
+ - Read each applicable file; note any defined terms, business rules, or conventions
26
+ - If the draft contradicts an applicable truth, surface the conflict before writing: "This draft uses `<term>` in a way that conflicts with `global-truths/<file>`: `<excerpt>`. [A] update spec to align, [B] update the truth, [C] proceed with the conflict noted."
27
+
23
28
  3. Draft the `intent.md` content:
24
29
  - Title: noun phrase capturing the desired outcome (e.g., "Password Reset Without Support", not "Password Reset Feature")
25
30
  - Stakeholders: at minimum the direct user/actor and the business/product owner; consider: ops, security, compliance, support, third-party integrators
package/skills/refine.md CHANGED
@@ -35,6 +35,11 @@ Update a behaviour spec (`usecase.md`) based on what was learned during or after
35
35
  - **Actor change**: the actor is different from what was specified, or multiple actors are involved
36
36
  - **State machine issue**: the preconditions or postconditions interact with other behaviours in ways not reflected
37
37
 
38
+ 2a. **Load applicable truths.** If `taproot/global-truths/` exists, collect truth files applicable at behaviour level:
39
+ - Include files with `_intent` or `_behaviour` suffix, in an `intent/` or `behaviour/` sub-folder, or with no scope signal (treat as intent-scoped; note inline: "Applied `global-truths/<file>` as intent-scoped (no explicit scope signal)")
40
+ - Read each applicable file; ensure the refined spec aligns with applicable truths
41
+ - If a proposed refinement contradicts an applicable truth, surface the conflict before writing: "This refinement uses `<term>` in a way that conflicts with `global-truths/<file>`: `<excerpt>`. [A] update spec to align, [B] update the truth, [C] proceed with the conflict noted."
42
+
38
43
  3. Draft the changes to `usecase.md`. Show the diff to the user: "Here's what I'm changing: [before/after for each section]." Ask for confirmation before writing.
39
44
 
40
45
  4. Update the `usecase.md`:
@@ -66,14 +66,42 @@ Run a comprehensive review of an entire subtree — an intent and all its descen
66
66
 
67
67
  7. Close with a prioritized action list: "Recommended next steps: (1) resolve structural issues, (2) address blockers in [artifact], (3) fill coverage gaps for [criterion]."
68
68
 
69
- 8. Present next steps:
69
+ 8. **Truth discovery pass** — if `taproot/global-truths/` exists and the hierarchy has 3 or more readable `intent.md`/`usecase.md` files (excluding `global-truths/`):
70
+
71
+ Run the same scan as `/tr-discover-truths` (Phase 2–3 of that skill): collect candidates not already defined in `global-truths/` and not suppressed by `.taproot/backlog.md` dismissed entries.
72
+
73
+ If candidates are found, append to the report:
74
+
75
+ ```
76
+ ## Truth Candidates
77
+
78
+ The following implicit facts were detected in the hierarchy but are not yet captured as global truths:
79
+
80
+ - `<term>` (scope: <intent|behaviour|impl>) — found in: <spec-path>, <spec-path>
81
+ ...
82
+ ```
83
+
84
+ Then offer:
85
+ > "[P] Process candidates now via `/tr-discover-truths` [D] Defer — append all to backlog"
86
+
87
+ **If [P]:** invoke `/tr-discover-truths` inline; return here when it completes.
88
+
89
+ **If [D]:** append each candidate to `.taproot/backlog.md` as `- [YYYY-MM-DD] truth candidate: <term>`.
90
+
91
+ If no candidates found (hierarchy consistent with existing truths), append to report:
92
+ ```
93
+ ## Truth Candidates
94
+ No new candidates — hierarchy is consistent with existing global truths.
95
+ ```
96
+
97
+ 9. Present next steps:
70
98
 
71
99
  > 💡 If this session is getting long, consider running `/compact` or starting a fresh context before the next task.
72
100
 
73
101
  **What's next?**
74
102
  [A] `/tr-refine <highest-priority-path>` — fix the top-priority finding
75
103
  [B] `/tr-plan` — surface the next implementable behaviour
76
- [C] `/tr-ineed`add a requirement surfaced by the review
104
+ [C] `/tr-backlog <finding>` capture a deferred finding before routing it to the hierarchy
77
105
 
78
106
  ## Output
79
107
 
package/skills/review.md CHANGED
@@ -60,6 +60,7 @@ Stress-test a single Taproot artifact — an `intent.md`, `usecase.md`, or `impl
60
60
  **What's next?**
61
61
  [A] `/tr-refine <path>` — apply the findings to the spec
62
62
  [B] `/tr-implement <path>/` — spec is clean; proceed to implementation
63
+ [C] `/tr-backlog <finding>` — capture an out-of-scope issue for later without routing it now
63
64
 
64
65
  ## Output
65
66
 
package/skills/status.md CHANGED
@@ -78,12 +78,13 @@ Generated: <date>
78
78
  [B] `/tr-refine taproot/<intent>/<behaviour>/` — add missing tests
79
79
  [C] `/tr-plan` — pick a different next item
80
80
 
81
- - **If no specific items were found** (healthy project): show the generic fallback menu:
81
+ - **If no specific items were found** (healthy project): check whether `.taproot/backlog.md` exists and contains items. Show the generic fallback menu:
82
82
 
83
83
  **What's next?**
84
84
  [A] `/tr-plan` — pick the next behaviour to implement
85
- [B] `/tr-ineed` — capture a new requirement
85
+ [B] `/tr-ineed` — route a new requirement into the hierarchy
86
86
  [C] `/tr-review-all` — deeper semantic review of specs
87
+ [D] `/tr-backlog` — triage captured ideas (only if `.taproot/backlog.md` is non-empty)
87
88
 
88
89
  ## Output
89
90