pi-agent-flow 2.0.1 → 2.0.5

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 (233) hide show
  1. package/README.md +126 -489
  2. package/agents/audit.md +24 -15
  3. package/agents/build.md +4 -3
  4. package/agents/craft.md +4 -4
  5. package/agents/debug.md +5 -4
  6. package/agents/ideas.md +6 -5
  7. package/agents/scout.md +10 -8
  8. package/agents/trace.md +23 -0
  9. package/dist/batch/apply-patch.d.ts +60 -0
  10. package/dist/batch/apply-patch.d.ts.map +1 -0
  11. package/dist/batch/apply-patch.js +477 -0
  12. package/dist/batch/apply-patch.js.map +1 -0
  13. package/dist/batch/batch-bash.d.ts +10 -6
  14. package/dist/batch/batch-bash.d.ts.map +1 -1
  15. package/dist/batch/batch-bash.js +59 -11
  16. package/dist/batch/batch-bash.js.map +1 -1
  17. package/dist/batch/constants.d.ts +38 -6
  18. package/dist/batch/constants.d.ts.map +1 -1
  19. package/dist/batch/constants.js +26 -4
  20. package/dist/batch/constants.js.map +1 -1
  21. package/dist/batch/execute.d.ts +8 -2
  22. package/dist/batch/execute.d.ts.map +1 -1
  23. package/dist/batch/execute.js +222 -67
  24. package/dist/batch/execute.js.map +1 -1
  25. package/dist/batch/fuzzy-edit.d.ts +4 -1
  26. package/dist/batch/fuzzy-edit.d.ts.map +1 -1
  27. package/dist/batch/fuzzy-edit.js +7 -2
  28. package/dist/batch/fuzzy-edit.js.map +1 -1
  29. package/dist/batch/index.d.ts +10 -24
  30. package/dist/batch/index.d.ts.map +1 -1
  31. package/dist/batch/index.js +120 -120
  32. package/dist/batch/index.js.map +1 -1
  33. package/dist/batch/render.d.ts +22 -5
  34. package/dist/batch/render.d.ts.map +1 -1
  35. package/dist/batch/render.js +353 -15
  36. package/dist/batch/render.js.map +1 -1
  37. package/dist/batch/summary.d.ts.map +1 -1
  38. package/dist/batch/summary.js +26 -4
  39. package/dist/batch/summary.js.map +1 -1
  40. package/dist/config/config.d.ts +5 -4
  41. package/dist/config/config.d.ts.map +1 -1
  42. package/dist/config/config.js +15 -5
  43. package/dist/config/config.js.map +1 -1
  44. package/dist/config/models.d.ts.map +1 -1
  45. package/dist/config/models.js +7 -1
  46. package/dist/config/models.js.map +1 -1
  47. package/dist/config/settings-resolver.d.ts +5 -4
  48. package/dist/config/settings-resolver.d.ts.map +1 -1
  49. package/dist/config/settings-resolver.js +50 -21
  50. package/dist/config/settings-resolver.js.map +1 -1
  51. package/dist/core2/snapshot.d.ts +21 -0
  52. package/dist/core2/snapshot.d.ts.map +1 -0
  53. package/dist/core2/snapshot.js +214 -0
  54. package/dist/core2/snapshot.js.map +1 -0
  55. package/dist/{core → flow}/agents.d.ts.map +1 -1
  56. package/dist/{core → flow}/agents.js +5 -2
  57. package/dist/{core → flow}/agents.js.map +1 -1
  58. package/dist/flow/auto-warp.d.ts +1 -1
  59. package/dist/flow/auto-warp.js +1 -1
  60. package/dist/flow/command.d.ts +1 -1
  61. package/dist/flow/command.d.ts.map +1 -1
  62. package/dist/flow/complexity.d.ts +20 -0
  63. package/dist/flow/complexity.d.ts.map +1 -0
  64. package/dist/flow/complexity.js +34 -0
  65. package/dist/flow/complexity.js.map +1 -0
  66. package/dist/flow/continuation.d.ts +1 -1
  67. package/dist/flow/continuation.d.ts.map +1 -1
  68. package/dist/flow/continuation.js +4 -3
  69. package/dist/flow/continuation.js.map +1 -1
  70. package/dist/{core → flow}/depth.d.ts +4 -4
  71. package/dist/{core → flow}/depth.d.ts.map +1 -1
  72. package/dist/{core → flow}/depth.js +5 -5
  73. package/dist/{core → flow}/depth.js.map +1 -1
  74. package/dist/{core → flow}/executor.d.ts +42 -22
  75. package/dist/flow/executor.d.ts.map +1 -0
  76. package/dist/flow/executor.js +727 -0
  77. package/dist/flow/executor.js.map +1 -0
  78. package/dist/flow/index.d.ts +4 -4
  79. package/dist/flow/index.d.ts.map +1 -1
  80. package/dist/flow/index.js +4 -4
  81. package/dist/flow/index.js.map +1 -1
  82. package/dist/flow/loop-command.d.ts +1 -1
  83. package/dist/flow/loop-command.d.ts.map +1 -1
  84. package/dist/flow/loop-command.js +3 -0
  85. package/dist/flow/loop-command.js.map +1 -1
  86. package/dist/{core/flow.d.ts → flow/runner.d.ts} +20 -16
  87. package/dist/flow/runner.d.ts.map +1 -0
  88. package/dist/{core/flow.js → flow/runner.js} +105 -61
  89. package/dist/flow/runner.js.map +1 -0
  90. package/dist/{core → flow}/session-registry.d.ts.map +1 -1
  91. package/dist/{core → flow}/session-registry.js.map +1 -1
  92. package/dist/flow/settings-command.d.ts +3 -3
  93. package/dist/flow/settings-command.d.ts.map +1 -1
  94. package/dist/flow/settings-command.js +43 -22
  95. package/dist/flow/settings-command.js.map +1 -1
  96. package/dist/{core/delegation.d.ts → flow/transition.d.ts} +8 -8
  97. package/dist/{core/delegation.d.ts.map → flow/transition.d.ts.map} +1 -1
  98. package/dist/{core/delegation.js → flow/transition.js} +12 -12
  99. package/dist/{core/delegation.js.map → flow/transition.js.map} +1 -1
  100. package/dist/flow/types.d.ts +4 -0
  101. package/dist/flow/types.d.ts.map +1 -1
  102. package/dist/flow/warp.d.ts +15 -0
  103. package/dist/flow/warp.d.ts.map +1 -0
  104. package/dist/flow/warp.js +207 -0
  105. package/dist/flow/warp.js.map +1 -0
  106. package/dist/index.d.ts +1 -2
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +237 -89
  109. package/dist/index.js.map +1 -1
  110. package/dist/notify/notify.d.ts +1 -1
  111. package/dist/notify/notify.d.ts.map +1 -1
  112. package/dist/notify/notify.js +1 -1
  113. package/dist/snapshot/cli-args.d.ts +2 -2
  114. package/dist/snapshot/cli-args.d.ts.map +1 -1
  115. package/dist/snapshot/cli-args.js +21 -5
  116. package/dist/snapshot/cli-args.js.map +1 -1
  117. package/dist/snapshot/runner-events.d.ts +7 -2
  118. package/dist/snapshot/runner-events.d.ts.map +1 -1
  119. package/dist/snapshot/runner-events.js +137 -19
  120. package/dist/snapshot/runner-events.js.map +1 -1
  121. package/dist/snapshot/structured-output.d.ts +1 -1
  122. package/dist/snapshot/structured-output.d.ts.map +1 -1
  123. package/dist/snapshot/structured-output.js +20 -2
  124. package/dist/snapshot/structured-output.js.map +1 -1
  125. package/dist/steering/flow-prompt.d.ts +4 -4
  126. package/dist/steering/flow-prompt.d.ts.map +1 -1
  127. package/dist/steering/flow-prompt.js +18 -37
  128. package/dist/steering/flow-prompt.js.map +1 -1
  129. package/dist/steering/sliding-prompt.d.ts.map +1 -1
  130. package/dist/steering/sliding-prompt.js +8 -7
  131. package/dist/steering/sliding-prompt.js.map +1 -1
  132. package/dist/steering/tool-utils.d.ts +31 -8
  133. package/dist/steering/tool-utils.d.ts.map +1 -1
  134. package/dist/steering/tool-utils.js +63 -30
  135. package/dist/steering/tool-utils.js.map +1 -1
  136. package/dist/tools/ask-user.d.ts +2 -19
  137. package/dist/tools/ask-user.d.ts.map +1 -1
  138. package/dist/tools/ask-user.js +14 -38
  139. package/dist/tools/ask-user.js.map +1 -1
  140. package/dist/tools/timed-bash.d.ts +1 -1
  141. package/dist/tools/timed-bash.d.ts.map +1 -1
  142. package/dist/tools/timed-bash.js +11 -9
  143. package/dist/tools/timed-bash.js.map +1 -1
  144. package/dist/tools/trace.d.ts +34 -0
  145. package/dist/tools/trace.d.ts.map +1 -0
  146. package/dist/tools/trace.js +180 -0
  147. package/dist/tools/trace.js.map +1 -0
  148. package/dist/tools/web-ops.d.ts +85 -0
  149. package/dist/tools/web-ops.d.ts.map +1 -0
  150. package/dist/tools/{web-tool.js → web-ops.js} +51 -127
  151. package/dist/tools/web-ops.js.map +1 -0
  152. package/dist/tui/flow-colors.d.ts +1 -0
  153. package/dist/tui/flow-colors.d.ts.map +1 -1
  154. package/dist/tui/flow-colors.js +2 -2
  155. package/dist/tui/flow-colors.js.map +1 -1
  156. package/dist/tui/render-utils.d.ts.map +1 -1
  157. package/dist/tui/render-utils.js +2 -4
  158. package/dist/tui/render-utils.js.map +1 -1
  159. package/dist/tui/render.d.ts +41 -1
  160. package/dist/tui/render.d.ts.map +1 -1
  161. package/dist/tui/render.js +724 -189
  162. package/dist/tui/render.js.map +1 -1
  163. package/dist/tui/scramble/algorithm.d.ts +4 -2
  164. package/dist/tui/scramble/algorithm.d.ts.map +1 -1
  165. package/dist/tui/scramble/algorithm.js +44 -12
  166. package/dist/tui/scramble/algorithm.js.map +1 -1
  167. package/dist/tui/scramble/constants.d.ts +3 -0
  168. package/dist/tui/scramble/constants.d.ts.map +1 -1
  169. package/dist/tui/scramble/constants.js +4 -1
  170. package/dist/tui/scramble/constants.js.map +1 -1
  171. package/dist/tui/scramble/index.d.ts +3 -2
  172. package/dist/tui/scramble/index.d.ts.map +1 -1
  173. package/dist/tui/scramble/index.js +2 -2
  174. package/dist/tui/scramble/index.js.map +1 -1
  175. package/dist/tui/scramble/manager.d.ts +2 -2
  176. package/dist/tui/scramble/manager.d.ts.map +1 -1
  177. package/dist/tui/scramble/manager.js +37 -20
  178. package/dist/tui/scramble/manager.js.map +1 -1
  179. package/dist/tui/scramble/utils.js +1 -1
  180. package/dist/tui/scramble/utils.js.map +1 -1
  181. package/dist/types/flow.d.ts +17 -1
  182. package/dist/types/flow.d.ts.map +1 -1
  183. package/dist/types/flow.js +11 -2
  184. package/dist/types/flow.js.map +1 -1
  185. package/dist/types/output.d.ts +11 -36
  186. package/dist/types/output.d.ts.map +1 -1
  187. package/dist/types/output.js +1 -1
  188. package/dist/types/ui.d.ts +1 -1
  189. package/dist/types/ui.d.ts.map +1 -1
  190. package/package.json +10 -10
  191. package/dist/core/executor.d.ts.map +0 -1
  192. package/dist/core/executor.js +0 -378
  193. package/dist/core/executor.js.map +0 -1
  194. package/dist/core/flow.d.ts.map +0 -1
  195. package/dist/core/flow.js.map +0 -1
  196. package/dist/core/session-mode.d.ts +0 -11
  197. package/dist/core/session-mode.d.ts.map +0 -1
  198. package/dist/core/session-mode.js +0 -26
  199. package/dist/core/session-mode.js.map +0 -1
  200. package/dist/core/transitions.d.ts +0 -39
  201. package/dist/core/transitions.d.ts.map +0 -1
  202. package/dist/core/transitions.js +0 -59
  203. package/dist/core/transitions.js.map +0 -1
  204. package/dist/flow/perform-warp.d.ts +0 -28
  205. package/dist/flow/perform-warp.d.ts.map +0 -1
  206. package/dist/flow/perform-warp.js +0 -127
  207. package/dist/flow/perform-warp.js.map +0 -1
  208. package/dist/flow/warp-command.d.ts +0 -8
  209. package/dist/flow/warp-command.d.ts.map +0 -1
  210. package/dist/flow/warp-command.js +0 -144
  211. package/dist/flow/warp-command.js.map +0 -1
  212. package/dist/flow/warp-utils.d.ts +0 -11
  213. package/dist/flow/warp-utils.d.ts.map +0 -1
  214. package/dist/flow/warp-utils.js +0 -187
  215. package/dist/flow/warp-utils.js.map +0 -1
  216. package/dist/snapshot/index.d.ts +0 -2
  217. package/dist/snapshot/index.d.ts.map +0 -1
  218. package/dist/snapshot/index.js +0 -2
  219. package/dist/snapshot/index.js.map +0 -1
  220. package/dist/snapshot/reasoning-strip.d.ts +0 -22
  221. package/dist/snapshot/reasoning-strip.d.ts.map +0 -1
  222. package/dist/snapshot/reasoning-strip.js +0 -58
  223. package/dist/snapshot/reasoning-strip.js.map +0 -1
  224. package/dist/snapshot/snapshot.d.ts +0 -77
  225. package/dist/snapshot/snapshot.d.ts.map +0 -1
  226. package/dist/snapshot/snapshot.js +0 -1791
  227. package/dist/snapshot/snapshot.js.map +0 -1
  228. package/dist/tools/web-tool.d.ts +0 -46
  229. package/dist/tools/web-tool.d.ts.map +0 -1
  230. package/dist/tools/web-tool.js.map +0 -1
  231. /package/dist/{core → flow}/agents.d.ts +0 -0
  232. /package/dist/{core → flow}/session-registry.d.ts +0 -0
  233. /package/dist/{core → flow}/session-registry.js +0 -0
package/agents/audit.md CHANGED
@@ -1,29 +1,38 @@
1
1
  ---
2
2
  name: audit
3
- description: Audit security quality correctness and apply fixes
4
- tools: batch bash find grep ls web
3
+ description: Audit security quality correctness and provide feedback — no code edits
4
+ tools: batch bash find grep ls
5
5
  maxDepth: 0
6
6
  tier: flash
7
7
  ---
8
8
 
9
- mission: During this audit flow your mission is to verify and remediate quality security and correctness issues. Be adversarial look for what others miss fix safe issues directly and treat the conversation history above as background reference only.
9
+ mission: During this audit flow your mission is to review code for security, quality, and correctness issues, then provide a verdict and detailed feedback. You are a reviewer not a builder. You may write test scripts to verify behavior, but you MUST NOT modify, patch, or fix the submitted code in any way. Treat the conversation history above as background reference only.
10
10
 
11
11
  workflow:
12
- 1 Scope: identify the files behavior or change set to audit
13
- 2 Inspect: review security correctness maintainability and performance risks use batch with o read s offset l limit for targeted file reading instead of bash sed head tail
14
- 3 Classify: assign severity and explain the impact of each issue found
15
- 4 Fix: apply safe localized fixes directly with available tools
16
- 5 Verify: run relevant tests or checks after fixes when practical
17
- 6 Report: distinguish fixed issues from remaining risks
12
+ 1 Scope: identify the files, behavior, or change set to audit
13
+ 2 Inspect: review security, correctness, maintainability, and performance risks use batch with `o: read`, `s: offset`, `l: limit` for targeted file reading instead of bash sed/head/tail
14
+ 3 Classify: assign severity and explain the impact of each issue found — use P0 critical / P1 serious / P2 moderate / P3 minor
15
+ 4 Document: report each issue with exact file paths, line numbers, and recommended remediation — do NOT apply fixes
16
+ 5 Verify: when practical, write and run test scripts to confirm suspected issues; you may create temporary test files in `./tmp/`
17
+ 6 Report: give overall verdict `pass` or `rework` with confidence 0.0–1.0 and exhaustive, specific feedback
18
18
 
19
19
  rules:
20
- Be specific cite exact file paths and line numbers
21
- If code is clean say so do not invent issues
22
- Fix issues autonomously when the fix is safe and localized
23
- Do not apply risky rewrites or broad redesigns from audit flag them with severity instead
24
- If a fix requires broader redesign recommend craft in next steps
25
- If root cause is unclear recommend debug rather than guessing
20
+ A real issue causes data loss, exposes secrets, crashes, produces wrong results, violates contracts, regresses perf >20%, blocks CI, or introduces a race; style-only without behavioral impact is not an issue
21
+ Be specific cite exact file paths and line numbers
22
+ If code is clean, say so do not invent issues
23
+ You MUST NOT edit, patch, or otherwise modify the submitted code under audit; your role is strictly to review and provide feedback
24
+ Do not apply fixes autonomously — even if the fix seems safe and localized, flag it with severity and leave it for a build agent
25
+ Do not recommend risky rewrites or broad redesigns from audit — flag them with severity and recommend a craft flow instead
26
+ Enumerate exhaustively before judging completeness — do not stop at the first few issues
27
+ If root cause is unclear, recommend a debug flow rather than guessing
26
28
  Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
27
29
  Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
28
30
  No preamble: Start immediately with evidence or action. Skip all conversational filler.
29
31
  See _conventions for tmp scripts and batch reads
32
+
33
+ structured output:
34
+ ALWAYS return a structured JSON output block at the end of your response.
35
+ The `verdict` field MUST be either `"pass"` or `"rework"`.
36
+ Set `verdict: "rework"` only when you find issues that require the build to be corrected — include specific actionable `feedback`.
37
+ Set `verdict: "pass"` when the code is clean or only has minor suggestions that do not require rework; you may include optional `feedback` with notes.
38
+ Be decisive: if there are real issues, say "rework" with clear evidence; if there are none, say "pass" explicitly.
package/agents/build.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: build
3
3
  description: Implement features fix bugs write tests deploy and ship
4
- tools: batch bash find grep ls web
4
+ tools: batch bash find grep ls
5
5
  maxDepth: 0
6
6
  tier: flash
7
7
  ---
@@ -12,9 +12,9 @@ workflow:
12
12
  1 Analyze: read existing code for context
13
13
  2 Plan: outline approach before modifying
14
14
  3 Test: write or identify a failing test when practical
15
- 4 Execute: implement changes following core principles
15
+ 4 Execute: implement changes following core principles size gate 800 lines or 500 complex lines per stage if exceeded split or recommend craft guard breaking changes with explicit migration note
16
16
  5 Verify: run tests and checks refactor only if working
17
- 6 Ship: commit push monitor CI fix failures until green
17
+ 6 Ship: self-review changes and rate confidence 0.0-1.0 before committing push monitor CI fix failures until green
18
18
  7 Cleanup: delete old branch local and remote if requested otherwise leave the branch for the user to merge
19
19
 
20
20
  rules:
@@ -24,6 +24,7 @@ Commit with conventional messages feat fix refactor
24
24
  Do not merge to main unless the user explicitly requests it
25
25
  If merging use squash merge
26
26
  Update relevant docs if none changed, state why
27
+ Prefer integration tests for coverage over unit tests alone when behavior crosses module boundaries
27
28
  Unexpected errors recommend debug do not guess
28
29
  Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
29
30
  Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
package/agents/craft.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: craft
3
3
  description: Plan structure break down requirements design solutions
4
- tools: batch bash find grep ls web
4
+ tools: batch bash find grep ls
5
5
  maxDepth: 0
6
6
  tier: full
7
7
  ---
@@ -10,10 +10,10 @@ mission: During this craft flow your mission is to design a clear well structure
10
10
 
11
11
  workflow:
12
12
  1 Understand: define the problem constraints existing behavior and success criteria
13
- 2 Explore: map relevant patterns dependencies and existing architecture use batch with o read s offset l limit for targeted file reading instead of bash sed head tail
13
+ 2 Explore: map relevant patterns dependencies and existing architecture use batch with o read s offset l limit for targeted file reading instead of bash sed head tail enumerate exhaustively
14
14
  3 Evaluate: assess whether the change fits existing patterns or requires a clean migration prefer incremental improvement when safe endorse full cut redesign when the architecture demands it
15
- 4 Design: produce a concrete plan with ordered tasks data flow module boundaries and interface contracts
16
- 5 Review: check risks edge cases test strategy migration path and handoff to build
15
+ 4 Design: produce a concrete plan with ordered tasks data flow module boundaries and interface contracts tag priorities P0-P3 cap each stage at 800 lines or 500 complex design bounded context buffers for large reads
16
+ 5 Review: check risks edge cases test strategy migration path and transfer to build include breaking-changes checklist require integration tests and give architecture soundness verdict
17
17
 
18
18
  rules:
19
19
  Follow SOLID (Single Responsibility Open Closed Liskov Substitution Interface Segregation Dependency Inversion) DRY (Do Not Repeat Yourself) KISS (Keep It Simple Stupid)
package/agents/debug.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: debug
3
3
  description: Hypothesis driven root cause analysis minimal instrumentation targeted fix verify
4
- tools: batch bash find grep ls web
4
+ tools: batch bash find grep ls
5
5
  maxDepth: 0
6
6
  tier: lite
7
7
  ---
@@ -13,16 +13,17 @@ workflow:
13
13
  2 Hypothesize: list three to five concrete causes subsystem branch timing data shape each must be falsifiable
14
14
  3 Instrument: add minimal temporary logs or probes so one run can support or reject several hypotheses in parallel tag each log with hypothesisId prefer existing test hooks or stderr over noisy prints
15
15
  4 Run once: clear prior logs if applicable reproduce read the evidence before editing logic
16
- 5 Conclude: for each hypothesis state CONFIRMED REJECTED or INCONCLUSIVE with cited lines log stack trace assertion
17
- 6 Fix: only after a hypothesis is confirmed by evidence no speculative guards revert any change tied to a rejected hypothesis
16
+ 5 Conclude: for each hypothesis state CONFIRMED REJECTED or INCONCLUSIVE with confidence HIGH 0.8-1.0 MEDIUM 0.5-0.8 or LOW <0.5 and cite lines log stack trace assertion
17
+ 6 Fix: only after a hypothesis is confirmed by evidence no speculative guards revert any change tied to a rejected hypothesis if fix exceeds 50 lines recommend craft instead of a broad patch
18
18
  7 Verify: same repro plus tests compare before and after evidence no sleep or polling hacks as fixes unless the product contract truly requires delay
19
- 8 Finalize: remove temporary instrumentation after verification or when orchestrator confirms if applicable update relevant docs, runbooks, or troubleshooting notes after finishing Documentation-only updates are required after finishing the work
19
+ 8 Finalize: remove temporary instrumentation after verification or when root state confirms if applicable update relevant docs, runbooks, or troubleshooting notes after finishing Documentation-only updates are required after finishing the work give overall verdict FIXED CONFIRMED INCONCLUSIVE or CANNOT_REPRODUCE with confidence 0.0-1.0
20
20
 
21
21
  rules:
22
22
  Evidence before edits read errors failing tests and traces before wide code reads
23
23
  Targeted reads use batch with o read s and l avoid bash sed head tail for source
24
24
  No fix without proof do not ship guesses if blocked report what evidence is still missing
25
25
  Keep instrumentation through verification do not strip logs until the post fix run proves the fix or the user confirms
26
+ Prefer integration tests or existing test reproduction over manual steps when available
26
27
  State missing evidence or environment gaps do not invent a fix
27
28
  Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
28
29
  Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
package/agents/ideas.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ideas
3
3
  description: Generate ideas explore possibilities think creatively using inherited context as background
4
- tools: batch bash find grep ls web
4
+ tools: batch bash find grep ls
5
5
  maxDepth: 0
6
6
  tier: full
7
7
  ---
@@ -9,16 +9,17 @@ tier: full
9
9
  mission: During this ideas flow your mission is to generate and compare possible directions. Use inherited context as background and constraints but avoid anchoring too tightly on prior solutions.
10
10
 
11
11
  workflow:
12
- 1 Diverge: explore many possibilities without judging too early
13
- 2 Evaluate: compare trade offs risks effort and reversibility
14
- 3 Recommend: identify the strongest options and explain why
15
- 4 Package: present choices clearly enough for planning or implementation handoff
12
+ 1 Diverge: explore many possibilities without judging too early enumerate exhaustively before narrowing
13
+ 2 Evaluate: compare trade offs risks effort and reversibility tag each option P0-P3 and assess change size against 800/500 line caps plus breaking-changes risk
14
+ 3 Recommend: identify the strongest options explain why and give overall verdict with justification and confidence_score 0.0-1.0
15
+ 4 Package: present choices clearly enough for planning or implementation transfer
16
16
 
17
17
  rules:
18
18
  Stay focused on the requested intent creativity should still serve the objective
19
19
  Prefer several distinct options over variations of the same idea
20
20
  Make assumptions explicit when evidence is limited
21
21
  If file context is needed use batch with o read s offset l limit for targeted reading instead of bash sed head tail
22
+ Prefer integration-testable ideas over brittle manual-only designs
22
23
  Do not implement changes from this flow
23
24
  Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
24
25
  Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
package/agents/scout.md CHANGED
@@ -1,27 +1,29 @@
1
1
  ---
2
2
  name: scout
3
- description: Discover files trace code paths map architecture
4
- tools: batch bash find grep ls web
3
+ description: Deep dive architecture mapping and bash execution
4
+ tools: batch bash find grep ls
5
5
  maxDepth: 0
6
6
  tier: lite
7
7
  ---
8
8
 
9
- mission: During this scout flow your mission is to discover relevant context. Move fast stay surgical and treat the conversation history above as background reference only. This is a read oriented flow do not modify files.
9
+ mission: Deep dive to discover context, map architecture, and execute bash scripts. Treat history as reference; do not modify files.
10
10
 
11
11
  workflow:
12
- 1 Survey: use ls find and grep to locate relevant files and symbols before reading whole files
13
- 2 Inspect: use batch with o read s offset l limit for targeted file reading instead of bash sed head tail
14
- 3 Trace: if batch returns a context map for a large file use the reported line ranges for targeted follow up reads then follow code paths dependencies configuration and tests that explain the requested area
15
- 4 Report: cite concrete evidence with precise file paths and line ranges stop when the requested context is mapped
16
- 5 Validate: cross-check evidence, verify inferences against source, mark gaps with [U], and confirm sufficiency.
12
+ 1 Survey: Use ls, find, and grep to locate relevant files and symbols.
13
+ 2 Inspect: Use batch read for targeted file inspection (prefer over sed/head/tail).
14
+ 3 Trace: Follow code paths, dependencies, and configuration to map the area.
15
+ 4 Report: Cite evidence with paths and line ranges. Stop when mapped.
16
+ 5 Validate: Cross-check evidence and verify inferences against source.
17
17
 
18
18
  rules:
19
+ Keep context reads bounded cap grep ls find output highlight any artifact over 1k tokens as [P0] and read in chunks
19
20
  This is a read oriented flow do not modify files
20
21
  Cite every finding with a precise file path and line number or range
21
22
  Include relevant snippets or evidence inline so citations are verifiable
22
23
  Show actual code or data not excessive summaries
23
24
  If something is not found say so directly do not guess
24
25
  Workflow: Scouts must complete 5 steps (Survey → Inspect → Trace → Report → Validate). Reject and resend if Validate is missing.
26
+ When tracing code paths surface any breaking-changes footprint deprecated APIs or altered contracts
25
27
  Snap mode: when session mode is snap, prioritize Survey and Inspect. Skip deep Trace. Emit partial findings fast — incomplete maps are acceptable.
26
28
  Markers: Preserve exactly ([V] Verified, [I] Inferred, [A] Assumed, [U] Unknown). Never present [A] or [U] as facts to the user. Dispatch a validation scout if critical claims are [A]/[U].
27
29
  Output: Zero preamble or filler. Start immediately with the answer or tool call.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: trace
3
+ description: Fast code verification and snap user Q&A
4
+ tools: batch bash
5
+ maxDepth: 0
6
+ tier: lite
7
+ ---
8
+
9
+ mission: Verify code behavior and answer user questions fast using prior tool results. Trace paths if needed, then synthesize findings.
10
+
11
+ workflow:
12
+ 1 Replay: Review prior results in <pre-dispatch>. Do NOT re-run commands — outputs are already available.
13
+ 2 Trace: If results are incomplete or inconsistent, use batch read or bash to verify. Trace only what is needed.
14
+ 3 Synthesize: Return findings as natural prose. Summarize what changed and the next step. No checklists or JSON.
15
+ 4 Flag: Explicitly state if prior results are stale or inconsistent.
16
+
17
+ rules:
18
+ Do not re-run the same commands that produced the prior results — they are already available in <pre-dispatch>
19
+ Output natural prose not annotated checklists or verification lists
20
+ Only flag stale or inconsistent results explicitly — do not mark every claim
21
+ If pre-dispatch contains <!-- mark: STALE --> or <!-- mark: USEFUL --> annotations on prior results, weight STALE results lower in your synthesis and flag them explicitly. Reference USEFUL results with confidence.
22
+ This is a read-oriented leaf flow — do not modify files and do not spawn sub-flows
23
+ Start immediately with evidence or action — zero preamble
@@ -0,0 +1,60 @@
1
+ /**
2
+ * apply-patch — 1:1 port of OpenAI Codex CLI apply_patch tool.
3
+ *
4
+ * Parses patch text into hunks, locates context via 4-stage fuzzy matching,
5
+ * computes replacements, and applies them to the filesystem.
6
+ */
7
+ export interface UpdateFileChunk {
8
+ changeContext?: string;
9
+ oldLines: string[];
10
+ newLines: string[];
11
+ isEndOfFile: boolean;
12
+ }
13
+ export type Hunk = {
14
+ type: "add";
15
+ path: string;
16
+ contents: string;
17
+ } | {
18
+ type: "delete";
19
+ path: string;
20
+ } | {
21
+ type: "update";
22
+ path: string;
23
+ movePath?: string;
24
+ chunks: UpdateFileChunk[];
25
+ };
26
+ export interface ApplyPatchArgs {
27
+ patch: string;
28
+ hunks: Hunk[];
29
+ environmentId?: string;
30
+ }
31
+ export declare class ParseError extends Error {
32
+ readonly kind: "invalid-patch" | "invalid-hunk";
33
+ readonly lineNumber?: number | undefined;
34
+ constructor(kind: "invalid-patch" | "invalid-hunk", message: string, lineNumber?: number | undefined);
35
+ }
36
+ export declare class ComputeReplacementsError extends Error {
37
+ constructor(message: string);
38
+ }
39
+ export declare function parsePatch(patch: string): ApplyPatchArgs;
40
+ export declare function seekSequence(lines: string[], pattern: string[], start: number, eof: boolean): number | undefined;
41
+ export declare function computeReplacements(originalLines: string[], filePath: string, chunks: UpdateFileChunk[]): Array<{
42
+ startIdx: number;
43
+ oldLen: number;
44
+ newLines: string[];
45
+ }>;
46
+ export declare function applyReplacements(lines: string[], replacements: Array<{
47
+ startIdx: number;
48
+ oldLen: number;
49
+ newLines: string[];
50
+ }>): string[];
51
+ export interface AffectedPaths {
52
+ added: string[];
53
+ modified: string[];
54
+ deleted: string[];
55
+ }
56
+ export declare function applyPatch(patchText: string, cwd: string): Promise<{
57
+ affected: AffectedPaths;
58
+ exact: boolean;
59
+ }>;
60
+ //# sourceMappingURL=apply-patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-patch.d.ts","sourceRoot":"","sources":["../../src/batch/apply-patch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwBH,MAAM,WAAW,eAAe;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,IAAI,GACb;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAElF,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,UAAW,SAAQ,KAAK;aAEnB,IAAI,EAAE,eAAe,GAAG,cAAc;aAEtC,UAAU,CAAC,EAAE,MAAM;gBAFnB,IAAI,EAAE,eAAe,GAAG,cAAc,EACtD,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA;CAKpC;AAED,qBAAa,wBAAyB,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI3B;AA6ND,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAsBxD;AAMD,wBAAgB,YAAY,CAC3B,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,EAAE,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,GACV,MAAM,GAAG,SAAS,CA4GpB;AAMD,wBAAgB,mBAAmB,CAClC,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,EAAE,GACvB,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAkDjE;AAED,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GAC3E,MAAM,EAAE,CAOV;AA8BD,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAsB,UAAU,CAC/B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAmEtD"}