@martinffx/atelier 3.0.1 → 3.0.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.
@@ -1,157 +1,61 @@
1
1
  # Debugging Techniques
2
2
 
3
- ## Print Debugging
3
+ ## Println Debugging
4
4
 
5
- ### When to Use
6
- - Quick checks in development
7
- - When debugger isn't available
8
- - Understanding flow in unfamiliar code
9
- - Minimal reproducible cases
5
+ Start with temporary, labeled output or the project's structured logger to establish execution
6
+ order and inspect the values relevant to the current hypothesis. Print only the fields needed,
7
+ include a unique session tag, and avoid tight loops. Move to tracing, profiling, or other heavier
8
+ instrumentation only when focused logs cannot establish the evidence.
10
9
 
11
- ### Best Practices
10
+ Do not print credentials, authorization data, session identifiers, personal data, private
11
+ payloads, or environment values. Remove temporary output once the investigation is complete.
12
12
 
13
- **Do:**
14
- - Print at function entry/exit to trace execution
15
- - Print variable values at key decision points
16
- - Use descriptive labels: `console.log('userId:', userId)`
17
- - Print full objects for inspection: `console.log(JSON.stringify(data, null, 2))`
13
+ ## Further Instrumentation
18
14
 
19
- **Don't:**
20
- - Leave print statements in production code
21
- - Print sensitive data (passwords, tokens)
22
- - Over-print (noise obscures signal)
23
- - Print in tight loops (use breakpoints instead)
15
+ Instrument the smallest useful boundary. Record event order, identifiers, state transitions, and
16
+ timing rather than entire payloads. Use a unique session tag for temporary instrumentation and
17
+ remove only the instrumentation introduced for that session.
24
18
 
25
- ### Tagged Debug Logs
19
+ Never record credentials, authorization data, session identifiers, personal data, private
20
+ payloads, or environment values. Treat captures, traces, and dumps as sensitive artifacts.
26
21
 
27
- When instrumenting during a debugging session, tag every temporary log with a
28
- unique prefix so cleanup is trivial:
22
+ ## Bisection
29
23
 
30
- ```javascript
31
- console.log('[DEBUG-a4f2] userId:', userId);
32
- console.log('[DEBUG-a4f2] payload:', payload);
33
- ```
24
+ Narrow the failing path by disabling coherent branches, reducing inputs, or comparing a known-good
25
+ revision with a known-bad revision. Keep the system valid while narrowing; arbitrary code removal
26
+ can change the behavior being investigated.
34
27
 
35
- Cleanup: `grep -r '\[DEBUG-' .` → delete all matches.
28
+ Before revision bisection, preserve unrelated work and record the starting revision. Reset to the
29
+ starting state after the investigation.
36
30
 
37
- Untagged logs survive; tagged logs die.
31
+ ## Non-Deterministic Failures
38
32
 
39
- ---
33
+ Record the conditions of every attempt: input, environment, timing, concurrency, seed, and result.
34
+ Vary one condition at a time. Use delays and load only to perturb scheduling, never as proof of the
35
+ cause. Prefer deterministic scheduling, fault injection, or recorded traces when available.
40
36
 
41
- ## Structured Logging
37
+ ## Performance Investigation
42
38
 
43
- Better than `console.log` for production:
39
+ Establish a representative baseline before changing code. Use measurements, profiling, tracing, or
40
+ query plans that fit the suspected bottleneck. Avoid high-volume logging on the hot path because it
41
+ can alter timing.
44
42
 
45
- ```javascript
46
- const logger = {
47
- debug: (msg, meta) => console.debug(JSON.stringify({ level: 'debug', msg, ...meta })),
48
- info: (msg, meta) => console.info(JSON.stringify({ level: 'info', msg, ...meta })),
49
- warn: (msg, meta) => console.warn(JSON.stringify({ level: 'warn', msg, ...meta })),
50
- error: (msg, meta) => console.error(JSON.stringify({ level: 'error', msg, ...meta })),
51
- };
52
- ```
43
+ Some analysis tools execute the operation they inspect. Confirm whether a command is read-only and
44
+ whether it can create load, acquire locks, or repeat side effects before using it outside an
45
+ isolated environment.
53
46
 
54
- ### Console Methods
47
+ ## Production Safety
55
48
 
56
- | Method | Use |
57
- |--------|-----|
58
- | console.log | General output |
59
- | console.debug | Debug info |
60
- | console.info | Informational |
61
- | console.warn | Warnings |
62
- | console.error | Errors |
63
- | console.table | Arrays/objects in table format |
64
- | console.trace | Stack trace |
65
- | console.time/timeEnd | Timing |
49
+ Default to development, staging, or an isolated replica. Before production instrumentation,
50
+ replay, or load generation, obtain explicit authorization and define scope, rate limits, rollback,
51
+ and a stop condition. Replay only idempotent or dry-run operations unless the user explicitly
52
+ accepts the side effects.
66
53
 
67
- ---
54
+ ## Cleanup
68
55
 
69
- ## Binary Search Debugging
56
+ Before closing the investigation:
70
57
 
71
- ### Code Binary Search
72
-
73
- Comment out half the code to find where the bug is.
74
-
75
- ### Git Bisect
76
-
77
- For regression bugs:
78
-
79
- ```bash
80
- git bisect start
81
- git bisect bad
82
- git bisect good v1.2.3
83
- # Run your test, mark good/bad
84
- git bisect reset
85
- ```
86
-
87
- ---
88
-
89
- ## Rubber Ducking
90
-
91
- ### The Process
92
-
93
- 1. Describe the problem in detail
94
- 2. Explain expected behavior
95
- 3. Explain actual behavior
96
- 4. Walk through the code line by line
97
-
98
- ---
99
-
100
- ## Logging Strategies
101
-
102
- ### What to Log
103
-
104
- | Log This | Don't Log This |
105
- |----------|----------------|
106
- | Request/response with IDs | Full request bodies |
107
- | Key decisions in code | Every loop iteration |
108
- | Error details with context | Stack traces |
109
- | Performance timing | Large data dumps |
110
- | User actions | Sensitive data (PII, passwords) |
111
-
112
- ### Context to Include
113
-
114
- ```javascript
115
- logger.error('Request failed', {
116
- endpoint: '/api/users',
117
- method: 'POST',
118
- statusCode: 500,
119
- userId: user?.id,
120
- requestId: req.headers['x-request-id'],
121
- duration: Date.now() - startTime,
122
- errorMessage: error.message
123
- });
124
- ```
125
-
126
- ### Log Levels
127
-
128
- | Level | When |
129
- |-------|------|
130
- | DEBUG | Detailed debugging info |
131
- | INFO | Normal operation events |
132
- | WARN | Something unexpected, but handled |
133
- | ERROR | Operation failed |
134
-
135
- ---
136
-
137
- ## Performance Regression Techniques
138
-
139
- ### The Perf Branch
140
-
141
- For performance regressions, logs are usually wrong. Instead:
142
-
143
- 1. **Establish a baseline measurement** using one of:
144
- - Timing harness around the suspect code path
145
- - `performance.now()` in browser / `process.hrtime()` in Node
146
- - CPU profiler (Chrome DevTools, `node --prof`, py-spy, etc.)
147
- - Database query planner (`EXPLAIN ANALYZE`)
148
-
149
- 2. **Bisect** — narrow down which commit / change introduced the regression.
150
-
151
- 3. **Measure first, fix second.** Do not optimise without data.
152
-
153
- ### Hot Path Identification
154
-
155
- - Profile before guessing
156
- - Look for O(n²) algorithms, unnecessary renders, blocking operations
157
- - Check for N+1 queries, unbounded caches, recursive without memoisation
58
+ - Remove temporary instrumentation and throwaway harnesses.
59
+ - Preserve only sanitized evidence needed to explain the conclusion.
60
+ - Re-run the original verification signal.
61
+ - Record the confirmed cause, fix, and prevention measure.
@@ -41,13 +41,16 @@ If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The ma
41
41
  │ └── docs/adr/
42
42
  ```
43
43
 
44
- Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
44
+ Read `docs/agents/domain.md` when it exists to locate the configured domain documents. Create files
45
+ lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the
46
+ first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
45
47
 
46
48
  ## During the session
47
49
 
48
50
  ### Challenge against the glossary
49
51
 
50
- When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately:
52
+ When the user uses a term that conflicts with the existing language in the relevant `CONTEXT.md`,
53
+ call it out immediately. Resolve `CONTEXT-MAP.md` first when present:
51
54
 
52
55
  > "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
53
56
 
@@ -15,6 +15,9 @@ Ask the questions one at a time, waiting for feedback on each question before co
15
15
 
16
16
  If a *fact* can be found by exploring the environment (filesystem, tools, etc.), look it up rather than asking me. The *decisions*, though, are mine — put each one to me and wait for my answer.
17
17
 
18
- Do not act on it until I confirm we have reached a shared understanding.
18
+ Do not implement the proposed plan or decision until I confirm we have reached a shared
19
+ understanding. Update domain documentation as terminology and decisions are resolved; when this
20
+ session is nested in spec-brainstorm, return changed assumptions to that workflow for any required
21
+ design update.
19
22
 
20
23
  Run this session using the `oracle-domain-modelling` skill.
@@ -154,7 +154,8 @@ Read the relevant codebase deeply. Not signatures — implementations, edge case
154
154
  handling, data flows. Trace callers and callees. Read tests to understand expected
155
155
  behaviour.
156
156
 
157
- Write findings directly into the spec as the foundation.
157
+ Collect research findings for the spec as the foundation. Do not write `design.md` until the
158
+ approved design sections are assembled in Step 4c.
158
159
 
159
160
  **Tell the human:** "I've written the research section of the spec. Ready for you to
160
161
  review before I continue with the design."
@@ -334,14 +335,13 @@ note them at handoff.
334
335
 
335
336
  **Tell the human:**
336
337
 
337
- > "Spec written to `docs/specs/<path>`. Every section was approved during our
338
- > conversation - review it if you'd like, or we can go straight to the
339
- > Spec-backed Plan. Ready for spec-plan?"
338
+ > "Spec written to `docs/specs/<path>`. Please confirm this assembled document before we move to
339
+ > the Spec-backed Plan."
340
340
 
341
- If the human requests changes — in conversation or by annotating the file —
342
- address every note, update the spec, and re-run the self-review. If a change
343
- alters the substance of an approved section, re-present that section for
344
- approval before continuing.
341
+ If the human requests changes — in conversation or by annotating the file — address every note,
342
+ update the spec, and re-run the self-review. If a change alters the substance of an approved
343
+ section, re-present that section for approval before continuing. Resolve questions that affect
344
+ scope, architecture, contracts, data, security, or task ordering before handoff.
345
345
 
346
346
  The next step is **spec-plan** in Spec-backed mode. Do not start planning without the
347
347
  human's go-ahead. Do not write code.
@@ -10,20 +10,27 @@ user-invocable: true
10
10
 
11
11
  # Spec Finish
12
12
 
13
- Post-implementation workflow: validate → review → stack commits → prepare PR.
13
+ Post-implementation workflow: synchronize docs → validate → review → prepare PR.
14
14
 
15
15
  ## Prerequisites
16
16
 
17
17
  Before starting, verify:
18
18
  1. All Spec-backed Plan tasks are complete
19
- 2. Working directory is clean (committed or staged)
19
+ 2. Working directory has no unresolved staged or unstaged changes
20
20
  3. Tests pass
21
21
 
22
22
  If not complete, go back to `spec-implement`.
23
23
 
24
24
  ---
25
25
 
26
- ## Step 1: Validate
26
+ ## Step 1: Update Documentation
27
+
28
+ Check whether README, API documentation, or changelog updates are needed. Make and commit any
29
+ necessary documentation changes through **code-commit** before final validation.
30
+
31
+ ---
32
+
33
+ ## Step 2: Validate
27
34
 
28
35
  Run validation checks.
29
36
 
@@ -67,12 +74,13 @@ go build ./...
67
74
 
68
75
  ---
69
76
 
70
- ## Step 2: Review
77
+ ## Step 3: Review
71
78
 
72
- Use the Skill tool to invoke code-review skill for comprehensive code review.
79
+ Invoke the installed **code-review** skill through the harness's skill mechanism for one
80
+ comprehensive review of the final change.
73
81
 
74
82
  ### What to Review
75
- - All changed files since feature branch
83
+ - All changed files since the intended base branch's merge base
76
84
  - Test coverage
77
85
  - Documentation updates
78
86
  - No debug code left
@@ -83,37 +91,17 @@ Use the Skill tool to invoke code-review skill for comprehensive code review.
83
91
 
84
92
  ---
85
93
 
86
- ## Step 3: Stack Commits
87
-
88
- ### Workflow
89
- 1. Review current commits: `git log --oneline`
90
- 2. Ensure commits are organized logically
91
- 3. Rebase if needed: `git rebase -i <base-branch>`
92
- 4. Ensure each commit is clean and functional
93
-
94
- ### Commit Guidelines
95
- - Each commit should pass tests
96
- - Use conventional commit format
97
- - Meaningful commit messages
98
-
99
- ---
100
-
101
- ## Step 4: Update Documentation
102
-
103
- ### Check for Updates
104
- - README changes needed?
105
- - API documentation updated?
106
- - Changelog updated?
94
+ ## Step 4: Prepare Commits
107
95
 
108
- ### If documentation needed
109
- - Update relevant docs
110
- - Commit with docs
96
+ Review current commits with `git log --oneline`. Use **code-commit** for any uncommitted work.
97
+ Do not rewrite history by default. If a rebase would materially improve an unpublished stack,
98
+ show the affected range and ask for separate approval before rebasing.
111
99
 
112
100
  ---
113
101
 
114
- ## Step 5: Open the PR
102
+ ## Step 5: Prepare the PR
115
103
 
116
- Steps 1-4 (validate, review, stack commits, update docs) must all be complete
104
+ Steps 1-4 (documentation, validation, review, commits) must all be complete
117
105
  before proceeding. **If code-review found blocking or scope-changing issues, stop and return
118
106
  to spec-implement to fix them. Do not proceed to Step 5b.**
119
107
 
@@ -142,7 +130,7 @@ template, generates the body from commits, and opens the PR via `gh` or `glab`.
142
130
 
143
131
  ### Handoff
144
132
 
145
- > "Implementation complete. [N] commits stacked. Opening PR now."
133
+ > "Implementation complete. [N] commits are ready. PR package ready for approval."
146
134
 
147
135
  ---
148
136
 
@@ -23,7 +23,8 @@ Before starting, verify these exist:
23
23
 
24
24
  1. Approved `docs/specs/YYYY-MM-DD-<feature>/design.md`
25
25
  2. Approved `docs/specs/YYYY-MM-DD-<feature>/plan.json`
26
- 3. Any tracker entries selected during planning are available
26
+ 3. Any tracker entries selected during planning are available, along with
27
+ `docs/agents/issue-tracker.md` when tracking is configured
27
28
  4. You are not on main/master without explicit user consent. Create a branch or use a git
28
29
  worktree first.
29
30
 
@@ -85,34 +86,19 @@ Default to batched if the human hasn't expressed a preference.
85
86
 
86
87
  Follow the approved plan exactly.
87
88
 
88
- For each task, find the next ready task:
89
+ For each task, find the next unblocked task directly from `plan.json`. When tracker entries
90
+ exist, use `docs/agents/issue-tracker.md` to keep their execution state in sync; tracker state
91
+ never overrides the plan's dependency graph.
89
92
 
90
- **With beads (preferred):**
91
- ```bash
92
- bd ready --label <feature> --json
93
- ```
94
-
95
- **With harness todos:** Check the todo list for the next unblocked task, respecting
96
- `depends_on` from plan.json.
97
-
98
- **Without a tracker:** Read the next unblocked task directly from plan.json.
99
-
100
- When a tracker exists, mark it in progress:
101
-
102
- **With beads:**
103
- ```bash
104
- bd update <task-id> --status in_progress
105
- ```
106
-
107
- **With harness todos:**
108
- Update the todo status to in_progress.
93
+ When a tracker exists, mark it in progress according to `docs/agents/issue-tracker.md`.
109
94
 
110
95
  ### For each task
111
96
 
112
97
  Read the task's **inputs** and **description** first.
113
98
 
114
- Write tests that cover the validation criteria before writing implementation.
115
- Invoke an installed language-specific testing skill when needed.
99
+ For behavior-changing code tasks, write tests that cover the validation criteria before writing
100
+ implementation. For documentation, configuration, migration, or verification-only tasks, use the
101
+ task's stated validation instead. Invoke an installed language-specific testing skill when needed.
116
102
 
117
103
  ```
118
104
  1. Read task inputs and description
@@ -122,28 +108,22 @@ Invoke an installed language-specific testing skill when needed.
122
108
  5. Refactor if needed (tests stay green)
123
109
  ```
124
110
 
125
- Do NOT write implementation before tests. Do NOT skip "verify it fails." Do NOT write
126
- more code than needed to pass the test.
111
+ For behavior-changing code, do NOT write implementation before tests. Do NOT skip "verify it
112
+ fails." Do NOT write more code than needed to pass the test.
127
113
 
128
114
  Verify the task against its **validation** and acceptance criteria.
129
115
 
130
- ### After each batch: Review and commit
116
+ ### After each batch: Validate and commit
131
117
 
132
- In Subagent Mode, use **code-subagents** for one combined batch review. In other modes,
133
- invoke **code-review** once for the batch. Resolve blocking findings and revalidate, then the
134
- coordinator commits the reviewed batch serially using **code-commit**.
118
+ Run the task's focused validation and inspect the local diff for accidental or out-of-scope
119
+ changes. Report deviations and unexpected findings. Use **code-commit** for any commit; plan
120
+ approval does not bypass its approval gate. Comprehensive **code-review** happens in
121
+ **spec-finish**.
135
122
 
136
123
  ### On completion
137
124
 
138
- When a tracker exists, mark the task done:
139
-
140
- **With beads:**
141
- ```bash
142
- bd close <task-id> --reason "Implemented with tests"
143
- ```
144
-
145
- **With harness todos:**
146
- Mark the task as completed.
125
+ When a tracker exists, mark the task complete according to
126
+ `docs/agents/issue-tracker.md`.
147
127
 
148
128
  ### Referencing existing code
149
129
 
@@ -231,8 +211,11 @@ If the design was wrong:
231
211
  ## When to Revisit Earlier Steps
232
212
 
233
213
  **Return to spec-plan when:**
234
- - Partner updates the plan based on your feedback
235
- - Tasks can't be completed as specified
214
+ - A material change affects approved behavior, scope, architecture, public contracts, or major dependencies
215
+ - Tasks cannot be completed without one of those material changes
216
+
217
+ Minor deviations may be recorded inline and reflected in plan.json when useful. Report them in the
218
+ next progress update.
236
219
 
237
220
  **Return to spec-brainstorm when:**
238
221
  - The fundamental approach needs rethinking
@@ -248,9 +231,8 @@ When all planned work is done, verify and present it.
248
231
 
249
232
  1. **Run full test suite** — all tests must pass, not just the new ones
250
233
  2. **Run type check / lint** — clean output, no new warnings
251
- 3. **Invoke code-review** — full review of all changes
252
- 4. **Verify completion** — close every tracker entry when tracking is used
253
- 5. **Diff review** — review the full diff against main/master. Look for:
234
+ 3. **Verify completion** — close every tracker entry when tracking is used
235
+ 4. **Diff review** — review the full diff against the intended base branch. Look for:
254
236
  - Files that changed but shouldn't have
255
237
  - Debug code or temporary hacks left behind
256
238
  - Inconsistencies between what was planned and what was built
@@ -274,7 +256,7 @@ Present to the human:
274
256
  - Test suite: ✓ all passing
275
257
  - Type check: ✓ clean
276
258
  - Lint: ✓ clean
277
- - Code review: ✓ complete
259
+ - Comprehensive code review: pending spec-finish
278
260
 
279
261
  ### Ready for review
280
262
  ```
@@ -36,7 +36,7 @@ template with confirmed, file-and-symbol-level details, including cross-file wir
36
36
  ordering constraints where they matter.
37
37
 
38
38
  Do not manufacture phases, task IDs, dependency graphs, acceptance matrices, `design.md`,
39
- `plan.json`, Beads issues, or harness todos. The conversation is the plan artifact.
39
+ `plan.json`, tracker entries, or harness todos. The conversation is the plan artifact.
40
40
 
41
41
  **Tell the human:** "Inline Plan ready for review."
42
42
 
@@ -227,27 +227,21 @@ into plan.json.
227
227
 
228
228
  ### Task Tracking
229
229
 
230
- Create tracker entries when they add execution value. For multi-task or dependency-ordered
231
- work, **prefer beads**:
232
- ```bash
233
- # Create epic and tasks with dependencies
234
- bd create "Feature: {name}" --label {feature} --type epic
235
- bd create "Task: {name}" --label {feature} --type task --epic {epic-id}
236
- bd dep add --type blocks {task-a} {task-b} # task-a blocks task-b
237
- ```
238
-
239
- If tracking is useful and beads is unavailable, use the harness's native todo system.
240
- Do not duplicate a simple plan.json into a tracker merely to satisfy the workflow.
230
+ Read `docs/agents/issue-tracker.md` when it exists. Create tracker entries only when that
231
+ document configures a tracker, mirroring is enabled, and tracking adds execution value. Do not
232
+ choose or configure a tracker here. Do not duplicate a simple plan.json into a tracker merely to
233
+ satisfy the workflow.
241
234
 
242
235
  ### What to do
243
236
 
244
237
  1. Convert the annotated plan draft into structured plan.json
245
238
  2. Each task maps to a unit with inputs, description, files, and validation
246
239
  3. Dependencies between tasks are captured in `depends_on` fields
247
- 4. When execution benefits from task tracking, create tasks using beads or harness todos:
248
- - Create an epic/feature container
249
- - Add tasks per phase with clear descriptions
250
- - Mark dependencies between tasks (beads: `bd dep add`, harness: manual ordering)
240
+ 4. When execution benefits from configured task tracking, create entries according to
241
+ `docs/agents/issue-tracker.md`:
242
+ - Create any configured feature container
243
+ - Add tasks with clear descriptions
244
+ - Mirror dependencies when the configured tracker supports them
251
245
  5. The plan.json is the source of truth for task details; the task tracker
252
246
  tracks execution state
253
247
 
@@ -264,7 +258,7 @@ After creating plan.json, verify:
264
258
 
265
259
  ## Handoff
266
260
 
267
- When plan.json is created, and any useful tracker entries have been created, the next
261
+ When plan.json is created, and any useful configured tracker entries have been created, the next
268
262
  step is **spec-implement** in Spec-backed mode.
269
263
 
270
264
  Tell the human:
@@ -277,8 +271,10 @@ Tell the human:
277
271
 
278
272
  Do not start implementing. That's spec-implement's job.
279
273
 
280
- If implementation reveals missing tasks, update plan.json. If design is wrong,
281
- loop back to research. See **atelier-orchestrator** for iteration patterns.
274
+ Minor implementation deviations may be recorded inline and reflected in plan.json when they do
275
+ not change approved behavior, scope, architecture, public contracts, or major dependencies.
276
+ Material changes return to spec-plan for renewed approval; design changes return to
277
+ spec-brainstorm. See **atelier-orchestrator** for iteration patterns.
282
278
 
283
279
  ---
284
280