@haus-tech/haus-workflow 0.11.0 → 0.12.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.
@@ -1,279 +0,0 @@
1
- # Agentic Development Workflow Standard
2
-
3
- > Tech-agnostic methodology for AI-assisted software projects.
4
-
5
- ---
6
-
7
- ## Source-of-truth documents
8
-
9
- | Workflow term | Default path |
10
- | ------------- | --------------------------------------------------------------------- |
11
- | Spec | `docs/SPEC.md` |
12
- | Design | `docs/DESIGN.md` |
13
- | UX flows | `docs/UX.md` |
14
- | Mockups | `docs/design/` (gitignore binaries, commit README.txt) |
15
- | Plans | `docs/plans/<feature-slug>.md` (one per feature, persist after merge) |
16
- | Decision log | `docs/adr/` |
17
- | Failure modes | `docs/runbook.md` |
18
-
19
- When the user says "spec", "design", "ux", "plan", or "mockup": resolve to the rows above.
20
-
21
- ---
22
-
23
- ## How to write rules that stick
24
-
25
- - **Specific beats general.** "Run `npm test` before commit" over "test your changes". "Handlers live in `src/api/`" over "keep files organised".
26
- - **Emphasis raises adherence.** Reserve `NEVER` / `YOU MUST` / `IMPORTANT` for the few rules that matter most. Overuse dilutes them.
27
- - **State the reason.** A rule with its WHY survives edge cases; a bare rule gets rationalised away.
28
-
29
- ---
30
-
31
- ## Feature workflow
32
-
33
- The canonical loop is **explore -> plan -> code -> commit**. Steps below expand it. Steps are ordered — do not skip.
34
-
35
- **Escape hatch:** if you can describe the whole diff in one sentence (typo, copy tweak, one-line fix), skip to step 5. Planning is for changes that touch multiple files, are architecturally uncertain, or live in unfamiliar code. Do not ceremony-tax trivial work.
36
-
37
- **1. Explore. Read inputs.**
38
- Read spec, design, UX, mockups, and the code you will touch. No edits, no plan, no questions before this.
39
-
40
- **2. Align intent.**
41
- State all assumptions. Flag every gap and conflict between inputs. List what is ambiguous.
42
- **Stop. Wait for explicit user OK before writing a plan.**
43
-
44
- **3. Write a plan.**
45
- Break into discrete tasks. Each task requires: acceptance criteria (testable, not aspirational), verification steps (exact commands or manual checks), dependencies on other tasks, reference to source doc.
46
- Save to `docs/plans/<slug>.md`.
47
- **Stop. Wait for explicit user OK before executing.**
48
-
49
- **4. Create an isolated workspace.**
50
- NEVER edit on `main`. Create a feature branch or git worktree.
51
-
52
- ```bash
53
- git worktree add .claude/worktrees/<slug> -b feat/<slug>
54
- # .claude/worktrees/ must be in .gitignore
55
- ```
56
-
57
- **5. Code.**
58
- Work tasks sequentially unless independent (no shared state, no ordering dependency) — then dispatch parallel subagents, each in its own worktree.
59
- All new code ships with tests. **Give every task a verifiable signal** (test, build, lint, screenshot vs mockup) and loop in one pass: implement -> run the check -> read the result -> fix -> repeat until it passes. Without a pass/fail signal, "looks done" is the only signal and you are the verification loop.
60
- **When a bug surfaces: stop, diagnose root cause methodically before writing any fix.** Do not patch symptoms.
61
-
62
- **6. Commit.**
63
- Before merging: conduct a code review (adversarial, fresh context). Present merge / PR / cleanup options to the user.
64
- After merging a major milestone: capture lessons learned and feed them to the standards backlog.
65
-
66
- ---
67
-
68
- ## NEVER rules
69
-
70
- Apply even in unattended mode. Reasons are included — rules without context get overridden.
71
-
72
- - **NEVER commit or push without explicit user OK**, unless inside an approved plan (plan approval = blanket exec authority for that plan's scope only).
73
- - **NEVER use `git push --force`** on a published branch. Destroys history others may have pulled.
74
- - **NEVER use `--no-verify`** on commit or push. Bypasses the quality gates hooks enforce.
75
- - **NEVER rewrite history** on published commits (amend, rebase-with-force). Breaks anyone who pulled.
76
- - **NEVER commit secrets**, credentials, tokens, or API keys. They are permanent in git history.
77
- - **NEVER delete a branch** with unmerged work without explicit OK.
78
- - **NEVER work directly on `main`.** Always a branch or worktree.
79
- - **NEVER encode ambiguity silently.** Ambiguity = stop and ask. Log resolution as ADR.
80
-
81
- ---
82
-
83
- ## Settings: deterministic enforcement
84
-
85
- CLAUDE.md/AGENTS.md rules are advisory. `settings.json` permissions are deterministic. Critical NEVER rules must be enforced in both.
86
-
87
- Add to `.claude/settings.json`:
88
-
89
- ```json
90
- {
91
- "permissions": {
92
- "deny": [
93
- "Bash(git commit --no-verify:*)",
94
- "Bash(git push --force:*)",
95
- "Bash(git push -f:*)",
96
- "Write(.env:*)",
97
- "Write(*.pem:*)",
98
- "Write(*.key:*)"
99
- ]
100
- }
101
- }
102
- ```
103
-
104
- ---
105
-
106
- ## Git
107
-
108
- - **Squash-merge:** `gh pr merge <n> --squash --delete-branch`. Never plain `--merge`.
109
- - **Conventional Commits:** `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `style`, `ci`, `perf`. Scope by domain: `feat(auth):`.
110
-
111
- ---
112
-
113
- ## Testing rules (non-negotiable)
114
-
115
- No task is done until tests pass locally. All new code ships with tests.
116
-
117
- | Layer | Minimum bar |
118
- | ----------------------------- | ---------------------------------------------------------------------------------------- |
119
- | Pure logic / domain functions | TDD. Test first, code second. Cover happy path + edge cases + invariants. |
120
- | UI components | One render-and-interact test per public component. Query by role/label, not class names. |
121
- | Backend / data layer | One integration test per repository function. Hits local emulator/test DB, never prod. |
122
- | Critical user flows | One happy-path E2E per critical journey. |
123
-
124
- **Verification gate:** run the test suite for all touched layers and record passing output in the task's verification block. Untested = unfinished.
125
-
126
- **Highest-stakes logic** (e.g. financial, auth, medical, pedagogical) is TDD-only: write the test from the spec before any implementation. No exceptions.
127
-
128
- See `workflow-config.md` for this project's test commands.
129
-
130
- ---
131
-
132
- ## Pre-commit hooks
133
-
134
- Use [Lefthook](https://github.com/evilmartians/lefthook) (Go binary, no Node dependency, faster than Husky). Write `fail_text` with agent-readable instructions — the agent reads hook output to decide what to fix.
135
-
136
- Gate every commit on (parallel):
137
-
138
- 1. Type check
139
- 2. Lint
140
- 3. Format
141
- 4. Secret scan: `! git diff --cached | grep -iE "(password|secret|token|api_key)\\s*[:=]\\s*['\"]"`
142
-
143
- Gate unit tests on pre-push (slow). Never gate E2E in hooks.
144
-
145
- See `workflow-config.md` for this project's exact hook commands.
146
-
147
- ```yaml
148
- pre-commit:
149
- parallel: true
150
- commands:
151
- lint:
152
- run: npm run lint
153
- fail_text: 'Lint failed. Run `npm run lint -- --fix` to auto-fix, re-stage, then commit.'
154
- typecheck:
155
- run: npm run typecheck
156
- fail_text: 'Type errors found. Fix all type errors before committing.'
157
- ```
158
-
159
- **CI trigger.** Start with local hooks only. Add CI when: a second developer joins, a broken commit reaches main, or before first public release.
160
-
161
- ---
162
-
163
- ## Security defaults
164
-
165
- - **Default deny.** Access-control layers (DB rules, RLS, middleware) start denied, opened explicitly.
166
- - **Security rules are implementation.** Write them in the same task as the feature they protect.
167
- - **Validate at boundaries.** Parse and validate user input, API responses, env vars with a schema library. Trust internal types downstream.
168
- - **OWASP Top 10 check** before any new public route: injection, broken auth, IDOR, SSRF, misconfiguration.
169
- - **Dependency audit** on a regular cadence. Block critical findings before release.
170
-
171
- ---
172
-
173
- ## Architecture Decision Records (ADR)
174
-
175
- Write an ADR when: choosing a library or framework, defining a data or security model, picking a merge or deploy strategy, setting an API contract, or resolving a spec conflict. If you would otherwise make an assumption: write an ADR instead.
176
-
177
- - Location: `docs/adr/`, filename: `NNNN-kebab-case-title.md`
178
- - Write-once. To change: new ADR that "Supersedes ADR-NNNN". Statuses: `Proposed`, `Accepted`, `Deprecated`, `Superseded by ADR-XXXX`.
179
- - Maintain index table in `docs/adr/README.md`.
180
-
181
- ```markdown
182
- # ADR-NNNN: [Title]
183
-
184
- - **Status:** Accepted | **Date:** YYYY-MM-DD
185
-
186
- ## Context
187
-
188
- ## Decision
189
-
190
- ## Consequences
191
-
192
- ## Alternatives considered
193
- ```
194
-
195
- ---
196
-
197
- ## Runbook
198
-
199
- Maintain `docs/runbook.md`. One entry per non-obvious failure resolved.
200
-
201
- ```markdown
202
- ## [Short symptom]
203
-
204
- **Symptom:** [exact error] **Cause:** [root cause] **Fix:** [exact command]
205
- ```
206
-
207
- ---
208
-
209
- ## Where facts live
210
-
211
- Each fact has exactly one home. Never duplicate across layers.
212
-
213
- | Layer | What goes here | Load behaviour |
214
- | --------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------ |
215
- | `AGENTS.md` / `CLAUDE.md` | Stable rules, commands, conventions | Loaded in full, every session. Keep small. |
216
- | Auto memory (`MEMORY.md`) | Learnings the agent discovers (build quirks, debug insights, patterns) | First ~200 lines / 25 KB loaded. Accumulates without manual edits. |
217
- | ADR (`docs/adr/`) | Architectural decisions, library choices, policy | On demand. Permanent, write-once. |
218
- | Runbook (`docs/runbook.md`) | Failure modes + exact fix | On demand. Permanent, append-only. |
219
- | `workflow-config.md` | Project-specific commands, doc paths, tool choices | Loaded with WORKFLOW.md. Project-owned. |
220
-
221
- Rule of thumb: ADR for WHY, runbook for HOW TO FIX, memory for what was LEARNED, `AGENTS.md` for the stable RULES, `workflow-config.md` for the project-specific VALUES.
222
-
223
- ---
224
-
225
- ## Subagent patterns
226
-
227
- | Situation | Pattern |
228
- | ----------------------------------- | ----------------------------------------- |
229
- | Multiple independent investigations | Parallel agents |
230
- | Independent feature modules | Parallel agents, each in its own worktree |
231
- | State-dependent pipeline | Sequential |
232
- | Debugging a specific failure | Single agent with full context |
233
-
234
- Each spawned agent needs a self-contained prompt: file paths, relevant decisions, expected output format. No implicit context from the parent session.
235
-
236
- ---
237
-
238
- ## Context management
239
-
240
- Context is the primary constraint. Performance degrades as the window fills.
241
-
242
- - **Clear between unrelated tasks.** Reset context (`/clear`) when switching to something unrelated. A long session carrying stale context underperforms a fresh one.
243
- - **Delegate investigation to subagents.** Reading 50 files to answer one question pollutes the main window. Send it to a subagent; keep only the conclusion.
244
- - **Correct early.** If the agent drifts, stop and redirect immediately. If you correct the same thing twice, clear and restart with a sharper prompt instead of piling on corrections.
245
- - **Checkpoint before risky changes.** Use rewind/checkpoints so a bad path is one undo away, not a manual revert.
246
-
247
- ---
248
-
249
- ## Stop conditions (unattended mode)
250
-
251
- Stop and ask the user when:
252
-
253
- - Verification fails 3+ times on the same task.
254
- - A spec/design/UX conflict requires a product decision.
255
- - A security hole cannot be closed without new requirements.
256
- - Build or tests are red after rebase.
257
-
258
- ---
259
-
260
- ## Accessibility floor
261
-
262
- - Status never by colour alone: colour + icon + text.
263
- - Touch targets: 44x44 px minimum on touch interfaces.
264
- - Contrast: WCAG AA against background.
265
- - Reduced-motion fallbacks for all state-conveying animations.
266
- - All interactive elements are keyboard-navigable and have accessible labels.
267
-
268
- ---
269
-
270
- ## Multi-tool usage
271
-
272
- `@`-import syntax (e.g. `@AGENTS.md`) works in Claude Code only. Other tools read files directly.
273
-
274
- ```
275
- Claude Code: CLAUDE.md → @AGENTS.md (inline)
276
- Cursor: .cursorrules → copy sections directly (no @-import)
277
- Gemini: GEMINI.md → copy sections directly
278
- All tools: AGENTS.md = canonical source of truth, edit here
279
- ```