@bastani/atomic 0.8.24-alpha.2 → 0.8.24-alpha.3

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 (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -1
  3. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  4. package/dist/builtin/intercom/package.json +1 -1
  5. package/dist/builtin/mcp/CHANGELOG.md +6 -0
  6. package/dist/builtin/mcp/package.json +1 -1
  7. package/dist/builtin/subagents/CHANGELOG.md +10 -0
  8. package/dist/builtin/subagents/README.md +132 -21
  9. package/dist/builtin/subagents/package.json +1 -1
  10. package/dist/builtin/subagents/prompts/parallel-context-build.md +4 -2
  11. package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +3 -1
  12. package/dist/builtin/subagents/skills/subagent/SKILL.md +49 -11
  13. package/dist/builtin/subagents/src/agents/agent-management.ts +79 -16
  14. package/dist/builtin/subagents/src/agents/agents.ts +47 -16
  15. package/dist/builtin/subagents/src/agents/chain-serializer.ts +114 -0
  16. package/dist/builtin/subagents/src/extension/schemas.ts +139 -3
  17. package/dist/builtin/subagents/src/runs/background/async-execution.ts +92 -6
  18. package/dist/builtin/subagents/src/runs/background/async-status.ts +11 -1
  19. package/dist/builtin/subagents/src/runs/background/run-status.ts +4 -1
  20. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +529 -32
  21. package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +361 -118
  22. package/dist/builtin/subagents/src/runs/foreground/execution.ts +75 -7
  23. package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +33 -0
  24. package/dist/builtin/subagents/src/runs/shared/acceptance.ts +611 -0
  25. package/dist/builtin/subagents/src/runs/shared/chain-outputs.ts +101 -0
  26. package/dist/builtin/subagents/src/runs/shared/dynamic-fanout.ts +293 -0
  27. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +29 -1
  28. package/dist/builtin/subagents/src/runs/shared/pi-args.ts +11 -0
  29. package/dist/builtin/subagents/src/runs/shared/structured-output.ts +79 -0
  30. package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +52 -2
  31. package/dist/builtin/subagents/src/runs/shared/workflow-graph.ts +206 -0
  32. package/dist/builtin/subagents/src/shared/formatters.ts +2 -2
  33. package/dist/builtin/subagents/src/shared/settings.ts +53 -4
  34. package/dist/builtin/subagents/src/shared/types.ts +226 -0
  35. package/dist/builtin/subagents/src/shared/utils.ts +2 -1
  36. package/dist/builtin/subagents/src/slash/slash-commands.ts +41 -3
  37. package/dist/builtin/subagents/src/tui/render.ts +152 -34
  38. package/dist/builtin/web-access/CHANGELOG.md +6 -0
  39. package/dist/builtin/web-access/package.json +1 -1
  40. package/dist/builtin/workflows/CHANGELOG.md +6 -0
  41. package/dist/builtin/workflows/package.json +1 -1
  42. package/dist/builtin/workflows/skills/create-spec/SKILL.md +1 -1
  43. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +0 -1
  44. package/dist/core/slash-commands.d.ts.map +1 -1
  45. package/dist/core/slash-commands.js +1 -0
  46. package/dist/core/slash-commands.js.map +1 -1
  47. package/dist/core/system-prompt.d.ts.map +1 -1
  48. package/dist/core/system-prompt.js +4 -3
  49. package/dist/core/system-prompt.js.map +1 -1
  50. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  51. package/dist/modes/interactive/interactive-mode.js +1 -1
  52. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  53. package/docs/usage.md +1 -0
  54. package/docs/workflows.md +173 -0
  55. package/package.json +1 -1
package/docs/usage.md CHANGED
@@ -55,6 +55,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
55
55
  | `/reload` | Reload keybindings, extensions, skills, prompts, and context files |
56
56
  | `/hotkeys` | Show all keyboard shortcuts |
57
57
  | `/changelog` | Display version history |
58
+ | `/exit` | Exit Atomic |
58
59
  | `/quit` | Quit Atomic |
59
60
 
60
61
  ## Message Queue
package/docs/workflows.md CHANGED
@@ -30,6 +30,7 @@ Use a workflow when a task should be repeatable, inspectable, resumable, or spli
30
30
  - [Quick Start](#quick-start)
31
31
  - [Built-in Workflows](#built-in-workflows)
32
32
  - [When to Use Workflows](#when-to-use-workflows)
33
+ - [Workflow Starter Patterns](#workflow-starter-patterns)
33
34
  - [Atomic vs Claude Code Dynamic Workflows](#atomic-vs-claude-code-dynamic-workflows)
34
35
  - [Workflow Locations](#workflow-locations)
35
36
  - [Workflow Configuration](#workflow-configuration)
@@ -382,6 +383,177 @@ If the task is only deterministic TypeScript with no LLM/session stage, use a sc
382
383
  | Track one-off work without saving a workflow file | direct `workflow({ task })`, `workflow({ tasks })`, or `workflow({ chain })` calls |
383
384
  | Make a workflow robust | design the stage graph, context handoffs, artifacts, validation gates, model fallbacks, and human approval points before coding |
384
385
 
386
+ ## Workflow Starter Patterns
387
+
388
+ When a workflow is larger than a single tracked task, start by choosing a small control-flow pattern before writing prompts. Naming the pattern keeps the stage graph understandable, makes validation gates explicit, and helps reviewers see why work is split across model sessions.
389
+
390
+ These patterns are composable. For example, a migration workflow might use **fan-out-and-synthesize** to fix many call sites, then **adversarial verification** to review each patch, and finally **loop until done** while tests still fail.
391
+
392
+ | Pattern | Use it when | Atomic shape |
393
+ |---|---|---|
394
+ | **Classify-and-act** | Inputs arrive in different categories and each category needs a different path, model, tool set, or output format. | `ctx.task("classify")` → deterministic branch → category-specific `ctx.task`, `ctx.chain`, `ctx.parallel`, or child `ctx.workflow(...)`. |
395
+ | **Fan-out-and-synthesize** | The task can be split into many independent slices that benefit from clean context windows. | `ctx.parallel([...])` with separate artifacts → synthesis barrier that reads the artifacts and merges the answer. |
396
+ | **Adversarial verification** | Outputs need independent checking against a rubric, security rule, factual source, or acceptance contract. | Worker stage(s) → fresh-context verifier stage(s) → reducer that accepts, rejects, or asks for repair. |
397
+ | **Generate-and-filter** | You need many candidate ideas, plans, names, fixes, or hypotheses before selecting the best few. | Generator fan-out → dedupe/filter stage → optional verifier/judge → final shortlist. |
398
+ | **Tournament** | The whole task is subjective or approach-sensitive, and comparative judgment is more reliable than absolute scoring. | Several agents attempt the same task → pairwise judges compare results → bracket reducer returns winners. |
399
+ | **Loop until done** | The amount of work is unknown up front, such as finding all failures, mining repeated issues, or iterating until checks pass. | Bounded loop with an explicit stop condition, progress ledger, per-iteration artifacts, and a max-iteration escape hatch. |
400
+
401
+ ### Pattern diagrams
402
+
403
+ #### 1. Classify-and-act
404
+
405
+ ```text
406
+ ┌─ 1 Classify-and-act ────────────────────────────────────┐
407
+ │ │
408
+ │ ┌───────┐ │
409
+ │ ╭──▸│agent A│ │
410
+ │ │ └───────┘ │
411
+ │ ┌────┐ ┌──────────┐ │ ┌───────┐ │
412
+ │ │task│─▸│classifier│───┼──▸│agent B│ ◂ chosen │
413
+ │ └────┘ └──────────┘ │ └───────┘ │
414
+ │ │ ┌───────┐ │
415
+ │ ╰──▸│agent C│ │
416
+ │ └───────┘ │
417
+ │ │
418
+ └──────────────────────────────────────────────────────────┘
419
+ ```
420
+
421
+ Best practices:
422
+ - Make the classifier return a structured category and confidence, not free-form prose.
423
+ - Keep each action branch isolated with the minimum tools and context it needs.
424
+ - Add a fallback or human-input branch for low-confidence classifications.
425
+
426
+ #### 2. Fan-out-and-synthesize
427
+
428
+ ```text
429
+ ┌─ 2 Fan-out-and-synthesize ──────────────────────────────┐
430
+ │ │
431
+ │ ┌───────┐ │
432
+ │ ╭▸│agent 1│──╮ │
433
+ │ │ └───────┘ │ │
434
+ │ │ ┌───────┐ │ │
435
+ │ ├▸│agent 2│──┤ │
436
+ │ ┌────┐ │ └───────┘ │ ┌───────┐ ┌──────────┐ │
437
+ │ │task│──┤ ┌───────┐ ├▸│barrier│─▸│synthesize│ │
438
+ │ └────┘ ├▸│agent 3│──┤ └───────┘ └──────────┘ │
439
+ │ │ └───────┘ │ │
440
+ │ │ ┌───────┐ │ │
441
+ │ ╰▸│agent 4│──╯ │
442
+ │ └───────┘ │
443
+ │ │
444
+ └──────────────────────────────────────────────────────────┘
445
+ ```
446
+
447
+ Best practices:
448
+ - Partition by files, sources, claims, candidates, or work items that can be evaluated independently.
449
+ - Save each branch to a separate artifact and pass paths with `reads` instead of inlining all branch output.
450
+ - Treat synthesis as a barrier: it waits for every branch, deduplicates, resolves conflicts, and cites evidence.
451
+
452
+ #### 3. Adversarial verification
453
+
454
+ ```text
455
+ ┌─ 3 Adversarial verification ────────────────────────────┐
456
+ │ │
457
+ │ │
458
+ │ ┌──────────┐ │
459
+ │ ├────────────────▸│verifier A│ │
460
+ │ │ └──────────┘ │
461
+ │ ┌──────┐ │ ┌──────────┐ │
462
+ │ │worker│◂────┼────────────────▸│verifier B│ │
463
+ │ └──────┘ │ └──────────┘ │
464
+ │ │ ┌──────────┐ │
465
+ │ ├────────────────▸│verifier C│ │
466
+ │ └──────────┘ │
467
+ │ │
468
+ └──────────────────────────────────────────────────────────┘
469
+ ```
470
+
471
+ Best practices:
472
+ - Give verifiers fresh context and a concrete rubric with pass/fail evidence requirements.
473
+ - Separate production from judgment to reduce self-preferential bias.
474
+ - Ask verifiers to find blockers, not to rewrite the candidate unless repair is explicitly their role.
475
+
476
+ #### 4. Generate-and-filter
477
+
478
+ ```text
479
+ ┌─ 4 Generate-and-filter ─────────────────────────────────┐
480
+ │ │
481
+ │ │
482
+ │ ┌─────┐ ┌────┐ ┌────┐ │
483
+ │ │gen A│──▸│idea│───╮ ╭──▸│best│ │
484
+ │ └─────┘ └────┘ │ │ └────┘ │
485
+ │ ┌─────┐ ┌────┐ │ ┌──────┐ │ ┌────┐ │
486
+ │ │gen B│──▸│idea│───┼─▸│filter│────┼──▸│best│ │
487
+ │ └─────┘ └────┘ │ └──────┘ │ └────┘ │
488
+ │ ┌─────┐ ┌────┐ │ │ ┌╌╌╌╌╌╌╌╌╌┐ │
489
+ │ │gen C│──▸│idea│───╯ ╰──▸╎discarded╎ │
490
+ │ └─────┘ └────┘ └╌╌╌╌╌╌╌╌╌┘ │
491
+ │ │
492
+ └──────────────────────────────────────────────────────────┘
493
+ ```
494
+
495
+ Best practices:
496
+ - Generate more candidates than you need, then filter hard by an explicit rubric.
497
+ - Dedupe before judging so near-identical candidates do not dominate the shortlist.
498
+ - Use this for exploration, naming, design options, hypotheses, and lightweight eval ideas.
499
+
500
+ #### 5. Tournament
501
+
502
+ ```text
503
+ ┌─ 5 Tournament ──────────────────────────────────────────┐
504
+ │ │
505
+ │ ┌─────────┐ │
506
+ │ │attempt A│──╮ ┌───────┐ │
507
+ │ └─────────┘ ├─▸│judge 1│───╮ │
508
+ │ ┌─────────┐ │ └───────┘ │ │
509
+ │ │attempt B│──╯ │ ┌─────┐ ┌──────┐ │
510
+ │ └─────────┘ ├──▸│final│─▸│winner│ │
511
+ │ ┌─────────┐ │ └─────┘ └──────┘ │
512
+ │ │attempt C│──╮ ┌───────┐ │ │
513
+ │ └─────────┘ ├─▸│judge 2│───╯ │
514
+ │ ┌─────────┐ │ └───────┘ │
515
+ │ │attempt D│──╯ │
516
+ │ └─────────┘ │
517
+ │ │
518
+ └──────────────────────────────────────────────────────────┘
519
+ ```
520
+
521
+ Best practices:
522
+ - Use pairwise comparison when absolute scores are noisy or subjective.
523
+ - Randomize or balance presentation order where possible to reduce order bias.
524
+ - Keep the judge rubric short and require rationale tied to observable criteria.
525
+
526
+ #### 6. Loop until done
527
+
528
+ ```text
529
+ ┌─ 6 Loop until done ─────────────────────────────────────┐
530
+ │ │
531
+ │ yes, spawn another │
532
+ │ ╭────────────────╮ │
533
+ │ ▾ │ │
534
+ │ ┌─────┐ ┌─────────────┐ no ┌────┐ │
535
+ │ │agent│─────▸│new findings?│──────▸│done│ │
536
+ │ └─────┘ └─────────────┘ └────┘ │
537
+ │ │
538
+ └──────────────────────────────────────────────────────────┘
539
+ ```
540
+
541
+ Best practices:
542
+ - Define both success and escape conditions before the loop starts.
543
+ - Keep a durable ledger of attempted work, findings, failures, and validation evidence.
544
+ - Bound loops by iterations, budget, or convergence criteria so they fail inspectably instead of drifting.
545
+
546
+ ### Choosing a starter pattern
547
+
548
+ - Pick **classify-and-act** when routing correctness matters more than breadth.
549
+ - Pick **fan-out-and-synthesize** when the work divides cleanly into independent slices.
550
+ - Pick **adversarial verification** when the main risk is a plausible but wrong answer.
551
+ - Pick **generate-and-filter** when the output quality depends on exploring a large option space.
552
+ - Pick **tournament** when multiple whole-solution strategies should compete under one rubric.
553
+ - Pick **loop until done** when the workflow should continue until evidence says it is finished, not until a preselected number of stages completes.
554
+
555
+ Record the selected pattern in your spec or workflow README, then adapt the diagram to the actual stage graph. If the final design does not resemble any starter pattern, explain why in the workflow's design notes.
556
+
385
557
  ## Atomic vs Claude Code Dynamic Workflows
386
558
 
387
559
  Claude Code Dynamic Workflows and Atomic are trying to solve a similar class of problem: important software engineering work is too large for one agent pass, so the system should split the job into stages, run agents in parallel, verify the result, and keep enough state to finish long-running work.
@@ -1438,6 +1610,7 @@ Before implementing or shipping a non-trivial workflow, answer these questions:
1438
1610
 
1439
1611
  - **Purpose and fit:** What concrete outcome should the workflow produce? Is the task naturally multi-stage, parallel, resumable, or reusable? What is out of scope?
1440
1612
  - **Inputs:** Which values should be declared as inputs? What is the narrowest schema type? Which defaults are safe?
1613
+ - **Starter pattern:** Which [workflow starter pattern](#workflow-starter-patterns) best matches the task, and where does the actual design intentionally diverge?
1441
1614
  - **Stage decomposition:** For each stage, what question does it answer, what context does it need, what output should it return, and what model/tool/MCP requirements does it have?
1442
1615
  - **Information flow:** For every edge between stages, is `previous` enough, or should the handoff use structured returns, files, `reads`, `output`, or `outputMode`?
1443
1616
  - **Output contract:** Which outputs should be declared with `.output(...)`, which stage/task/child results should `.run()` return for those keys, and what runtime type must each value have? If another workflow may call this workflow as a child, which non-default outputs should the parent rely on?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.8.24-alpha.2",
3
+ "version": "0.8.24-alpha.3",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {