runward 0.6.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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +13 -0
  3. package/README.md +128 -0
  4. package/dist/cli.js +76 -0
  5. package/dist/commands/check.js +50 -0
  6. package/dist/commands/doctor.js +75 -0
  7. package/dist/commands/init.js +90 -0
  8. package/dist/commands/status.js +49 -0
  9. package/dist/commands/update.js +48 -0
  10. package/dist/lib/constants.js +2 -0
  11. package/dist/lib/mission.js +96 -0
  12. package/dist/lib/paths.js +28 -0
  13. package/dist/lib/styles.js +60 -0
  14. package/dist/lib/tools.js +59 -0
  15. package/dist/lib/write.js +30 -0
  16. package/package.json +29 -0
  17. package/templates/mission/adr/ADR-0000-template.md +38 -0
  18. package/templates/mission/architecture.md +60 -0
  19. package/templates/mission/decision-matrix.md +37 -0
  20. package/templates/mission/evaluation-rubric.md +60 -0
  21. package/templates/mission/floor.md +47 -0
  22. package/templates/mission/framing.md +58 -0
  23. package/templates/mission/mission-contract.md +58 -0
  24. package/templates/mission/observability-schema.md +53 -0
  25. package/templates/mission/port-contract.md +63 -0
  26. package/templates/mission/reference-stack.md +70 -0
  27. package/templates/mission/runbook.md +70 -0
  28. package/templates/mission/shared-bricks.md +74 -0
  29. package/templates/mission/threat-model.md +53 -0
  30. package/templates/rules/async-job-guardrails.md +95 -0
  31. package/templates/rules/async-post-turn-pipeline.md +96 -0
  32. package/templates/rules/async-scheduled-maintenance.md +95 -0
  33. package/templates/rules/cache-three-tier-architecture.md +44 -0
  34. package/templates/rules/checklist-day-zero-project.md +97 -0
  35. package/templates/rules/checklist-pre-production-observability.md +99 -0
  36. package/templates/rules/checklist-pre-production-performance.md +109 -0
  37. package/templates/rules/checklist-pre-production-resilience.md +99 -0
  38. package/templates/rules/checklist-pre-production-security.md +86 -0
  39. package/templates/rules/config-secrets-boundary.md +57 -0
  40. package/templates/rules/config-typing-zod.md +78 -0
  41. package/templates/rules/contracts-governance.md +64 -0
  42. package/templates/rules/data-memory-consolidation.md +81 -0
  43. package/templates/rules/data-memory-invalidation.md +90 -0
  44. package/templates/rules/data-memory-scoring.md +154 -0
  45. package/templates/rules/data-migrations-forward-only.md +55 -0
  46. package/templates/rules/data-orphan-cleanup.md +142 -0
  47. package/templates/rules/data-ttl-types.md +100 -0
  48. package/templates/rules/eval-loop.md +52 -0
  49. package/templates/rules/frontier-deterministic-boundary.md +91 -0
  50. package/templates/rules/hexa-adapter-pattern.md +85 -0
  51. package/templates/rules/hexa-architecture.md +84 -0
  52. package/templates/rules/hexa-move-deterministic-out.md +93 -0
  53. package/templates/rules/hexa-recommended-stack.md +33 -0
  54. package/templates/rules/hexa-typescript-native.md +80 -0
  55. package/templates/rules/observability-alert-configuration.md +160 -0
  56. package/templates/rules/observability-llm-metrics.md +150 -0
  57. package/templates/rules/observability-startup-provider-log.md +128 -0
  58. package/templates/rules/observability-structured-json-logs.md +138 -0
  59. package/templates/rules/patterns-memory-router-tiered.md +139 -0
  60. package/templates/rules/patterns-prompt-compiler.md +126 -0
  61. package/templates/rules/patterns-request-id-propagation.md +137 -0
  62. package/templates/rules/process-adr-and-journal.md +50 -0
  63. package/templates/rules/provider-llm-auto-detection.md +54 -0
  64. package/templates/rules/provider-no-crash-missing-env.md +67 -0
  65. package/templates/rules/quality-codebase-metrics.md +115 -0
  66. package/templates/rules/quality-zod-input-validation.md +131 -0
  67. package/templates/rules/resilience-fail-open.md +65 -0
  68. package/templates/rules/resilience-multi-provider-fallback.md +100 -0
  69. package/templates/rules/resilience-retry-backoff.md +115 -0
  70. package/templates/rules/resilience-retryable-errors.md +107 -0
  71. package/templates/rules/routing-confidence-upgrade.md +89 -0
  72. package/templates/rules/routing-model-cost-ratios.md +68 -0
  73. package/templates/rules/routing-smart-complexity.md +131 -0
  74. package/templates/rules/scaling-db-connection-pooling.md +121 -0
  75. package/templates/rules/scaling-distributed-rate-limiting.md +141 -0
  76. package/templates/rules/scaling-state-externalization.md +84 -0
  77. package/templates/rules/security-prompt-injection.md +63 -0
  78. package/templates/rules/state-event-sourcing.md +66 -0
  79. package/templates/rules/tools-registry-pattern.md +153 -0
  80. package/templates/rules/tools-scope-atomicity.md +103 -0
  81. package/templates/targets/AGENTS.md +32 -0
  82. package/templates/workflows/architect.md +50 -0
  83. package/templates/workflows/brownfield.md +52 -0
  84. package/templates/workflows/decision-loop.md +52 -0
  85. package/templates/workflows/floor.md +60 -0
  86. package/templates/workflows/frame.md +69 -0
  87. package/templates/workflows/govern.md +55 -0
  88. package/templates/workflows/handover.md +55 -0
  89. package/templates/workflows/iterate.md +52 -0
  90. package/templates/workflows/method.md +53 -0
  91. package/templates/workflows/review.md +59 -0
@@ -0,0 +1,55 @@
1
+ # Handover — Leave Autonomy, Not Dependency
2
+
3
+ ## When to use
4
+
5
+ Use this workflow when a delivery approaches its end or a team must become self-sufficient: "how do we hand this off?", "we need to document for the team", "how do they run this without us?". This is phase 6 of `method`. What the operator leaves behind counts as much as what was delivered: a deliverable that creates lasting dependency on its author is a failure of this phase.
6
+
7
+ ## Inputs
8
+
9
+ - The artifacts of prior phases: architecture note, floor, ADR journal, threat model, evaluation rubric, observability schema.
10
+ - A receiving team with time allocated for transfer sessions.
11
+ - The `mission/runbook.md` template.
12
+
13
+ ## Outputs
14
+
15
+ - A handover kit (below).
16
+ - A demonstrated proof of autonomy.
17
+
18
+ ## Procedure
19
+
20
+ **Enforce the entry rule.** You transfer autonomy, not documents. Handover is not a folder delivered; it is proven by the team repeating a task alone. Until that proof exists, this phase is open.
21
+
22
+ **Assemble the handover kit.** Five components:
23
+
24
+ 1. **Reusable assets.** The populated scaffold, the adapters, the versioned contract schemas, the evaluation sets. Things that replay and get reused, not just things that get read.
25
+ 2. **The architecture note.** Boundaries, ports, integration protocol, the named target, and the default topology with its triggers. The map that says why the system is shaped this way.
26
+ 3. **The ADR journal.** Every structuring decision locked in Context / Decision / Consequences form, with the discarded alternative and the reevaluation trigger. The team learns not only what was decided, but under which signal to reopen it.
27
+ 4. **The operations runbook.** How to start, observe, debug, resume from a checkpoint, switch a model provider, rerun the evaluation bench, process a suspended approval. Operating gestures, not theory. Use `mission/runbook.md`.
28
+ 5. **Proof in the code.** Unit and contract tests, evaluation scenarios, replayable traces — the demonstration that the principles are not speculative; they live in the code.
29
+
30
+ **Run the transfer, don't just deliver it.**
31
+
32
+ 1. **Transfer sessions.** Walk the team through the architecture, the decisions, and the runbook — hands on the keyboard, not eyes on slides. Make them operate, not watch.
33
+ 2. **Readable notes.** Short, decided, accessible to whoever inherits the system.
34
+ 3. **Progressive withdrawal.** The team repeats a task first with you present, then alone. Step back as autonomy is proven, not on a calendar date.
35
+
36
+ **Capitalize upward.** What repeats deserves standardizing. Escalate recurring patterns to whoever can industrialize them: an evolution trigger observed several times, an adapter rewritten identically across missions, a recurring guardrail. Feed proven arbitrations back into the decision matrix and the workflow files — the corpus hardens mission after mission. What gets capitalized is never the prototype (replaceable); it is the architecture and the method (owned).
37
+
38
+ **Verify the Definition of Done explicitly.** The phase is done when the receiving team redoes a task alone, end to end, demonstrated — a sign-off or a training session does not count. The team, without you: starts the system, observes it, debugs an incident, adds an evaluation scenario, and decides a switch by leaning on the ADRs. All of it demonstrated, not promised.
39
+
40
+ ## Definition of Done
41
+
42
+ - Handover kit complete: assets, architecture note, ADR journal, runbook, proof in code.
43
+ - Transfer sessions held with the team operating, not observing.
44
+ - The team has repeated at least one real task end to end, alone — demonstrated, witnessed, recorded.
45
+ - Recurring patterns escalated and fed back into the framework's templates.
46
+ - Deliverable form matched: presented notes carry an expected delivery form (a readable PDF or HTML); ADR journal, runbook and code proofs stay as repository markdown.
47
+
48
+ ## Anti-patterns
49
+
50
+ - Creating lasting dependency on the operator — if the team can do nothing without them, handover failed.
51
+ - Handing over only the prototype: the prototype is replaceable; the architecture and method are what transfer.
52
+ - Delivering a document without walking it through — a note handed over is not a skill transferred.
53
+ - Closing the phase on a signed deliverable instead of a task repeated alone.
54
+ - Keeping recurring patterns to yourself instead of feeding them back.
55
+ - Padding the kit with theory the team will never operate from — runbooks carry gestures, not lectures.
@@ -0,0 +1,52 @@
1
+ # Iterate — Add Complexity Only on Proof
2
+
3
+ ## When to use
4
+
5
+ Use this workflow once a floor is running and an evolution is on the table: "do we go multi-agent?", "should we extract this service?", "do we raise the model tier?", "do we add long-term memory?", "how do we scale?". This is phase 4 of `method`. Every switch has a lean default and a signal that commands the change; every evolution is guarded by a boundary and traced in an ADR.
6
+
7
+ ## Inputs
8
+
9
+ - A proven floor: value measured against the success criterion.
10
+ - Real traffic over time — the source of trigger signals.
11
+ - The decision matrix below; the ADR template in `mission/adr/`.
12
+
13
+ ## Outputs
14
+
15
+ - Evolutions shipped one tier at a time, each behind its boundary.
16
+ - One locked ADR per switch, with the reevaluation trigger.
17
+
18
+ ## Procedure
19
+
20
+ **Enforce the entry rule.** No evolution without a signal. "Because it's better", "because it's more modern", "because we'll need it" are refused. Name the default in place, name the trigger, switch only when the trigger is observed on real traffic.
21
+
22
+ **Arbitrate with the decision matrix.** Apply the default, watch the signal, switch on proof.
23
+
24
+ - **Extract a component into a service.** Default: modular hexagonal monolith. Triggers: one instance no longer holds the load; a component has a sharply different load or cost profile; it needs its own release cycle; isolation is required for resilience or security; high availability is demanded. Boundaries being set, extraction is a local operation, not a rework.
25
+ - **Add an agent.** Default: one orchestrator directing specialists. Trigger: genuinely independent, parallelizable subtasks — not sequential reasoning in disguise. Distributed multi-agent wins on parallelizable work and degrades sequential reasoning; give it the same caution as microservices.
26
+ - **Change the model tier.** Default: one balanced tier, routing by estimated complexity. Trigger up: a task whose measured quality demands it. Trigger down: a deterministic task routed to a cheaper tier. In doubt, go one tier up rather than risk a wrong answer.
27
+ - **Cross the process boundary.** Default: as late as possible. Crossing changes semantics: an atomic local access becomes a network call, and three real costs are assumed — eventual consistency instead of strong; compensation steps instead of a single transaction; explicit causal ordering and idempotence under concurrency. That is the entry price of distribution — pay it only on trigger, knowingly.
28
+ - **Introduce elaborate memory.** Default: explicit per-turn context, minimal retrieval. Trigger: a measured, not anticipated, need for continuity beyond the session. Then compose role-specific stores behind ports, with deterministic staged retrieval, value scoring, invalidation rather than deletion, and heavy work moved out of the interactive turn.
29
+ - **Externalize state for multi-instance.** Default: in-memory structures, single instance. Trigger: replication (load, availability) or shared state. The shared store that unlocks multi-instance then hosts, at once, the externalized state, the capability discovery registry, and the budget allocation registry.
30
+ - **Go asynchronous.** Default: synchronous work inside the turn. Trigger: costly operations that must not keep the user waiting (fact extraction, consolidation, summaries) move to background jobs fired after the turn.
31
+
32
+ **Guard and trace every switch.**
33
+
34
+ 1. **Lock the decision in an ADR before implementing.** Run `decision-loop`: reality-check, sourced state of the art, challenge, durable position, written lock. No lock, no code.
35
+ 2. **Keep the evolution behind a boundary.** An extraction goes through the port already in place; a new agent through the registry; a tier change through the model gateway. The domain does not change; only the adapter and the topology do. Nothing here is irreversible, because everything is decided behind a boundary.
36
+ 3. **Prove the gain after the switch.** Load holds, latency drops, quality rises, cost stays controlled. If the gain is not there, roll back — the boundary makes rollback possible.
37
+
38
+ ## Definition of Done
39
+
40
+ - Every shipped evolution maps to an observed trigger or a measured gain.
41
+ - One locked ADR per switch, including the rollback signal.
42
+ - The domain untouched; only adapters and topology moved.
43
+ - Post-switch measurement recorded; rollbacks executed where the gain failed.
44
+
45
+ ## Anti-patterns
46
+
47
+ - Complexifying on principle: memory, multi-agent, or distribution "because serious systems have them".
48
+ - Crossing a gate without proof from the previous tier.
49
+ - Dressing sequential reasoning up as parallelism to justify multi-agent.
50
+ - Paying the distributed-systems entry price blindly — eventual consistency, compensation, causal ordering are the fee, not a footnote.
51
+ - Implementing before the ADR is locked.
52
+ - Switching without a rollback path.
@@ -0,0 +1,53 @@
1
+ # Method — Orchestrate the Six Phases
2
+
3
+ ## When to use
4
+
5
+ Use this workflow whenever an agentic-system mission needs to be planned, advanced, or unblocked: "where do we start?", "what do we do next?", "are we ready for the next step?". This is the conductor. It sequences six gated phases and delegates the detail of each to its dedicated workflow (`frame`, `architect`, `floor`, `iterate`, `govern`, `handover`, plus `brownfield` for non-greenfield entries). Every design decision inside any phase runs through `decision-loop`; every document that matters runs through `review`.
6
+
7
+ ## Inputs
8
+
9
+ - A sponsor with a real business problem.
10
+ - Access to the process the system will serve.
11
+ - The workflow files of this framework.
12
+
13
+ ## Procedure
14
+
15
+ **Hold the posture before any phase.** Three rules outrank every tooling preference. Mentor as much as engineer — listening outranks solving: understand the process as it actually runs, not as it is described. Prove with a running system, not a deck. Decide architecture before models: the model and the infrastructure are adapter choices, reversible, made behind stable ports. The founding inversion underneath — the LLM Boundary Principle: the architecture constrains the model, never the reverse — opens the method; what carries it is the six phases, the **five architecture gestures** — boundaries before stack; isolate by contract and complexify on proof; take determinism out of the model; keep state explicit and memory governed; govern, trace and evaluate from day zero — and the decision matrix. These architecture gestures shape the system, and are not to be confused with the opening moves that start the mission (below).
16
+
17
+ **Open the chain with four opening moves, in order, with the sponsor** — the mission's opening ritual, distinct from the five architecture gestures above. Together with show-before-you-build, they form four opening moves plus a standing show-before-you-build discipline.
18
+
19
+ 1. **Establish the entry mode.** Greenfield runs the chain below from the top. Anything else — resuming your own mission, joining a project in flight, auditing then rebuilding, or deriving a new system from an old one — goes through `brownfield` first, which reconstructs what is missing and re-enters the chain at the right phase. Never start on an existing system by instinct.
20
+ 2. **Establish the stopping tier.** How far does this engagement go: framing only, an executable floor, or the full chain through handover? Present each tier with what it produces and what it demands. The sponsor decides. Never pick the stopping point for them.
21
+ 3. **Derive the required inputs.** For framing: process access and an observable success criterion. For a proven floor: add real model access, real inputs, and a hook into existing infrastructure. For iteration and governance: sustained real traffic, traces, ground truth. For handover: a team to receive.
22
+ 4. **Challenge the gaps.** A missing input does not automatically block the start; it becomes a named risk, owned by the sponsor, and usually the first object of discovery. Say it out loud — never route around it silently.
23
+
24
+ **Show before you build.** The standing companion to the four opening moves — repeated at every major gate, not a one-time step. Before committing work, show the sponsor a concrete preview of what they will receive: a sample deliverable, the artifact plan per phase, and — when the entry point is a user interface — an openable, working HTML first cut rather than a static mockup, functional even in deterministic mode. Repeat the preview at every major gate so the sponsor decides with open eyes.
25
+
26
+ **Run the six phases, each behind a gate.**
27
+
28
+ 1. **Frame.** Light immersion in the real process. Output: the floor/target split and an observable success criterion. Delegate to `frame`.
29
+ 2. **Architect.** Boundaries before stack: domain ports, model port, integration protocol. Language and topology stay open. Delegate to `architect`.
30
+ 3. **Floor.** The smallest system that proves value on real traffic: one orchestrator, a model port, persistence, guardrails, baseline observability. Delegate to `floor`.
31
+ 4. **Iterate.** Add complexity only on an objective trigger or a measured gain, one ADR per switch. Delegate to `iterate`.
32
+ 5. **Govern.** Transversal, wired from day zero: single middleware chain, cost ceilings, human approval on sensitive actions, continuous evaluation. Delegate to `govern`.
33
+ 6. **Handover.** Leave autonomy, not dependency. Done when the team repeats a task alone. Delegate to `handover`.
34
+
35
+ **Enforce the gate rule.** No phase closes without its prescribed artifact, and no gate is crossed without proof from the phase before it — value measured against the success criterion. Any deviation is stated explicitly and agreed with the sponsor, never assumed.
36
+
37
+ **Match each deliverable to its form.** What is presented to a committee has an expected delivery form (a readable PDF or HTML); what is maintained stays as repository markdown, versioned with the code.
38
+
39
+ ## Definition of Done
40
+
41
+ - Entry mode and stopping tier chosen explicitly by the sponsor, gaps named as owned risks.
42
+ - A concrete preview shown before build and at each major gate.
43
+ - Each phase closed with its artifact, or the deviation recorded and agreed.
44
+ - No gate crossed without measured proof from the previous phase.
45
+
46
+ ## Anti-patterns
47
+
48
+ - Starting with "which framework?" — that question belongs to an adapter decision, after boundaries. Return to phase 1.
49
+ - Choosing the entry point or the stopping tier on the sponsor's behalf.
50
+ - Building the full target in one block "to be serious about agents".
51
+ - Deferring governance to a later phase; retrofitting always costs more.
52
+ - Delivering a recommendation document instead of a running system.
53
+ - Leaving the sponsor blind until delivery instead of showing before building.
@@ -0,0 +1,59 @@
1
+ # Review — Expert Panel for Architecture Documents
2
+
3
+ ## When to use
4
+
5
+ Use this workflow to judge the technical soundness, internal consistency, and editorial quality of an architecture document for agentic systems — an architecture note, design note, RFC, spec, or whitepaper: "does this section hold?", "what would an architect say?", "is this state of the art?". This workflow provides the eyes; `decision-loop` provides the method. Pair them. Review is strictly read-only: the panel criticizes, it never rewrites without validation.
6
+
7
+ ## Inputs
8
+
9
+ - The document under review.
10
+ - Its intended audience (tech leads, engineering managers, CTOs, staff architects).
11
+ - Any house editorial rules to enforce.
12
+
13
+ ## Outputs
14
+
15
+ - Graded verdicts — blocking / important / minor — each with problem, evidence, and proposed fix.
16
+ - A whole-document consistency pass.
17
+
18
+ ## Procedure
19
+
20
+ **Calibrate the register first.** Such a document is usually neither an ML research paper, nor product documentation, nor code. It is applied software architecture for agentic systems, crossing five domains: software engineering (hexagonal, light DDD, event sourcing, evolutionary architecture, cost/reversibility reasoning); distributed systems (explicit state, scaling, consistency, resilience); applied LLM engineering (agent loop, tool use, model boundary, tier routing, memory and context, integration protocols); MLOps and evaluation (continuous evaluation, judge models and their biases, observability, drift, closed loops); governance and security (least privilege, human in the loop, fail-closed, data sovereignty, auditability). Review it with an architect's breadth, sharpened by specialist angles.
21
+
22
+ **Adopt one Principal Architect wearing five hats** — distributed systems; LLMOps and production ML; memory and retrieval; security and regulated sectors; editorial coherence. Global mandate: uncompromising, strictly factual, zero complacency. Flag overclaims, blind spots, stale state of the art, cross-section inconsistencies, and anything that would not survive an architecture committee in a regulated sector.
23
+
24
+ 1. **Senior distributed-systems engineer.** Judges event sourcing, state externalization and projection, budget leases, service discovery, consistency, resilience, idempotence. Catches scaling naivety.
25
+ 2. **LLM platform engineer.** Judges evaluation (judge models, online evaluation, drift, Goodhart effects), observability, tier routing, cost, and the dangers of feedback loops — especially systems that rewrite themselves.
26
+ 3. **Applied research engineer in agent memory** (hardened by default). Judges bi-temporal memory, graph retrieval, decay and consolidation, context engineering, abstention, fact-conflict resolution.
27
+ 4. **Security and data-governance architect for regulated sectors** (hardened by default). Judges fail-closed behavior, human supervision, erasure and sovereignty, auditability, prompt injection, the lethal trifecta, untrusted inputs.
28
+ 5. **Technical editor of reference-grade material.** Judges structure, register, naming consistency, repetition, reading rhythm — with the same factual rigor. Enforces documentation-mode separation: do not mix tutorial, how-to, reference, and explanation in one section; an architecture note is explanation and reference, not tutorial.
29
+
30
+ Rotate the hats one at a time over the same text, then reconcile their verdicts: a multi-persona pass aligns better with expert judgment than a single reviewer. Harden another angle on request.
31
+
32
+ **Apply the six-criterion grid to every section.**
33
+
34
+ 1. Technical accuracy and state of the art — exact, current, defensible with sources in hand?
35
+ 2. Internal consistency — do cross-references hold (topology vs. async vs. evaluation; memory vs. state; decomposition vs. state)?
36
+ 3. Terminological precision — patterns named correctly, protocols described by function, vocabulary stable?
37
+ 4. Remaining overclaims and blind spots.
38
+ 5. Readability for the target audience.
39
+ 6. Compliance with the house editorial rules.
40
+
41
+ **Neutralize known reviewer biases.** Self-preference: review generated-looking text with extra severity. Verbosity: longer is not better. Position and centrality: vary hat order between passes; prefer a binary holds / does not hold per criterion over a fuzzy scale. Separate substance from style: hats 1–4 judge correctness, hat 5 judges form.
42
+
43
+ **Deliver graded verdicts.** For each finding: severity (blocking / important / minor), the problem, the evidence, the proposed fix. Discrete verdicts beat continuous scores — wide scales bias toward the center. Finish with a whole-document consistency pass, not only section-by-section. For any finding that demands a real design decision, hand off to `decision-loop` before anything is written into the document.
44
+
45
+ ## Definition of Done
46
+
47
+ - Every section passed through all five hats and the six criteria.
48
+ - Verdicts graded, each with problem, evidence, and fix.
49
+ - A whole-document consistency pass completed.
50
+ - Design-level findings routed to `decision-loop`; no edits made without validation.
51
+
52
+ ## Anti-patterns
53
+
54
+ - Rewriting the document during review — the panel is read-only.
55
+ - Scoring on a continuous scale instead of discrete verdicts.
56
+ - Judging style and substance in one breath.
57
+ - Skipping the whole-document pass and reviewing only locally.
58
+ - Rewarding length or polish over correctness.
59
+ - Softening verdicts because the author is in the room.