@mrclrchtr/supi-flow 0.6.1

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.
package/README.md ADDED
@@ -0,0 +1,175 @@
1
+ # supi-flow
2
+
3
+ PI extension for spec-driven workflow with TNDM ticket coordination (optional for trivial changes).
4
+
5
+ ## Flow
6
+
7
+ ```mermaid
8
+ flowchart TD
9
+ START(["Start a change"]) --> BRAIN
10
+ BRAIN["/skill:supi-flow-brainstorm
11
+ HARD-GATE: no code yet
12
+ Explore, design, approve
13
+ Classify trivial vs non-trivial"]
14
+ BRAIN --> APPROVED{Design approved?}
15
+ APPROVED -->|"No"| BRAIN
16
+ APPROVED -->|"Yes"| TRIVIAL{Trivial change?}
17
+
18
+ TRIVIAL -->|"Yes (skip ticket)"| LIGHT["Implement directly
19
+ No ticket needed"]
20
+ TRIVIAL -->|"No"| PLAN
21
+
22
+ PLAN["/skill:supi-flow-plan [ID]
23
+ Bite-sized tasks
24
+ Exact file paths
25
+ No placeholders
26
+ TDD: red-green-refactor
27
+ Stores plan via supi_flow_plan"]
28
+ PLAN --> APPROVE2{"Plan approved?"}
29
+ APPROVE2 -->|"No"| PLAN
30
+ APPROVE2 -->|"Yes"| APPLY
31
+
32
+ APPLY["/skill:supi-flow-apply [ID]
33
+ Iron Law: fresh verify each task
34
+ TDD gate: test-first or delete
35
+ Sets flow:applying at start
36
+ Checks off tasks via supi_flow_complete_task"]
37
+ APPLY --> BLOCKED{"Verification
38
+ failed?"}
39
+
40
+ BLOCKED -->|"Yes"| DEBUG["/skill:supi-flow-debug
41
+ 4-phase systematic debugging
42
+ 3-fix → question architecture"]
43
+ DEBUG --> FIXED{Fixed?}
44
+ FIXED -->|"Yes"| APPLY
45
+ FIXED -->|"No"| USER["Talk to user
46
+ before fix #4"]
47
+
48
+ BLOCKED -->|"No"| DONE{"All tasks
49
+ done?"}
50
+ DONE -->|"No"| APPLY
51
+ DONE -->|"Yes"| ARCHIVE
52
+
53
+ ARCHIVE["/skill:supi-flow-archive [ID]
54
+ Fresh verification (gate function)
55
+ Update living documentation
56
+ Slop-scan docs
57
+ Quality gate checklist"]
58
+ ARCHIVE --> SLOP["/skill:supi-flow-slop-detect
59
+ Tier 1-4 vocabulary
60
+ 11 structural patterns
61
+ Score target: < 1.5"]
62
+ SLOP --> QGATE{"Quality gate
63
+ passes?"}
64
+ QGATE -->|"No"| SLOP
65
+ QGATE -->|"Yes"| CLOSE
66
+
67
+ CLOSE["supi_flow_close
68
+ Sets status=done, flow:done
69
+ Auto-commits .tndm/"]
70
+
71
+ classDef phase fill:#e8f5e9,stroke:#4caf50,stroke-width:2
72
+ classDef decision fill:#e3f2fd,stroke:#2196f3
73
+ classDef entry fill:#e8e8e8,stroke:#666
74
+ classDef blocker fill:#ffebee,stroke:#f44336
75
+
76
+ class BRAIN,PLAN,APPLY,ARCHIVE,CLOSE phase
77
+ class APPROVED,APPROVE2,BLOCKED,FIXED,DONE,TRIVIAL decision
78
+ class START entry
79
+ class USER blocker
80
+ class LIGHT entry
81
+ ```
82
+
83
+ Non-trivial flows require a TNDM ticket created by `supi_flow_start`. Trivial changes can be implemented directly without a ticket.
84
+
85
+ ## Skills
86
+
87
+ Six skills ship under `skills/`:
88
+
89
+ | Skill | Trigger | Purpose |
90
+ |---|---|---|
91
+ | `supi-flow-brainstorm` | `/supi-flow-brainstorm` | Explore intent and design, classify trivial vs non-trivial, create ticket if needed |
92
+ | `supi-flow-plan` | `/supi-flow-plan [ID]` | Create bite-sized implementation plan |
93
+ | `supi-flow-apply` | `/supi-flow-apply` | Execute plan task by task |
94
+ | `supi-flow-archive` | `/supi-flow-archive` | Verify, update docs, close out |
95
+ | `supi-flow-debug` | Loaded on demand when blocked | Root-cause debugging protocol |
96
+ | `supi-flow-slop-detect` | Loaded on demand during archive | AI-prose detection in docs |
97
+
98
+ ## Tools
99
+
100
+ Five custom tools registered by the extension:
101
+
102
+ | Tool | Purpose |
103
+ |---|---|
104
+ | `supi_tndm_cli` | Thin wrapper around the `tndm` CLI with action enum (create/update/show/list/awareness) |
105
+ | `supi_flow_start` | Create a ticket with status=todo, tag=flow:brainstorm, and optional design context in `content.md` |
106
+ | `supi_flow_plan` | Store the executable implementation plan in `plan.md` while leaving `content.md` as the approved design summary |
107
+ | `supi_flow_complete_task` | Check off a numbered task (`**Task N**`) in the registered `plan` document |
108
+ | `supi_flow_close` | Mark done, write verification results to `archive.md`, and auto-commit `.tndm/` |
109
+
110
+ Tools should be used instead of calling `tndm` via bash. The agent invokes them with structured parameters.
111
+
112
+ ## Ticket documents
113
+
114
+ `supi-flow` uses TNDM's registered document model with one canonical ticket body and two phase-specific attachments:
115
+
116
+ - `content.md`: approved design summary and durable handoff context
117
+ - `plan.md`: executable checklist used during `/supi-flow-apply`
118
+ - `archive.md`: final verification evidence written during `/supi-flow-archive`
119
+
120
+ Older tickets may still contain a legacy brainstorm sidecar document, but new flow work should not create or depend on it.
121
+
122
+ ## Commands
123
+
124
+ | Command | Description |
125
+ |---|---|
126
+ | `/supi-flow` | List available flow commands |
127
+ | `/supi-flow-status` | Query TNDM for active flow tickets and show the next recommended step |
128
+
129
+ ## Prompt templates
130
+
131
+ | Prompt | Description |
132
+ |---|---|
133
+ | `/supi-coding-retro` | Retrospective on project setup, architecture, tooling, workflows, and conventions |
134
+
135
+ ## Ticket flow phase tracking
136
+
137
+ Flow phases map to TNDM statuses and tags:
138
+
139
+ | Flow phase | Status | Tags |
140
+ |---|---|---|
141
+ | Brainstorm | `todo` | `flow:brainstorm` |
142
+ | Plan written | `todo` | `flow:planned` |
143
+ | Implementing | `in_progress` | `flow:applying` |
144
+ | Done | `done` | `flow:done` |
145
+
146
+ ## Dependencies
147
+
148
+ - **tndm CLI**: required (all ticket operations shell out to `tndm`)
149
+ - **pi**: discovers bundled skills and prompt templates automatically from the package
150
+
151
+ ## Installation
152
+
153
+ The extension is auto-discovered when the plugin directory is in pi's extension search path:
154
+
155
+ ```bash
156
+ # Option 1: symlink
157
+ ln -s "$(pwd)/plugins/supi-flow" ~/.pi/agent/extensions/supi-flow
158
+
159
+ # Option 2: settings.json
160
+ # Add to ~/.pi/agent/settings.json:
161
+ # { "extensions": ["./plugins/supi-flow/src/index.ts"] }
162
+ ```
163
+
164
+ ## Development
165
+
166
+ ```bash
167
+ cd plugins/supi-flow
168
+ pnpm install
169
+
170
+ # Type-check
171
+ pnpm exec tsc --noEmit
172
+
173
+ # Run tests
174
+ pnpm exec vitest run
175
+ ```
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@mrclrchtr/supi-flow",
3
+ "version": "0.6.1",
4
+ "private": false,
5
+ "description": "SuPi flow extension — spec-driven workflow coupled to TNDM ticket coordination",
6
+ "license": "Apache-2.0",
7
+ "pi": {
8
+ "extensions": [
9
+ "./src/index.ts"
10
+ ]
11
+ },
12
+ "main": "src/index.ts",
13
+ "dependencies": {
14
+ "typebox": "^1.1.38"
15
+ },
16
+ "peerDependencies": {
17
+ "@earendil-works/pi-ai": "*",
18
+ "@earendil-works/pi-coding-agent": "*"
19
+ },
20
+ "files": [
21
+ "src/",
22
+ "skills/",
23
+ "prompts/",
24
+ "README.md"
25
+ ],
26
+ "devDependencies": {
27
+ "@earendil-works/pi-ai": "^0.74.0",
28
+ "@earendil-works/pi-coding-agent": "*",
29
+ "@types/node": "^25.6.0",
30
+ "vitest": "^4.1.4"
31
+ }
32
+ }
@@ -0,0 +1,18 @@
1
+ ---
2
+ description: Agent retrospective on project setup, architecture, tooling, and workflows
3
+ ---
4
+
5
+ Agent Retrospective — Project Setup & Tooling
6
+
7
+ While implementing this feature, what aspects of the project setup, architecture, tooling, workflows, or conventions made development harder than necessary?
8
+
9
+ Please specifically identify:
10
+ - sources of friction or unnecessary complexity
11
+ - confusing or inconsistent patterns
12
+ - tooling or processes that slowed implementation
13
+ - over-engineered abstractions
14
+ - repetitive manual work that could be automated
15
+ - missing documentation, scripts, or conventions
16
+ - anything that should be simplified, standardized, or removed
17
+
18
+ Focus on concrete examples and practical improvements that would increase implementation speed, reliability, and developer/agent experience for future work.
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: supi-flow-apply
3
+ description: Execute an approved implementation plan task by task — verify each step fresh, stop when blocked, and ask instead of guessing.
4
+ ---
5
+
6
+ # Execute implementation plan
7
+
8
+ ## The Iron Law
9
+
10
+ ```
11
+ EVERY TASK GETS FRESH VERIFICATION BEFORE MARKING DONE
12
+ ```
13
+
14
+ If you haven't run the verification command for this task, you cannot check it off. Previous runs do not count. "Should pass" is not evidence.
15
+
16
+ ## Step 1: Find the plan
17
+
18
+ - A TNDM-ID was set during plan phase. Read the ticket metadata first:
19
+ `supi_tndm_cli { action: "show", id: "<ID>" }` — find the registered `plan` document path, then read `plan.md` from that path.
20
+ Then mark the ticket as in progress and move the flow tag:
21
+ `supi_tndm_cli { action: "update", id: "<ID>", status: "in_progress", add_tags: "flow:applying", remove_tags: "flow:planned" }`
22
+ - If no plan is available: ask which change to implement.
23
+
24
+ ## Step 2: Review the plan critically
25
+
26
+ Read the whole plan before starting.
27
+
28
+ Raise questions before editing if:
29
+
30
+ - the plan has a gap
31
+ - the instructions are unclear
32
+ - the scope changed
33
+ - a task is missing verification
34
+ - you are unsure whether a task should be test-driven or test-exempt
35
+
36
+ Do not start implementation until those concerns are resolved.
37
+
38
+ ## Step 3: Execute tasks
39
+
40
+ For each unchecked task, in order:
41
+
42
+ 1. Announce which task you are working on.
43
+ 2. Follow the task as written.
44
+ 3. Run the verification for that task and read the result carefully.
45
+ 4. If verification passes: call `supi_flow_complete_task { ticket_id: "<ID>", task_number: <N> }` to check the task off in the ticket.
46
+ 5. If verification fails: stop, diagnose, fix, and re-verify before moving on.
47
+ 6. Record what actually passed.
48
+
49
+ Do not skip failed checks. Do not collapse several tasks into one vague batch.
50
+
51
+ ### TDD by default, not always
52
+
53
+ For tasks that involve writing code, prefer TDD when the code is reasonably testable.
54
+
55
+ ```text
56
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
57
+ ```
58
+
59
+ Default flow:
60
+
61
+ 1. Write the test.
62
+ 2. Run it and confirm it fails for the right reason.
63
+ 3. Write the minimal code to make it pass.
64
+ 4. Re-run the test and confirm it passes.
65
+ 5. Run any broader regression checks the plan calls for.
66
+
67
+ ### Test-exempt work
68
+
69
+ If the task is marked test-exempt in the plan, or the work is clearly not practical to drive with TDD, use manual verification instead.
70
+
71
+ Examples:
72
+
73
+ - docs-only edits
74
+ - config-only edits
75
+ - trivial changes
76
+ - shell or integration work with no reasonable harness
77
+
78
+ For test-exempt work:
79
+
80
+ 1. Run the manual verification step from the plan.
81
+ 2. If the plan omitted one, add the smallest concrete verification you can justify.
82
+ 3. Confirm the actual output matches the claim.
83
+ 4. Note the exemption rationale briefly when you report completion.
84
+
85
+ If you are **uncertain** whether TDD is practical, ask the user instead of guessing.
86
+
87
+ The hard rule is not "TDD in every case." The hard rule is: **no unverified changes**.
88
+
89
+ ## Step 4: When blocked, load systematic debugging
90
+
91
+ If verification fails and you do not understand why, load `/skill:supi-flow-debug` and follow it before attempting random fixes.
92
+
93
+ ## When to stop and ask
94
+
95
+ STOP and ask the user when:
96
+
97
+ - a verification fails repeatedly and you still do not understand the cause
98
+ - you have tried 3 fixes and none worked
99
+ - a dependency is missing
100
+ - the plan has a critical gap
101
+ - an instruction is unclear
102
+ - you are unsure whether a task should use TDD or a test exemption
103
+
104
+ Do not guess. Do not force through blockers.
105
+
106
+ ## Rationalization prevention
107
+
108
+ | Excuse | Reality |
109
+ |--------|---------|
110
+ | "Should pass now" | Run the verification again. Fresh. |
111
+ | "I'm confident" | Confidence is not evidence. |
112
+ | "Just this once" | Verification still applies. |
113
+ | "Previous run passed" | Code changed. Run it again. |
114
+ | "This task is too simple to need TDD" | TDD is preferred for testable code. If it is not practical, verify it manually and say why. |
115
+
116
+ ## When all tasks are done
117
+
118
+ - If a ticket exists: summarize what passed in conversation, but do not mark it done yet — `/supi-flow-archive` handles durable verification evidence in `archive.md` and final closeout.
119
+ - Announce: `Implementation complete. Run /supi-flow-archive TNDM-XXXXXX to verify, update docs, and close out.`
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: supi-flow-archive
3
+ description: Verify implementation against the plan, update living documentation, run slop detection, and close out the change.
4
+ ---
5
+
6
+ # Archive and document
7
+
8
+ Use this after `/supi-flow-apply` when implementation is complete. This is a docs-first closeout step, not a repository-cleanup workflow.
9
+
10
+ ## The Iron Law
11
+
12
+ ```text
13
+ NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
14
+ ```
15
+
16
+ Before claiming the change is done, the docs are accurate, or the ticket can be closed: run the proof fresh, read the result, and check the exit status.
17
+
18
+ ## Step 1: Find the change
19
+
20
+ - A TNDM-ID was set during plan phase. Read the ticket metadata first:
21
+ `supi_tndm_cli { action: "show", id: "<ID>" }` — inspect `content_path` and the registered documents, then read `content.md` for the approved design and `plan.md` for the executed checklist.
22
+ - Archive runs only when a ticket exists. Trivial flows that skipped the ticket close out directly in conversation — do not run archive.
23
+ - If nothing is clear: ask which change to archive.
24
+
25
+ ## Step 2: Verify completion
26
+
27
+ Compare the plan against what was actually done. Fresh checks only.
28
+
29
+ - [ ] Every planned task is complete, or any deviation is explained.
30
+ - [ ] Tests and verification commands were run fresh.
31
+ - [ ] The implemented result still matches the approved intent.
32
+ - [ ] Any claimed manual verification was actually performed.
33
+
34
+ If any check fails, stop and fix that first.
35
+
36
+ ### Verification gate
37
+
38
+ ```text
39
+ 1. Identify the command or evidence that proves the claim.
40
+ 2. Run it fresh.
41
+ 3. Read the full result and exit code.
42
+ 4. Confirm the claim matches the evidence.
43
+ 5. Only then report success.
44
+ ```
45
+
46
+ ## Step 3: Update living documentation
47
+
48
+ Update docs only where the change actually affects them.
49
+
50
+ 1. Review `git diff` to understand the real delta.
51
+ 2. Identify the docs that should change.
52
+ 3. Update them with grounded, specific language.
53
+ 4. Reference actual file paths, commands, settings, or behavior when helpful.
54
+
55
+ ## Step 4: Run slop detection
56
+
57
+ Load `/skill:supi-flow-slop-detect` and scan every edited documentation file.
58
+
59
+ Quality checks:
60
+
61
+ - no tier-1 slop words in edited docs
62
+ - claims are grounded in specifics
63
+ - wording is direct, not formulaic
64
+ - AI-sycophantic filler is removed
65
+ - the slop score is acceptable
66
+
67
+ If the scan fails, fix the docs and re-scan.
68
+
69
+ ## Step 5: Verify doc accuracy
70
+
71
+ Do the docs match the actual code and workflow?
72
+
73
+ - check file paths
74
+ - check command names
75
+ - check settings or behavior descriptions
76
+ - check that new guidance matches the final implementation
77
+
78
+ Do not assume documentation is correct just because it sounds right.
79
+
80
+ ## Step 6: Close out
81
+
82
+ - Call `supi_flow_close { ticket_id: "<ID>", verification_results: "..." }` with the full verification evidence.
83
+ This will set status=done, tags=flow:done, store verification results in archive.md, and auto-commit .tndm/ changes.
84
+ - There is no ticket-less closeout.
85
+
86
+ ## Step 7: Verify commit
87
+
88
+ Check that the `.tndm/` changes were committed. If `supi_flow_close` did not commit (e.g. no changes to commit), commit any remaining doc changes manually:
89
+
90
+ ```sh
91
+ git commit -m "docs: archive TNDM-XXXXXX"
92
+ ```
93
+
94
+ ## Red flags
95
+
96
+ Stop if you catch yourself:
97
+
98
+ - claiming success from an old test run
99
+ - saying "should" or "probably" instead of citing evidence
100
+ - updating docs before confirming the implementation
101
+ - treating this as a repository cleanup workflow instead of a verification-and-docs closeout
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: supi-flow-brainstorm
3
+ description: You MUST use this before any implementation. Clarify intent, shape the design, and get approval before touching code.
4
+ ---
5
+
6
+ # Flow Brainstorm
7
+
8
+ Turn an idea into an approved design through focused collaboration. Default to a lightweight conversation. Add more structure only when the change is larger, riskier, or likely to span sessions.
9
+
10
+ <HARD-GATE>
11
+ Do NOT write code, scaffold anything, or take implementation action until you have presented a design and the user has approved it. This applies even to changes that seem simple.
12
+ </HARD-GATE>
13
+
14
+ ## Core flow
15
+
16
+ 1. **Explore context:** check relevant files, docs, recent commits, and existing tickets.
17
+ 2. **Check scope:** if the request really contains multiple independent changes, decompose it before going deeper.
18
+ 3. **Ask clarifying questions:** one at a time. Focus on purpose, constraints, and success criteria.
19
+ 4. **Propose 2-3 approaches:** include trade-offs and a recommendation.
20
+ 5. **Present the design:** scale detail to complexity and get approval.
21
+ 6. **Classify and decide:** propose whether this change is trivial or non-trivial.
22
+ - **Trivial:** single file, no tests/docs needed, one verification step, or user says "just do it".
23
+ → "This looks trivial — skip ticket and implement directly?"
24
+ If user agrees: implement directly, verify, done. No ticket.
25
+ - **Non-trivial:** multi-file, needs tests or docs, multi-step, or likely multi-session.
26
+ → Call `supi_flow_start` to create a TNDM ticket, then store the approved design in `content.md` via `supi_tndm_cli { action: "update", id: "<ID>", content: "<outcome>" }`.
27
+ 7. **Recommend next step:**
28
+ - If trivial: implement directly by following the approved design.
29
+ - If non-trivial: `/supi-flow-plan <ID>`
30
+
31
+ ## Understanding the idea
32
+
33
+ - Check the current project state first. Follow existing patterns before proposing new ones.
34
+ - Assess scope early. If the user is really asking for several subsystems, say so and help break the work into smaller changes.
35
+ - Ask one question per message. Multiple choice is great when it makes the decision easier.
36
+ - Keep refining until you understand the goal, non-goals, constraints, and what success looks like.
37
+
38
+ ## Visual Companion
39
+
40
+ If upcoming questions would be easier with mockups, diagrams, or visual comparisons, offer a visual companion once:
41
+
42
+ > "Some of what we're working on could be easier to explain if I can show it to you visually. I can put together mockups, diagrams, comparisons, and other visuals as we go. Want to try it?"
43
+
44
+ That offer MUST be its own message. Do not combine it with any other content. If the user declines, continue in text.
45
+
46
+ Even if they accept, use visuals only when seeing the idea would help more than reading it.
47
+
48
+ ## Exploring approaches
49
+
50
+ - Propose 2-3 approaches with trade-offs.
51
+ - Lead with your recommendation and say why.
52
+ - Prefer simple, well-bounded designs over sprawling ones.
53
+
54
+ ## Presenting the design
55
+
56
+ Cover the parts that matter for the change, such as:
57
+
58
+ - approach
59
+ - main components or files
60
+ - data flow or control flow
61
+ - edge cases and error handling
62
+ - testing and verification
63
+ - docs to update, if any
64
+
65
+ Keep each section proportional to the complexity. A small change may only need a few sentences.
66
+
67
+ ## Working in existing codebases
68
+
69
+ - Follow established patterns unless there is a strong reason not to.
70
+ - Include targeted cleanup when it directly helps the work.
71
+ - Do not propose unrelated refactors.
72
+
73
+ ## Persistence and tracking
74
+
75
+ After approval:
76
+
77
+ - **Default to conversation-first.** The design can live in the chat for small, single-session work.
78
+ - **Offer saving to a ticket** when the work is larger, likely multi-session, or would benefit from a durable reference.
79
+ - If a ticket exists, save the design to the ticket's canonical `content.md` via `supi_tndm_cli { action: "update", id: "<ID>", content: "<outcome>" }`.
80
+ - **Retroactive escalation:** if a trivial change grows in scope mid-implementation, stop, create a retroactive ticket via `supi_flow_start`, and store a summary of completed work + new scope.
81
+
82
+ ## Self-review
83
+
84
+ Before handing off:
85
+
86
+ 1. Remove placeholders or vague wording.
87
+ 2. Check for contradictions.
88
+ 3. Make sure the scope still fits a single implementation plan.
89
+ 4. Make ambiguous requirements explicit.
90
+
91
+ Fix issues inline, then continue.
92
+
93
+ ## Handoff
94
+
95
+ Present the outcome in a compact form:
96
+
97
+ ```markdown
98
+ ## Brainstorming Outcome
99
+ **Problem**: ...
100
+ **Recommended approach**: ...
101
+ **Why**: ...
102
+ **Constraints / non-goals**: ...
103
+ **Open questions**: ...
104
+ **Ticket**: TNDM-XXXXXX / none
105
+ ```
106
+
107
+ Then recommend:
108
+ - If non-trivial: `/supi-flow-plan TNDM-XXXXXX`
109
+ - If trivial: proceed with direct implementation
110
+
111
+ ## Key principles
112
+
113
+ - One question at a time
114
+ - Explore alternatives before settling
115
+ - Scale rigor to risk
116
+ - Default to lightweight collaboration
117
+ - Keep the design clear enough to implement without guessing