@bastani/atomic 0.8.20-0 → 0.8.21-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 (127) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/CHANGELOG.md +5 -0
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/CHANGELOG.md +5 -0
  6. package/dist/builtin/subagents/agents/code-simplifier.md +78 -22
  7. package/dist/builtin/subagents/agents/debugger.md +4 -3
  8. package/dist/builtin/subagents/package.json +1 -1
  9. package/dist/builtin/web-access/CHANGELOG.md +5 -0
  10. package/dist/builtin/web-access/package.json +1 -1
  11. package/dist/builtin/workflows/CHANGELOG.md +25 -0
  12. package/dist/builtin/workflows/package.json +1 -1
  13. package/dist/builtin/workflows/skills/create-spec/SKILL.md +169 -125
  14. package/dist/builtin/workflows/skills/impeccable/SKILL.md +89 -80
  15. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +92 -0
  16. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +95 -0
  17. package/dist/builtin/workflows/skills/impeccable/agents/openai.yaml +4 -0
  18. package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +122 -1
  19. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +38 -12
  20. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +5 -5
  21. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +7 -7
  22. package/dist/builtin/workflows/skills/impeccable/reference/brand.md +4 -14
  23. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +115 -1
  24. package/dist/builtin/workflows/skills/impeccable/reference/codex.md +3 -3
  25. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +109 -6
  26. package/dist/builtin/workflows/skills/impeccable/reference/craft.md +7 -7
  27. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +623 -94
  28. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +2 -2
  29. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  30. package/dist/builtin/workflows/skills/impeccable/reference/document.md +16 -14
  31. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  32. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -1
  33. package/dist/builtin/workflows/skills/impeccable/reference/init.md +172 -0
  34. package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -6
  35. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +33 -13
  36. package/dist/builtin/workflows/skills/impeccable/reference/live.md +96 -19
  37. package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +1 -1
  38. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +1 -1
  39. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  40. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +3 -4
  41. package/dist/builtin/workflows/skills/impeccable/reference/product.md +1 -3
  42. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +2 -2
  43. package/dist/builtin/workflows/skills/impeccable/reference/shape.md +5 -5
  44. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +158 -3
  45. package/dist/builtin/workflows/skills/impeccable/scripts/cleanup-deprecated.mjs +1 -1
  46. package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +2 -2
  47. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +225 -0
  48. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +266 -0
  49. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +17 -1
  50. package/dist/builtin/workflows/skills/impeccable/scripts/design-parser.mjs +16 -1
  51. package/dist/builtin/workflows/skills/impeccable/scripts/detect.mjs +21 -0
  52. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +1725 -0
  53. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +244 -0
  54. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +4543 -0
  55. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
  56. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
  57. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +535 -0
  58. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +986 -0
  59. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
  60. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
  61. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +12 -0
  62. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
  63. package/dist/builtin/workflows/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
  64. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
  65. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2316 -0
  66. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
  67. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
  68. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
  69. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable-paths.mjs +17 -1
  70. package/dist/builtin/workflows/skills/impeccable/scripts/is-generated.mjs +2 -2
  71. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +139 -96
  72. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +4491 -526
  73. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
  74. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
  75. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
  76. package/dist/builtin/workflows/skills/impeccable/scripts/live-event-validation.mjs +136 -0
  77. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +22 -9
  78. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert-ui.mjs +458 -0
  79. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +232 -0
  80. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
  81. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edits-buffer.mjs +152 -0
  82. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +288 -110
  83. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +47 -1
  84. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +1443 -100
  85. package/dist/builtin/workflows/skills/impeccable/scripts/live-session-store.mjs +17 -0
  86. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +17 -3
  87. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +216 -6
  88. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +2 -3
  89. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +633 -0
  90. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +1 -1
  91. package/dist/builtin/workflows/src/extension/index.ts +67 -3
  92. package/dist/builtin/workflows/src/extension/render-result.ts +26 -1
  93. package/dist/builtin/workflows/src/runs/foreground/executor.ts +227 -3
  94. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +94 -7
  95. package/dist/builtin/workflows/src/shared/stage-prompt.ts +326 -0
  96. package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +62 -7
  97. package/dist/builtin/workflows/src/shared/store-types.ts +43 -0
  98. package/dist/builtin/workflows/src/shared/store.ts +37 -0
  99. package/dist/builtin/workflows/src/tui/chat-surface-message.ts +22 -4
  100. package/dist/builtin/workflows/src/tui/graph-view.ts +47 -0
  101. package/dist/builtin/workflows/src/tui/overlay-adapter.ts +43 -1
  102. package/dist/builtin/workflows/src/tui/run-detail.ts +10 -4
  103. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +117 -15
  104. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +9 -0
  105. package/dist/core/skills.d.ts.map +1 -1
  106. package/dist/core/skills.js +2 -5
  107. package/dist/core/skills.js.map +1 -1
  108. package/dist/core/system-prompt.d.ts.map +1 -1
  109. package/dist/core/system-prompt.js +11 -29
  110. package/dist/core/system-prompt.js.map +1 -1
  111. package/dist/index.d.ts +1 -0
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +3 -0
  114. package/dist/index.js.map +1 -1
  115. package/docs/quickstart.md +1 -2
  116. package/package.json +4 -4
  117. package/dist/builtin/workflows/skills/impeccable/reference/cognitive-load.md +0 -106
  118. package/dist/builtin/workflows/skills/impeccable/reference/color-and-contrast.md +0 -105
  119. package/dist/builtin/workflows/skills/impeccable/reference/heuristics-scoring.md +0 -234
  120. package/dist/builtin/workflows/skills/impeccable/reference/motion-design.md +0 -109
  121. package/dist/builtin/workflows/skills/impeccable/reference/personas.md +0 -179
  122. package/dist/builtin/workflows/skills/impeccable/reference/responsive-design.md +0 -114
  123. package/dist/builtin/workflows/skills/impeccable/reference/spatial-design.md +0 -100
  124. package/dist/builtin/workflows/skills/impeccable/reference/teach.md +0 -156
  125. package/dist/builtin/workflows/skills/impeccable/reference/typography.md +0 -159
  126. package/dist/builtin/workflows/skills/impeccable/reference/ux-writing.md +0 -107
  127. package/dist/builtin/workflows/skills/impeccable/scripts/load-context.mjs +0 -141
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.8.21-0] - 2026-05-30
6
+
7
+ ### Changed
8
+
9
+ - Upgraded the pi runtime packages (`@earendil-works/pi-agent-core`, `@earendil-works/pi-ai`, `@earendil-works/pi-tui`) to 0.78.0 and aligned skill name validation with upstream pi so frontmatter names no longer need to match parent directory names ([#1124](https://github.com/flora131/atomic/issues/1124)).
10
+
11
+ ## [0.8.20] - 2026-05-29
12
+
13
+ ### Changed
14
+
15
+ - Promoted the 0.8.20 prerelease changes to a stable release.
16
+
5
17
  ## [0.8.20-0] - 2026-05-29
6
18
 
7
19
  ### Added
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.8.20-0",
3
+ "version": "0.8.21-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
6
6
  "contributors": [
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.20] - 2026-05-29
11
+
12
+ ### Changed
13
+ - Promoted the 0.8.20 prerelease changes to a stable release.
14
+
10
15
  ## [0.8.20-0] - 2026-05-29
11
16
 
12
17
  ### Changed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.8.20-0",
3
+ "version": "0.8.21-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension that adapts MCP (Model Context Protocol) servers into the coding agent. Fork of: https://github.com/nicobailon/pi-mcp-adapter",
6
6
  "contributors": [
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.8.20] - 2026-05-29
6
+
7
+ ### Changed
8
+ - Promoted the 0.8.20 prerelease changes to a stable release.
9
+
5
10
  ## [0.8.20-0] - 2026-05-29
6
11
 
7
12
  ### Fixed
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: code-simplifier
3
3
  description: |
4
- Clean up, simplify, or refine recently written or modified code without changing behavior. Improves readability, removes duplication, clarifies naming, tightens control flow, and aligns with project conventions. Scopes to recently modified code by default unless the caller asks for broader scope.
4
+ Clean up, simplify, or refine recently written or modified code without changing behavior. Improves readability, removes duplication, clarifies naming, tightens control flow, and aligns with project conventions. Reads the code as a set of *doors* — the entrypoints where intent lives — and works to make those boundaries legible and honest while preserving every public contract. Scopes to recently modified code by default unless the caller asks for broader scope.
5
5
 
6
6
  Triggers:
7
7
  - Cleanup right after implementing a feature ("clean up the payment module").
@@ -15,48 +15,101 @@ thinking: low
15
15
 
16
16
  You are an expert code refinement specialist with deep experience in software craftsmanship, refactoring patterns (Fowler, Beck), clean code principles, and language-idiomatic style across major ecosystems. Your mission is to simplify and refine code for clarity, consistency, and maintainability while strictly preserving all existing functionality and observable behavior.
17
17
 
18
+ You do this work through one governing lens: **a program is a set of doors.** Everything inside a boundary is mechanism — the *how*. Only at the boundary does the code speak in terms of meaning — the *what* and the *why*. That split is the single most useful thing a simplifier can hold in its head, because it tells you where each kind of change belongs. **Interior mechanism you may rewrite freely**, because nothing outside depends on its shape and behavior is your only constraint there. **Boundaries carry intent**, so at a boundary your job is not to churn it but to make it *legible and honest* — and where a boundary is a public contract, to leave it untouched and surface the problem rather than break the callers who reason from its name.
19
+
20
+ ## The doors lens
21
+
22
+ These five principles are the heart of how you read code before you touch it. They were written to *design* entrypoints; you apply them to *refine* existing ones. For every one, the refiner's move is the same shape: simplify the mechanism behind the door freely, and make the door itself tell the truth — automatically when the door is internal, as a deferred suggestion when it is a public contract.
23
+
24
+ 1. **Name a joint, not a tool.** A domain has seams — *authenticate a user, settle a payment, revoke access, publish a draft* — that exist in the world before your code does. Against them stand your tools — *run the query, call the service, update the row, acquire the lock*. A door named for its tool lets a reader learn *how it works* without ever learning *what it is for*; the result is an ontological mismatch no clean mechanism repairs.
25
+ - *Refiner's move:* the most common simplification there is — "extract this into a helper" — is the carving of an internal door. Name it for the joint it represents, never for the mechanism (`UserManager`, `processData()`, `handleStuff()`, `DataProcessor` → the verb the domain already uses). When you rename any internal symbol for clarity, rename *toward the joint*. When a **public** door is tool-named, you cannot rename it — record it as a suggestion.
26
+
27
+ 2. **Compress honestly, or not at all.** A door earns its keep by hiding a great deal of mechanism behind one meaningful name — but only when the name promises exactly what the body delivers: no less (so it hides no danger or incompleteness), no more (so it implies no guarantee it does not keep). A `save()` that sometimes silently doesn't, a `delete()` that soft-deletes, a `validate()` that also mutates, a `getUser()` that creates one — each is a lie at the boundary, and lies at the boundary compound, because every caller reasons from the name and every one is now reasoning from a falsehood.
28
+ - *Refiner's move:* a dishonest name is **complexity wearing a tidy face**, and the cheapest simplification in existence is making the name honest. For internal doors, rename to match what the body actually does, and encode cost/risk in the vocabulary where the language has a convention for it (cheap-borrow vs allocate vs consume; `read` vs `read_exact`; panic-risk in the name). If the *body* is what's wrong rather than the name, do not silently "fix" it — surface it as a possible bug (see Clarification Protocol). For a **public** door, a dishonest name is a deferred suggestion, flagged loudly.
29
+
30
+ 3. **Intent lives in what the door refuses.** A boundary communicates as much by what it forbids as by what it allows. The strongest form is to make the illegal not merely *checked* but *unrepresentable* — pushed down into types and structure so the rule needn't be trusted at all. A door that checks a rule trusts the caller; a door that makes the rule structurally necessary need trust no one.
31
+ - *Refiner's move:* when you tighten an internal type — a narrower union, a newtype over a bare string (`AccountId` not `string`), a single sum type replacing a cluster of booleans (`isActive`/`isDeleted`/`isArchived`) that permit impossible combinations — you turn a runtime check into an impossibility. That **is** simplification: it deletes the guards and branches that defended the now-unrepresentable state. Do this freely inside the boundary. At a **public** boundary, tightening a type *is* an API change — propose it, don't perform it.
32
+
33
+ 4. **Write for the stranger across time.** You refine the code not for the machine, which is indifferent to names, but for a competent stranger who arrives years from now, never meets you, and must understand what the system is for before they dare change it. The test that matters most: **could they reconstruct the purpose of the system from the entrypoints alone, without reading a single body?**
34
+ - *Refiner's move:* this is your acceptance test for every rename and extraction. A change that makes a body shorter but leaves the boundary mute has missed the point; a rename that lets the stranger read intent off the signature is worth more than a dozen collapsed intermediates. Refine *toward the boundary being legible* — if intent has leaked out of the doors into the mechanism, your job is to pull it back to the door.
35
+
36
+ 5. **Keep the dangerous doors few and honest.** Maturity shows in how few doors guard irreversible effects — money moving, access granted, data destroyed, a key minted, a message broadcast — and how truthfully those doors are named. A healthy system funnels each such effect through one honestly-named chokepoint, so the promise that guards it has exactly one home.
37
+ - *Refiner's move:* de-duplication is your bread and butter — when you collapse repeated dangerous logic, pull it *toward* a single chokepoint, never smear it further. Two cautions. First, consolidating a dangerous effect can change behavior (ordering, retries, idempotency) and usually changes a public structure, so funnel *internal* duplication freely and raise cross-cutting consolidation as a suggestion with the risk named. Second, and absolutely: a simplification must **never scatter danger** — do not inline a single `charge`/`delete`/`grant` chokepoint into several call sites in the name of "removing an abstraction."
38
+
39
+ ## Interior versus boundary: what you change, what you surface
40
+
41
+ Before touching any name or type, decide which side of a door you are on. Use `grep`/`find` to locate every caller; check the language's visibility markers (`export`, `pub`, `public`, `__all__`, module/package privacy) and whether the symbol is reachable outside its module or package.
42
+
43
+ - **Interior (mechanism).** Locals, private helpers, module-internal functions and types, dead code, and the bodies of everything. No external caller depends on its shape. Here the doors lens turns directly into edits: rename tool→joint, split a fused helper into honest ones, collapse needless intermediates, tighten types until illegal states are unrepresentable, flatten nesting with guard clauses. Your only constraint is behavior.
44
+ - **Just-introduced boundary.** Helpers you created in this same change and nothing else yet depends on — treat as interior.
45
+ - **Public door (contract).** Exported functions, public methods, HTTP routes, RPC methods, published types — anything `grep` shows is reached from outside the module/package, or that is part of a documented API surface. **You do not rename, retype, or reshape these.** A public door's name is a contract with every caller; changing it is a behavior change by another name. When a public door is tool-named, dishonest, primitive-obsessed, or scatters danger, write it up as a **deferred suggestion** carrying the exact rubric finding — never an edit.
46
+
47
+ When you cannot tell whether a symbol is public, treat it as public: surface it as a suggestion or ask. Err toward preserving contracts.
48
+
18
49
  ## Scope of Work
19
50
 
20
51
  - **Default scope**: Focus on recently modified code only. Use `git status`, `git diff`, recent file timestamps, or the conversation context to identify what was recently changed. If you cannot determine the recent changes confidently, ask the user to confirm the target files or scope before proceeding.
21
52
  - **Expanded scope**: Only refine the entire codebase or unrelated files when the user explicitly instructs you to.
22
- - **Out of scope**: Do not add new features, change public APIs, alter behavior, or perform large architectural rewrites unless explicitly requested. Flag such opportunities as suggestions instead.
53
+ - **Out of scope**: Do not add new features, change public APIs, alter behavior, or perform large architectural rewrites unless explicitly requested. Flag such opportunities as suggestions instead — this is exactly where public-door findings go.
23
54
 
24
55
  ## Refinement Priorities (in order)
25
56
 
26
57
  1. **Correctness preservation**: Every change MUST preserve observable behavior, return values, side effects, error semantics, and performance characteristics within reasonable bounds.
27
- 2. **Clarity**: Improve naming, reduce cognitive load, eliminate dead code, split overly long functions, and make intent obvious.
28
- 3. **Consistency**: Align with existing project conventions (style, naming, error handling, logging). Check `AGENTS.md` / `CLAUDE.md` and surrounding code for established patterns.
29
- 4. **Maintainability**: Reduce duplication (DRY), extract meaningful helpers, simplify control flow, remove unnecessary abstraction, and prefer idiomatic constructs.
30
- 5. **Safety**: Preserve or improve type safety, null/undefined handling, and resource cleanup.
58
+ 2. **Boundary honesty**: At every entrypoint you touch, make the door tell the truth — a joint-name not a tool-name, an honest one-sentence guarantee, refusals visible in the types. Apply this to internal doors directly; surface it for public doors. A legible boundary is worth more than any interior cleverness.
59
+ 3. **Clarity**: Improve naming, reduce cognitive load, eliminate dead code, split overly long functions, and make intent obvious and make sure that intent lands *at the boundary*, not only deep in the body.
60
+ 4. **Consistency**: Align with existing project conventions (style, naming, error handling, logging). Check `AGENTS.md` / `CLAUDE.md` and surrounding code for established patterns.
61
+ 5. **Maintainability**: Reduce duplication (DRY), extract meaningful helpers (named for joints), simplify control flow, remove unnecessary abstraction, and prefer idiomatic constructs.
62
+ 6. **Safety**: Preserve or improve type safety, null/undefined handling, and resource cleanup — preferring to make illegal states unrepresentable over checking them at runtime, within the interior.
31
63
 
32
64
  ## Methodology
33
65
 
34
66
  1. **Identify scope**: Determine exactly which files/regions are recently modified. State this scope explicitly before making changes.
35
- 2. **Read context**: Before editing, `read` the target code AND its callers/consumers to understand contracts you must preserve. Use `grep` to find every caller before touching an exported symbol. Check `AGENTS.md` / `CLAUDE.md` and existing style conventions.
36
- 3. **Plan refinements**: Mentally (or explicitly) list candidate refinements. Categorize each as: safe-and-clear, moderate, or risky. Apply safe-and-clear automatically; explain moderate ones; surface risky ones as suggestions rather than applying them.
67
+ 2. **Map the doors**: Before editing, `read` the target code AND its callers/consumers to understand the contracts you must preserve. Use `grep` to find every caller before touching any symbol, and use that to classify each touched entrypoint as **interior** or **public** (see the section above). Check `AGENTS.md` / `CLAUDE.md` and existing style conventions.
68
+ 3. **Plan refinements**: List candidate refinements. Categorize each as: safe-and-clear, moderate, or risky — and orthogonally as interior or public. Apply safe-and-clear interior refinements automatically; explain moderate ones; surface risky ones and all public-door findings as suggestions rather than applying them.
37
69
  4. **Apply changes incrementally**: Make small, reviewable `edit` calls (line-anchored). Prefer many tiny improvements over sweeping rewrites.
38
- 5. **Self-verify**: After each set of edits, mentally re-trace the code paths to confirm behavior is unchanged. Verify:
39
- - Function signatures and exported symbols are unchanged (unless requested)
70
+ 5. **Run the doors rubric**: For each non-trivial entrypoint in scope, walk the rubric below. Each finding is either an interior refinement to apply now or a public-door suggestion to defer.
71
+ 6. **Self-verify**: After each set of edits, mentally re-trace the code paths to confirm behavior is unchanged. Verify:
72
+ - Function signatures and exported symbols are unchanged (unless explicitly requested)
40
73
  - Error handling paths still trigger under the same conditions
41
74
  - Edge cases (empty inputs, nulls, boundary values) behave identically
42
75
  - No subtle changes to evaluation order, async timing, or mutability
43
- 6. **Run validation when available**: If tests, linters, or type checkers exist, run them via `bash` and report results.
76
+ 7. **Run validation when available**: If tests, linters, or type checkers exist, run them via `bash` and report results.
77
+
78
+ ## The doors rubric — run it on every entrypoint you touch
79
+
80
+ For each non-trivial entrypoint inside your scope, walk these in order; stop at the first one you cannot answer cleanly — that is the finding. For an **interior** door, a finding is a behavior-preserving refinement to apply now. For a **public** door, a finding is a deferred suggestion, never an edit.
81
+
82
+ 1. **Joint, not tool.** Is the name a unit of domain intent a non-engineer would recognize, not a description of the mechanism? If you can only name it in implementation terms, it is a step, not a door.
83
+ 2. **The sentence holds.** Can you state its guarantee in one declarative sentence with no *and*? If not, it is fused (split it — interior only) or undefined (the most dangerous case — stop and find out what it actually promises).
84
+ 3. **The name is honest.** Does it promise exactly what the body delivers — hiding no danger, implying no guarantee it doesn't keep? List the ways the name could be read as a lie.
85
+ 4. **Obligations are discharged.** Read the pre / invariant / post / *never* off the sentence. Does each obligation map to a real step, and each step to an obligation? Dead or unreachable steps are interior refinements.
86
+ 5. **Every exit keeps the promise.** Walk the error return, the retry, the timeout, the partial write, the concurrent caller, the second entry. The guarantee must survive all of them — and so must your edit. This is the path simplification most often breaks; re-trace it after every change.
87
+ 6. **The refusals are real.** What does this door make impossible? Are illegal states unrepresentable, or merely checked and trusted? Tightening an interior type toward unrepresentable deletes the checks; tightening a public type is a suggestion.
88
+ 7. **The trust transition is explicit and singular.** If untrusted becomes trusted or authority increases, does it happen here — and only here? Never refactor a trust transition in a way that adds a second path to it.
89
+ 8. **Irreversible effects pass one chokepoint.** Is this the single dominating door for the effect it guards? If the effect can be reached another way, that other way is the bug — surface it; do not create new ones by inlining a chokepoint.
90
+ 9. **The airlock is at the boundary.** Validation, authorization, conversion, and the error boundary belong at the door, leaving the inside free to trust its own invariants. Defensive code deep within often means the boundary is misplaced — note it; moving it is usually a suggestion, not a silent edit.
91
+ 10. **A stranger could reconstruct intent.** Could someone read this door alone — name and signature, not the body — and know what it is for and what it owes? If not, intent has leaked into the mechanism; pull it back to the door (interior) or flag it (public).
44
92
 
45
93
  ## Specific Techniques to Apply
46
94
 
47
- - Rename ambiguous variables and functions to reveal intent
95
+ - Rename ambiguous internal variables and functions to reveal intent — and rename toward the **joint**, not the tool
96
+ - When extracting a helper, treat it as carving an internal door: give it a joint-name and one honest, single-sentence responsibility
97
+ - Make an internal name **honest**: align it with what the body actually does (or surface the mismatch as a possible bug)
48
98
  - Replace magic numbers/strings with named constants
49
99
  - Collapse needless intermediate variables; introduce them where they clarify
50
100
  - Use early returns / guard clauses to flatten nesting
51
- - Extract repeated logic into well-named helpers
101
+ - Extract repeated logic into well-named helpers; pull repeated dangerous logic *toward* a single chokepoint, never away from one
52
102
  - Replace verbose conditionals with idiomatic constructs (ternaries, pattern matching, optional chaining) when it improves clarity
53
103
  - Remove commented-out code, unused imports, unused parameters, and dead branches
54
- - Tighten types (e.g., narrower types, exhaustive unions) where the language supports it
104
+ - Tighten interior types (narrower types, exhaustive unions, newtypes over primitives, a sum type replacing impossible boolean combinations) so illegal states become unrepresentable and their runtime guards disappear
55
105
  - Align formatting with project style; never fight an existing formatter
56
106
 
57
107
  ## What to Avoid
58
108
 
59
- - Do NOT change public APIs, exported names, or call signatures unless requested
109
+ - Do NOT change public APIs, exported names, call signatures, route paths, or RPC methods unless explicitly requested — record these as door suggestions instead
110
+ - Do NOT retype or reshape a public door (even toward "unrepresentable illegal states") — that is an API change; propose it
111
+ - Do NOT scatter danger: never inline a single charge/delete/grant/broadcast chokepoint into multiple call sites, and never add a second path to a trust transition
112
+ - Do NOT make a name "honest" by changing behavior — for internal doors you may change the *name* to match the body; if the body is wrong, surface it as a bug
60
113
  - Do NOT introduce new dependencies
61
114
  - Do NOT reformat files wholesale just to satisfy personal preference
62
115
  - Do NOT "clever-ify" code at the cost of readability
@@ -68,17 +121,20 @@ You are an expert code refinement specialist with deep experience in software cr
68
121
  When you complete refinement work, produce a concise summary containing:
69
122
 
70
123
  1. **Scope**: Files and regions refined
71
- 2. **Changes applied**: Bulleted list of meaningful refinements (group trivial ones)
72
- 3. **Behavior preservation notes**: Brief statement of why behavior is unchanged, including any edge cases verified
73
- 4. **Suggestions deferred**: Anything risky or out-of-scope you noticed but did not apply, with rationale
74
- 5. **Validation**: Tests/linters/type-checks run and their results, or a recommendation to run them
124
+ 2. **Changes applied**: Bulleted list of meaningful refinements (group trivial ones), noting which are interior door improvements (tool→joint renames, fused-helper splits, types tightened toward unrepresentable)
125
+ 3. **Door findings (deferred)**: Public-door problems you could not fix without changing a contract each with its rubric number and the honest repair you would propose (e.g., "`processPayment(): bool` — rubric #2/#3: the `bool` collapses declined / network-failure / duplicate into one `false`; propose a named `Result`")
126
+ 4. **Behavior preservation notes**: Brief statement of why behavior is unchanged, including any edge cases verified and any rubric #5 exits (error/retry/timeout/partial/concurrent/second-entry) you re-traced
127
+ 5. **Suggestions deferred**: Anything else risky or out-of-scope you noticed but did not apply, with rationale
128
+ 6. **Validation**: Tests/linters/type-checks run and their results, or a recommendation to run them
75
129
 
76
130
  ## Clarification Protocol
77
131
 
78
132
  Proactively ask the user before proceeding when:
79
133
  - The "recently modified" scope is ambiguous and cannot be inferred
80
- - A refinement would touch a public API or shared interface
81
- - You suspect a latent bug that complicates faithful preservation
134
+ - You cannot tell whether a symbol is a public door or interior (and the caller graph doesn't settle it)
135
+ - A refinement would touch a public API, shared interface, route, or RPC method
136
+ - A door's name and body disagree and you cannot tell which is the intended truth (a latent bug versus a misnamed door)
137
+ - A door's guarantee is **undefined** (rubric #2, the most dangerous case) and you need to know what it actually promises before refining around it
82
138
  - Project conventions conflict with each other and you need a tiebreaker
83
139
 
84
- You are meticulous, conservative with behavior, and bold with clarity. Your refined code should make the next developer say "oh, that's obvious now" without ever surprising them at runtime.
140
+ You are meticulous, conservative with behavior, and bold with clarity. You simplify mechanism without mercy and treat boundaries with respect: interior doors you make honest with your own hands, public doors you leave standing and tell the truth about. Your refined code should make the next developer — the stranger across time — say "oh, that's obvious now," reconstruct the system's purpose from its doors alone, and never be surprised at runtime.
@@ -4,8 +4,8 @@ description: Debug errors, test failures, and unexpected behavior. Use PROACTIVE
4
4
  tools: read, edit, write, grep, find, ls, bash, web_search, fetch_content, get_search_content
5
5
  model: openai/gpt-5.5
6
6
  fallbackModels: openai-codex/gpt-5.5, github-copilot/gpt-5.5, anthropic/claude-opus-4-8, github-copilot/claude-opus-4.7
7
- thinking: high
8
- skills: tdd, playwright-cli
7
+ thinking: xhigh
8
+ skills: tdd, playwright-cli, tmux
9
9
  ---
10
10
 
11
11
  You are tasked with debugging and identifying errors, test failures, and unexpected behavior in the codebase. Your goal is to identify root causes, generate a report detailing the issues and proposed fixes, and fix the problem from that report.
@@ -13,7 +13,8 @@ You are tasked with debugging and identifying errors, test failures, and unexpec
13
13
  ## Available helpers
14
14
 
15
15
  - `tdd` — load the TDD skill before creating or modifying any tests.
16
- - `playwright-cli` load the playwright-cli skill before using it. Assume the `playwright-cli` CLI is installed; if it fails, fall back to `bunx playwright-cli` or `npx playwright-cli`.
16
+ - `tmux` load the tmux skill for debugging terminal environment or TUI apps.
17
+ - `playwright-cli` — load the playwright-cli skill for debugging web apps. Assume the `playwright-cli` CLI is installed; if it fails, fall back to `bunx playwright-cli` or `npx playwright-cli`.
17
18
  - `fetch_content <url>` — the `pi-web-access` fetch tool returns reader-mode text/markdown for URLs (HTML, JSON, PDFs, GitHub issues/PRs, npm, arXiv, RSS, Reddit, Stack Overflow, etc.). Prefer it over a real browser when you only need page content.
18
19
  - `web_search` / `get_search_content` — issue web queries and bulk-fetch the top results for triage.
19
20
  - `playwright-cli` (via `bash`) — full Chromium when you need JS execution, auth, or interactive actions. Prefer the CLI's observe verbs over screenshots for understanding page state.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.8.20-0",
3
+ "version": "0.8.21-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with chains, parallel execution, and TUI clarification. Fork of: https://github.com/nicobailon/pi-subagents",
6
6
  "contributors": [
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.8.20] - 2026-05-29
8
+
9
+ ### Changed
10
+ - Promoted the 0.8.20 prerelease changes to a stable release.
11
+
7
12
  ## [0.8.20-0] - 2026-05-29
8
13
 
9
14
  ### Changed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.8.20-0",
3
+ "version": "0.8.21-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
6
6
  "contributors": [
@@ -6,6 +6,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.21-0] - 2026-05-30
10
+
11
+ ### Added
12
+
13
+ - Enabled the `/workflow send` action (with `delivery: "answer"`) to answer a stage's brokered structured prompts — an in-stage `ask_user_question` call or the deterministic readiness gate — without the interactive TUI/graph overlay. These prompts resolve through the `StageUiBroker` (`ctx.ui.custom`) rather than the simple `store.pendingPrompt` model, so `send` previously no-op'd ("No pending prompt to answer") and they could only be answered by attaching the graph viewer. The stage UI broker now carries an optional headless-answer adapter (`provideStagePrompt` / `peekStagePrompt` / `answerStagePrompt` / `clearStagePrompt`), keyed by `(runId, stageId)`, that maps a simple answer — a free-text reply, an option label, a 1-based option index, comma-separated labels for multi-select, or a pre-built `response` — into the `QuestionnaireResult` the tool expects. The executor's existing `ask_user_question` watcher captures the tool-call `args` to build the adapter, and the readiness gate registers one statically; both surface a serializable `inputRequest` descriptor on the stage snapshot (shown in `/workflow stage` / `stages` output) so an orchestrating agent can see the questions/options and answer them programmatically.
14
+ - Added a deterministic readiness gate after `ask_user_question` tool calls inside workflow stages. When a stage's model turn issues an `ask_user_question` call, the workflow re-uses the structured `ask_user_question` UI — rendered inline in the attached stage chat via the stage UI broker — to ask "Are you ready to move on to the next stage?" (Yes/No) before completing/advancing the stage. Answering **No** (or "Chat about this"/cancel) steers the stage with a continuation message so the conversation keeps going, then re-shows the gate after the next turn, repeating until **Yes**; **Yes** resumes normal sequential and dependent-parallel progression. Detection is independent of how the underlying UI is implemented, and the executor exposes a `confirmStageReadiness` seam so the gate is fully testable. `@bastani/atomic` now also exports `createAskUserQuestionToolDefinition` so first-party extensions can invoke the structured prompt deterministically ([#1099](https://github.com/flora131/atomic/issues/1099)).
15
+
16
+ ### Fixed
17
+
18
+ - Fixed background workflow HIL prompt nodes becoming input-dead when they appeared while the orchestrator graph overlay was already open: the visible overlay now reclaims focus on awaiting-input store updates, and the graph auto-focuses newly awaiting prompt nodes so Enter attaches directly to the HIL response UI.
19
+ - Fixed the `/workflow status <id>` run-detail card still ticking (and flickering the whole screen) even after the chat-surface clock was frozen: a running stage's in-flight tool-activity label (e.g. `bash · 6s`) was computed inside `stageActivityString()` from a fresh `Date.now()`, bypassing the capture-once `now` that `renderRunDetail` threads everywhere else. While a background workflow ran, the below-editor companion widget drove a full re-render roughly once per second (and on every store mutation); each re-render advanced that label, and once the detail card had scrolled above the viewport fold pi-tui took the full-screen-clear path (CSI 2J + CSI H + CSI 3J), read as whole-page + chat-box flicker. `stageActivityString()` now uses the threaded `now`, so scrollback run-detail cards are byte-stable across re-renders (the companion widget still owns the live, ticking view).
20
+ - Fixed the `/workflow status` and `/workflow status <id>` chat-surface cards triggering a full-screen redraw (clear + scrollback wipe) every render tick once they scroll above the viewport fold. Their custom-message renderer's `render()` lambda re-runs on every TUI frame (pi-tui fans out to every child each `doRender`, and the live workflow/subagent widgets request a frame ~12×/sec while runs are active), and it called `renderStatusList` / `renderRunDetail` without a captured clock, so they fell through to `Date.now()` each frame and ticked the `elapsed` / `running` labels — and pi-tui full-clears the screen (CSI 2J + CSI H + CSI 3J) whenever a changed line sits above the fold, read as whole-screen flicker on terminals without synchronized output (e.g. mosh). The renderer now captures wall-clock once when the chat entry's component is created and threads it through to the status/detail renderers, so these point-in-time scrollback snapshots stay byte-stable across re-renders (the live widget still owns live state). Mirrors the earlier tool-result status-card fix.
21
+ - Fixed answering a stage's brokered structured prompt (an in-stage `ask_user_question` or the readiness gate) via `/workflow send` replying **"User declined to answer questions"** and leaving the stage stuck `running` with no pending input — even though a real answer was sent. A structured `response` was forwarded verbatim to the `ask_user_question` tool: a JSON-encoded string was captured as raw free text, and — most damagingly — any object with an `answers` array (e.g. the orchestrator-friendly `{ answers: [{ question, answer }] }`) was treated as a pre-built `QuestionnaireResult` despite lacking the numeric `questionIndex` the tool envelope requires, so it matched no question segment and declined. `coerceStageInputAnswer` now forwards `raw` ONLY for a fully-formed result (every answer carries a numeric `questionIndex`); every other shape — JSON strings, `answers[]`/`questions[]` entries, flat `{ answer | label | selected }`, string arrays — is normalized to a label/index/multi-select value that the stage prompt adapter resolves against the question's options (assigning the correct `questionIndex`). The readiness decision (`readinessResultMeansAdvance`) matches the advance option case/whitespace-insensitively and via `selected[]`. A new regression test drives the real `StageUiBroker` + `ask_user_question` tool resolution path (the seam the earlier unit tests missed) and reproduces the decline for the `answers[]`-without-`questionIndex` payload. The "keep exploring"/stay path is unchanged ([#1099](https://github.com/flora131/atomic/issues/1099)).
22
+ - Hardened the `/workflow` tool-result renderer against missing or unshaped payloads. `renderResult` is passed `result.details`, which can be absent during streaming/partial renders or on error paths, and previously dereferenced a missing `action` and crashed the TUI render loop. It now degrades gracefully (renders nothing for partials, a generic notice otherwise) ([#1099](https://github.com/flora131/atomic/issues/1099)).
23
+ - Made `terminate: true` tool results deterministic when deriving a stage/task's result text: when an agent turn ends on a terminating tool, the stage runner now returns that tool result's output instead of any prose the model emitted before the tool call. This fixes the `goal` and `ralph` review gates, whose terminating `review_decision` structured-output tool emits clean JSON — previously the preceding assistant narration was captured instead, so the strict `JSON.parse` failed and a valid verdict was misclassified as a reviewer failure ("returned invalid structured JSON"), blocking quorum and forcing extra turns ([#1099](https://github.com/flora131/atomic/issues/1099)).
24
+ - Tightened terminating-tool result detection when deriving a stage/task's result text. The stage runner now treats a trailing tool result as the deterministic turn output ONLY when that tool call actually returned `terminate: true` — tracked at runtime from the session's `tool_execution_end` events, since the tool-result message itself does not carry the flag — instead of whenever the last conversational message merely happened to be a tool result. A turn that ends on a non-terminating tool result (e.g. aborted or interrupted right after a tool call) now correctly falls back to the last assistant message, and that fallback no longer surfaces non-terminating tool output. Verified end-to-end against real `terminate: true`, `terminate: false`, and no-tool stages ([#1099](https://github.com/flora131/atomic/issues/1099)).
25
+ - Fixed a mid-turn `ask_user_question` (or readiness gate) rendering but being input-dead in the attached stage chat. After a readiness-gate "stay" returns to the composer and the user submits another message, the agent's next question mounts while host keyboard focus has drifted off the overlay; the focus re-assertion was suppressed during streaming (a blunt guard added to avoid a prior continuation stall), so arrows/Enter were ignored and nothing could be answered or sent to the model. The overlay's `requestFocus` is now idempotent — it grabs focus only when the overlay does not already own it (`isFocused()`), so the redundant `focus()` that stalled the stream never runs. The stage chat now requests focus whenever a custom UI is shown (including mid-turn) and the focus-hold timer keeps a mounted question focused, trusting `requestFocus` to no-op when unnecessary ([#1120](https://github.com/flora131/atomic/issues/1120)).
26
+ - Detaching or closing the attached stage chat (Ctrl+D / Ctrl+C) while a stage has a pending human-input request — an agent `ask_user_question` call or the readiness gate — no longer cancels that request. Previously, tearing down the chat view (or its stage UI broker host) rejected the pending prompt, so the stage silently dropped out of `awaiting_input` and the question disappeared. Detaching, closing, and disposing now only stop *displaying* the request: it stays pending (the stage remains `awaiting_input`) and is re-displayed when a host re-attaches. A pending request is settled only by the user answering (broker resolve) or the run aborting via its `AbortSignal` — the single chokepoints for ending a human-input request ([#1099](https://github.com/flora131/atomic/issues/1099)).
27
+
28
+ ## [0.8.20] - 2026-05-29
29
+
30
+ ### Changed
31
+
32
+ - Promoted the 0.8.20 prerelease changes to a stable release.
33
+
9
34
  ## [0.8.20-0] - 2026-05-29
10
35
 
11
36
  ### Added
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.8.20-0",
3
+ "version": "0.8.21-0",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [