@seanyao/roll 4.630.1 → 4.702.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +65 -55
  3. package/conventions/global/AGENTS.md +8 -7
  4. package/dist/roll.mjs +13277 -8746
  5. package/docs/INDEX.md +32 -0
  6. package/docs/architecture.md +444 -0
  7. package/docs/difftest-freeze-paradigm.md +113 -0
  8. package/docs/live-console.md +203 -0
  9. package/docs/manifesto.md +65 -0
  10. package/docs/migration/role-taxonomy-v4.md +60 -0
  11. package/docs/verification.md +83 -0
  12. package/guide/INDEX.md +86 -0
  13. package/guide/assets/layouts/cards-2.png +0 -0
  14. package/guide/assets/layouts/cards-3.png +0 -0
  15. package/guide/assets/layouts/cards-4.png +0 -0
  16. package/guide/assets/layouts/compare.png +0 -0
  17. package/guide/assets/layouts/highlight.png +0 -0
  18. package/guide/assets/layouts/pipeline.png +0 -0
  19. package/guide/assets/layouts/plain.png +0 -0
  20. package/guide/assets/layouts/quote.png +0 -0
  21. package/guide/assets/layouts/timeline.png +0 -0
  22. package/guide/en/acceptance-evidence.md +231 -0
  23. package/guide/en/ai-agents.md +185 -0
  24. package/guide/en/backlog-github-sync.md +108 -0
  25. package/guide/en/changelog.md +66 -0
  26. package/guide/en/configuration.md +112 -0
  27. package/guide/en/consistency.md +58 -0
  28. package/guide/en/conventions.md +113 -0
  29. package/guide/en/dream.md +121 -0
  30. package/guide/en/faq.md +855 -0
  31. package/guide/en/feedback.md +31 -0
  32. package/guide/en/getting-started.md +103 -0
  33. package/guide/en/installation.md +86 -0
  34. package/guide/en/legacy-onboarding.md +195 -0
  35. package/guide/en/loop-data-layout.md +256 -0
  36. package/guide/en/loop-driven-architecture.md +186 -0
  37. package/guide/en/loop.md +1324 -0
  38. package/guide/en/methodology.md +715 -0
  39. package/guide/en/migration-2.0.md +154 -0
  40. package/guide/en/overview.md +190 -0
  41. package/guide/en/pairing.md +151 -0
  42. package/guide/en/patterns/README.md +76 -0
  43. package/guide/en/patterns/graft-pattern.md +110 -0
  44. package/guide/en/patterns/replant-pattern.md +114 -0
  45. package/guide/en/patterns/seed-pattern.md +132 -0
  46. package/guide/en/peer.md +71 -0
  47. package/guide/en/pr-review.md +62 -0
  48. package/guide/en/practices/engineering-common-sense.md +395 -0
  49. package/guide/en/pricing.md +116 -0
  50. package/guide/en/project-setup.md +126 -0
  51. package/guide/en/roll-doc-audit.md +98 -0
  52. package/guide/en/skills.md +206 -0
  53. package/guide/en/test-isolation.md +51 -0
  54. package/guide/en/testing/quality-rubric.md +340 -0
  55. package/guide/en/testing.md +123 -0
  56. package/guide/en/tools.md +173 -0
  57. package/guide/skills.md +30 -0
  58. package/guide/zh/acceptance-evidence.md +194 -0
  59. package/guide/zh/ai-agents.md +170 -0
  60. package/guide/zh/backlog-github-sync.md +105 -0
  61. package/guide/zh/changelog.md +57 -0
  62. package/guide/zh/configuration.md +99 -0
  63. package/guide/zh/consistency.md +48 -0
  64. package/guide/zh/conventions.md +96 -0
  65. package/guide/zh/dream.md +97 -0
  66. package/guide/zh/faq.md +773 -0
  67. package/guide/zh/feedback.md +30 -0
  68. package/guide/zh/getting-started.md +96 -0
  69. package/guide/zh/installation.md +83 -0
  70. package/guide/zh/legacy-onboarding.md +192 -0
  71. package/guide/zh/loop-data-layout.md +236 -0
  72. package/guide/zh/loop-driven-architecture.md +186 -0
  73. package/guide/zh/loop.md +1124 -0
  74. package/guide/zh/methodology.md +702 -0
  75. package/guide/zh/migration-2.0.md +154 -0
  76. package/guide/zh/overview.md +186 -0
  77. package/guide/zh/pairing.md +117 -0
  78. package/guide/zh/patterns/README.md +74 -0
  79. package/guide/zh/patterns/graft-pattern.md +108 -0
  80. package/guide/zh/patterns/replant-pattern.md +112 -0
  81. package/guide/zh/patterns/seed-pattern.md +130 -0
  82. package/guide/zh/peer.md +63 -0
  83. package/guide/zh/pr-review.md +54 -0
  84. package/guide/zh/practices/engineering-common-sense.md +393 -0
  85. package/guide/zh/pricing.md +97 -0
  86. package/guide/zh/project-setup.md +114 -0
  87. package/guide/zh/roll-doc-audit.md +90 -0
  88. package/guide/zh/skills.md +191 -0
  89. package/guide/zh/test-isolation.md +46 -0
  90. package/guide/zh/testing/quality-rubric.md +284 -0
  91. package/guide/zh/testing.md +116 -0
  92. package/guide/zh/tools.md +173 -0
  93. package/package.json +4 -1
  94. package/skills/README.md +1 -0
  95. package/skills/roll-.qa/SKILL.md +1 -1
  96. package/skills/roll-.review/SKILL.md +1 -1
  97. package/skills/roll-build/SKILL.md +1 -1
  98. package/skills/roll-build/references/full-contract.md +16 -13
  99. package/skills/roll-design/SKILL.md +3 -3
  100. package/skills/roll-design/references/full-contract.md +17 -13
  101. package/skills/roll-fix/SKILL.md +1 -1
  102. package/skills/roll-fix/references/full-contract.md +13 -10
  103. package/skills/roll-peer/SKILL.md +1 -1
  104. package/skills/roll-prime/SKILL.md +77 -0
  105. package/skills/roll-prime/references/explorer-annex.md +39 -0
  106. package/skills/roll-prime/references/supervisor-prompt.md +165 -0
  107. package/skills/route-cases/skills.json +10 -0
  108. package/template/AGENTS.md +3 -1
@@ -0,0 +1,186 @@
1
+ # Loop-Driven Agent Architecture
2
+
3
+ > Why Roll uses independent loops instead of DAG-based multi-agent orchestration — and what that means for building reliable AI software delivery systems.
4
+
5
+ ---
6
+
7
+ ## The Mainstream Approach: DAG + Orchestration
8
+
9
+ Most AI agent frameworks today follow a similar pattern. A design step decomposes a goal into a directed acyclic graph (DAG) of subtasks, assigns each node to a specialized agent, and an orchestrator drives execution in dependency order:
10
+
11
+ ```
12
+ Goal: "Implement feature X"
13
+
14
+ Design step
15
+
16
+ ┌────┴────┐
17
+ Agent A Agent B ← parallel
18
+ │ │
19
+ └────┬────┘
20
+ Agent C ← depends on A + B
21
+
22
+ Output
23
+ ```
24
+
25
+ This model maps cleanly to how humans think about project management. It's easy to visualize, easy to explain, and works well in demos. Frameworks like LangGraph, AutoGen, and CrewAI have popularized it.
26
+
27
+ **Where it struggles:**
28
+
29
+ - **Brittleness**: If Agent B fails halfway, the whole graph stalls. Recovery logic is hard to write and harder to test.
30
+ - **Upfront omniscience**: Building the DAG requires knowing all dependencies before execution begins. Real software development doesn't work that way — you discover constraints as you go.
31
+ - **Synchronous coupling**: All agents must be available simultaneously. A slow agent blocks the pipeline.
32
+ - **Opaque state**: The execution state lives inside the orchestrator. When things go wrong, the trace is an abstract graph — not something a human can inspect and reason about.
33
+
34
+ These problems don't matter much for one-shot tasks ("summarize this document", "generate this report"). They matter a lot for **continuous software delivery**, where work is ongoing, requirements evolve, and humans need to stay in the loop.
35
+
36
+ ---
37
+
38
+ ## Roll's Approach: Independent Loops as Daemons
39
+
40
+ Roll coordinates AI agents differently. Instead of a central planner and a shared execution graph, Roll uses **independent loops** — each a simple daemon with one job, running at its own cadence, reading from and writing to shared artifacts.
41
+
42
+ ```
43
+ BACKLOG ←──────── shared state ────────→ git / PRs / alerts
44
+
45
+ ┌───────┼────────┬──────────┐
46
+ ▼ ▼ ▼ ▼
47
+ main loop PR loop dream brief
48
+ 30min 5min daily daily
49
+ deliver heal + scan digest
50
+ stories rebase + code
51
+ merge
52
+ ```
53
+
54
+ Each loop:
55
+ 1. **Polls** a specific artifact (BACKLOG, open PRs, alert file)
56
+ 2. **Acts** on what it finds (write code, heal CI, merge)
57
+ 3. **Writes back** to shared artifacts (commits, PR comments, BACKLOG updates)
58
+ 4. **Sleeps** until next interval
59
+
60
+ Loops never call each other directly. They coordinate entirely through artifacts.
61
+
62
+ ---
63
+
64
+ ## This Is Choreography, Not Orchestration
65
+
66
+ The distinction matters. In **orchestration**, a central authority tells each participant what to do and when. In **choreography**, each participant knows its own job and reacts to events in the shared environment.
67
+
68
+ | | Orchestration (DAG) | Choreography (Loop) |
69
+ |--|--|--|
70
+ | Coordination | Central design step | Shared artifacts |
71
+ | Failure domain | Whole graph | Single loop |
72
+ | State location | Orchestrator memory | git + BACKLOG + PRs |
73
+ | Human visibility | Abstract task graph | `git log`, PR list |
74
+ | Human intervention | Hard — must interrupt the graph owner | Easy — edit BACKLOG |
75
+ | Agent availability | All must be online simultaneously | Each runs independently |
76
+
77
+ Choreography is the pattern behind Unix pipelines, microservices event buses, and distributed databases. Roll applies it to AI software delivery.
78
+
79
+ ---
80
+
81
+ ## What This Looks Like in Practice
82
+
83
+ **DAG approach** — "Add a new agent":
84
+
85
+ ```
86
+ Design step decomposes:
87
+ → Agent 1: edit the CLI dispatch
88
+ → Agent 2: update docs (EN)
89
+ → Agent 3: update docs (ZH) ← depends on Agent 2
90
+ → Agent 4: write tests
91
+ → Agent 5: verify CI ← depends on 1–4
92
+ → Orchestrator: open PR
93
+ ```
94
+
95
+ If Agent 3 times out, Agents 4 and 5 wait. The orchestrator must decide: retry? skip? fail?
96
+
97
+ **Loop approach** — same task:
98
+
99
+ ```
100
+ main loop fires:
101
+ → reads BACKLOG → picks "US-AI-004: add a new agent"
102
+ → writes code in TCR micro-steps (each step: test → commit or revert)
103
+ → opens PR
104
+
105
+ PR loop fires (5 min later):
106
+ → sees PR is open, CI still running → skips
107
+
108
+ PR loop fires again (5 min later):
109
+ → CI green, mergeable → merges PR → done
110
+ ```
111
+
112
+ No orchestrator. No dependency graph. Each loop does its job when the time is right.
113
+
114
+ ---
115
+
116
+ ## Why Loops Are Better for Continuous Delivery
117
+
118
+ Software delivery is not a one-shot task. It is an ongoing process:
119
+
120
+ - New stories appear in BACKLOG
121
+ - Bugs surface in production
122
+ - Dependencies go stale
123
+ - CI gets slower
124
+ - PRs accumulate
125
+
126
+ A DAG is designed to execute once and terminate. A loop is designed to run forever, doing useful work whenever conditions are right. For continuous delivery, you want loops.
127
+
128
+ **Resilience**: Loops are isolated. If the CI loop crashes, PRs still get reviewed. If the main delivery loop is blocked on a conflict, the PR loop still merges other ready PRs.
129
+
130
+ **Observability**: Every action a loop takes produces a git commit, a PR comment, or a BACKLOG update. The history of the system is the git log — human-readable, diffable, revertable.
131
+
132
+ **Human control**: Want to pause delivery? Set a flag in BACKLOG. Want to prioritize a story? Edit the backlog priority. Want to stop a loop? Remove the launchd plist. No need to interrupt a running orchestrator or cancel a mid-flight agent chain.
133
+
134
+ **Incremental correctness**: TCR (Test-Commit-Revert) ensures every micro-step either advances the codebase to a green state or reverts cleanly. The loop never leaves the repository in a broken state between cycles.
135
+
136
+ ---
137
+
138
+ ## The Specialized Loop Architecture
139
+
140
+ As the system matures, loops become more specialized:
141
+
142
+ | Loop | Cadence | Does |
143
+ |------|---------|------|
144
+ | **main loop** | 30 min | Reads BACKLOG → writes code → opens PR |
145
+ | **PR loop** | 5 min | Merges green PRs, closes stale ones, rebases behind ones |
146
+ | **CI loop** | 5 min | Detects flaky tests, collects timing data, reruns failures |
147
+ | **alert loop** | 1 min | Aggregates `_LOOP_ALERT` entries, sends notifications |
148
+ | **bug loop** | 1 hour | Scans logs and error patterns, opens FIX stories |
149
+ | **dep loop** | 1 day | Checks outdated deps and CVEs, opens upgrade stories |
150
+ | **doc loop** | 1 day | Detects code/doc drift, opens docs PRs |
151
+ | **dream loop** | nightly | Reflects on recent work, refines BACKLOG priorities |
152
+
153
+ Each loop reads and writes only its own domain. The coordination between them is entirely emergent — no loop knows the others exist.
154
+
155
+ ---
156
+
157
+ ## Trade-offs: When to Use Each Approach
158
+
159
+ Roll's architecture is not universally superior. Choose based on your problem:
160
+
161
+ **Use DAG/orchestration when:**
162
+ - The task has a well-defined, finite scope ("build this service from scratch")
163
+ - All dependencies are knowable upfront
164
+ - You need tight sequential control (output of step N is exact input to step N+1)
165
+ - The task runs once and terminates
166
+
167
+ **Use loop/choreography when:**
168
+ - Work is continuous and ongoing (software delivery, monitoring, maintenance)
169
+ - Dependencies are discovered at runtime
170
+ - Resilience matters more than tight coupling
171
+ - Humans need to observe and intervene
172
+ - The "system" should keep running even when individual components fail
173
+
174
+ Most real software delivery systems are the second kind. That's why Roll is built on loops.
175
+
176
+ ---
177
+
178
+ ## The Deeper Insight
179
+
180
+ The DAG model assumes that intelligence lives in the planner — the agent that decomposes the goal. The loop model assumes that intelligence is distributed — each loop knows its domain deeply and acts autonomously.
181
+
182
+ In practice, "plan everything upfront" breaks down as soon as reality diverges from the plan. Loops don't have a plan to diverge from. They observe the current state of the world (BACKLOG, open PRs, CI status) and act accordingly. If a PR conflicts, the loop rebases it. If CI is red, the loop reruns. If a story is blocked, the loop skips it and takes the next one.
183
+
184
+ This is closer to how experienced engineers actually work: not by executing a pre-committed plan, but by continuously scanning the environment, doing the highest-value available action, and leaving everything in a clean state.
185
+
186
+ Roll encodes that behavior as loops.