@rryando/arcs 4.1.0 → 4.2.1
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.
- package/README.md +17 -19
- package/dist/cli/arcs-flash.d.ts +1 -1
- package/dist/cli/arcs-flash.d.ts.map +1 -1
- package/dist/cli/arcs-flash.js +10 -53
- package/dist/cli/arcs-flash.js.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.d.ts +2 -2
- package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.js +2 -8
- package/dist/cli/arcs-orchestrate-caveman.js.map +1 -1
- package/dist/cli/arcs-orchestrate.d.ts +1 -1
- package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate.js +4 -54
- package/dist/cli/arcs-orchestrate.js.map +1 -1
- package/dist/cli/commands/index.d.ts +0 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +0 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/project.js +1 -30
- package/dist/cli/commands/project.js.map +1 -1
- package/dist/cli/commands/proposal-doc.d.ts +2 -0
- package/dist/cli/commands/proposal-doc.d.ts.map +1 -0
- package/dist/cli/commands/proposal-doc.js +381 -0
- package/dist/cli/commands/proposal-doc.js.map +1 -0
- package/dist/cli/commands/web.js +4 -10
- package/dist/cli/commands/web.js.map +1 -1
- package/dist/cli/orchestrator-shared-blocks.d.ts +11 -30
- package/dist/cli/orchestrator-shared-blocks.d.ts.map +1 -1
- package/dist/cli/orchestrator-shared-blocks.js +49 -126
- package/dist/cli/orchestrator-shared-blocks.js.map +1 -1
- package/dist/utils/diagram-generator.d.ts.map +1 -1
- package/dist/utils/diagram-generator.js +11 -6
- package/dist/utils/diagram-generator.js.map +1 -1
- package/dist/utils/graphify-knowledge.d.ts +22 -0
- package/dist/utils/graphify-knowledge.d.ts.map +1 -0
- package/dist/utils/graphify-knowledge.js +47 -0
- package/dist/utils/graphify-knowledge.js.map +1 -0
- package/dist/utils/graphify.d.ts +104 -0
- package/dist/utils/graphify.d.ts.map +1 -0
- package/dist/utils/graphify.js +439 -0
- package/dist/utils/graphify.js.map +1 -0
- package/dist/utils/session-store.d.ts +24 -2
- package/dist/utils/session-store.d.ts.map +1 -1
- package/dist/utils/session-store.js +16 -7
- package/dist/utils/session-store.js.map +1 -1
- package/dist/utils/storage-utils.d.ts +1 -1
- package/dist/utils/storage-utils.d.ts.map +1 -1
- package/dist/utils/storage-utils.js +1 -1
- package/dist/utils/storage-utils.js.map +1 -1
- package/dist/web-client/assets/{GraphCanvas-BPDgvsyT.js → GraphCanvas-Dw6EcoDb.js} +1 -1
- package/dist/web-client/assets/{MarkdownEditor-D7TLp78z.js → MarkdownEditor-Cz5_44Ej.js} +1 -1
- package/dist/web-client/assets/{abnfDiagram-VRR7QNED-CyuP2N9t.js → abnfDiagram-VRR7QNED-CFJzLuew.js} +1 -1
- package/dist/web-client/assets/architecture-TIHT7OUA-CoHvhex9.js +1 -0
- package/dist/web-client/assets/{architectureDiagram-ZJ3FMSHR-DZ0ul9QX.js → architectureDiagram-ZJ3FMSHR-FRlSgnnW.js} +1 -1
- package/dist/web-client/assets/{blockDiagram-677ZJIJ3-LLGzlc9l.js → blockDiagram-677ZJIJ3-WUkkunPZ.js} +1 -1
- package/dist/web-client/assets/{c4Diagram-LMCZKHZV-CViu3CTc.js → c4Diagram-LMCZKHZV-BKeAsL6F.js} +1 -1
- package/dist/web-client/assets/channel-D8xMXC5_.js +1 -0
- package/dist/web-client/assets/{chunk-32BRIVSS-Bw_IuJCM.js → chunk-32BRIVSS-B0b9kUcF.js} +1 -1
- package/dist/web-client/assets/{chunk-52WLFC77-C29h440W.js → chunk-52WLFC77-i6Y-vfL3.js} +1 -1
- package/dist/web-client/assets/{chunk-C7G6YPKG-hhOrvw5w.js → chunk-C7G6YPKG-atYWm6iP.js} +1 -1
- package/dist/web-client/assets/{chunk-EX3LRPZG-COMzol-M.js → chunk-EX3LRPZG-CZD6y0UU.js} +1 -1
- package/dist/web-client/assets/{chunk-FWX5IMBZ-6vdX9EUn.js → chunk-FWX5IMBZ-CVErR-UZ.js} +2 -2
- package/dist/web-client/assets/{chunk-HOUHSVGY-DWDW6sxp.js → chunk-HOUHSVGY-BlHO2iQ3.js} +1 -1
- package/dist/web-client/assets/{chunk-ICXQ74PX-BdMYglo2.js → chunk-ICXQ74PX-Ar8kfXfa.js} +1 -1
- package/dist/web-client/assets/{chunk-MOJQB5TN-C0LAX_dC.js → chunk-MOJQB5TN-DKrK867P.js} +1 -1
- package/dist/web-client/assets/{chunk-OGEWGWER-CBx8MB7f.js → chunk-OGEWGWER-BmGykUeg.js} +1 -1
- package/dist/web-client/assets/{chunk-PUDLZKDR-DKssR1nf.js → chunk-PUDLZKDR-Bq23pnso.js} +1 -1
- package/dist/web-client/assets/{chunk-Q4XR5HBZ-B3kcxFE-.js → chunk-Q4XR5HBZ-g15qvFAN.js} +1 -1
- package/dist/web-client/assets/{chunk-V7JOEXUC-CAlymndy.js → chunk-V7JOEXUC-uyXA7S9r.js} +1 -1
- package/dist/web-client/assets/{chunk-VAUOI2AC-BowfsmTW.js → chunk-VAUOI2AC-WofZ-2M0.js} +1 -1
- package/dist/web-client/assets/{chunk-VR4S4FIN-BBOydgvt.js → chunk-VR4S4FIN-DtTkK86v.js} +1 -1
- package/dist/web-client/assets/{chunk-WYO6CB5R-DcymFbES.js → chunk-WYO6CB5R-zVyUwJq3.js} +1 -1
- package/dist/web-client/assets/{chunk-ZGVPDNZ5--uKFP-Lr.js → chunk-ZGVPDNZ5-CA1Oe3TK.js} +1 -1
- package/dist/web-client/assets/classDiagram-OUVF2IWQ-Doj1_hvZ.js +1 -0
- package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-Doj1_hvZ.js +1 -0
- package/dist/web-client/assets/{cynefin-VYW2F7L2-CjboUOMA.js → cynefin-VYW2F7L2-ivJY1h_9.js} +1 -1
- package/dist/web-client/assets/{cynefinDiagram-TSTJHNR4-BcxygBP7.js → cynefinDiagram-TSTJHNR4-D2DstShq.js} +1 -1
- package/dist/web-client/assets/{dagre-VKFMJZFB-D-tiERQE.js → dagre-VKFMJZFB-CwnMRy0K.js} +1 -1
- package/dist/web-client/assets/{diagram-FQU43EPY-ChPXczaS.js → diagram-FQU43EPY-BKJv6Cvw.js} +1 -1
- package/dist/web-client/assets/{diagram-G47NLZAW-CVL3Y91h.js → diagram-G47NLZAW-CwCXcgU5.js} +1 -1
- package/dist/web-client/assets/{diagram-NH7WQ7WH-DsaNA9Lh.js → diagram-NH7WQ7WH-CkghU1-6.js} +1 -1
- package/dist/web-client/assets/{diagram-OA4YK3LP-CXhrhdhU.js → diagram-OA4YK3LP-D3siQIGu.js} +1 -1
- package/dist/web-client/assets/{diagram-WEI45ONY-BTVPnk4E.js → diagram-WEI45ONY-CSs9xTBn.js} +1 -1
- package/dist/web-client/assets/{ebnfDiagram-CCIWWBDH-BAyrRBtM.js → ebnfDiagram-CCIWWBDH--i52vMiv.js} +1 -1
- package/dist/web-client/assets/{erDiagram-Q63AITRT-Qm24Wepm.js → erDiagram-Q63AITRT-q2hgOBY1.js} +1 -1
- package/dist/web-client/assets/eventmodeling-45OFAUF4-ESVuFkJJ.js +1 -0
- package/dist/web-client/assets/flowDiagram-23GEKE2U-DN9SdR9f.js +1 -0
- package/dist/web-client/assets/{ganttDiagram-NO4QXBWP-D8h7l3XJ.js → ganttDiagram-NO4QXBWP-BZ2rBbTe.js} +1 -1
- package/dist/web-client/assets/{gitGraph-TEB2WS4Q-DIBml1SB.js → gitGraph-TEB2WS4Q-OnJ8tHgt.js} +1 -1
- package/dist/web-client/assets/{gitGraphDiagram-IHSO6WYX-CtkYoXjn.js → gitGraphDiagram-IHSO6WYX-CPNExFAr.js} +1 -1
- package/dist/web-client/assets/{index-DOSH4Q9H.js → index-DCBn-YrR.js} +38 -38
- package/dist/web-client/assets/{info-DKCQHKI2-DLEUtV5Q.js → info-DKCQHKI2-DGuJbmdY.js} +1 -1
- package/dist/web-client/assets/{infoDiagram-FWYZ7A6U-BJQ7aQux.js → infoDiagram-FWYZ7A6U-ADIAn-P5.js} +1 -1
- package/dist/web-client/assets/{ishikawaDiagram-FXEZZL3T-BPM11FvG.js → ishikawaDiagram-FXEZZL3T-CUx-RGfg.js} +1 -1
- package/dist/web-client/assets/{journeyDiagram-5HDEW3XC-C0aX2z3c.js → journeyDiagram-5HDEW3XC-BH7-tBBy.js} +1 -1
- package/dist/web-client/assets/{kanban-definition-HUTT4EX6-C56F29Ib.js → kanban-definition-HUTT4EX6-BGEXBnI2.js} +1 -1
- package/dist/web-client/assets/{line-BLFHLF2N.js → line-CC-5ezU8.js} +1 -1
- package/dist/web-client/assets/{mermaid-parser.core-BLC8FhgU.js → mermaid-parser.core-Dw18Fjbq.js} +3 -3
- package/dist/web-client/assets/{mermaid.core-BBqkKuXt.js → mermaid.core-CMQBgE43.js} +3 -3
- package/dist/web-client/assets/{mindmap-definition-LN4V7U3C-aVZbsoPc.js → mindmap-definition-LN4V7U3C-CGtjw8tB.js} +1 -1
- package/dist/web-client/assets/{packet-7NZHBO7P-D4aqSQfB.js → packet-7NZHBO7P-w71Y4Hzd.js} +1 -1
- package/dist/web-client/assets/{pegDiagram-2B236MQR-DjfyNI0U.js → pegDiagram-2B236MQR-DWtfEm4T.js} +1 -1
- package/dist/web-client/assets/{pie-RZYD4A2V-ChCwYsYj.js → pie-RZYD4A2V-S9ztgnWs.js} +1 -1
- package/dist/web-client/assets/{pieDiagram-ENE6RG2P-BeHLKkXC.js → pieDiagram-ENE6RG2P-BWZQPN4m.js} +1 -1
- package/dist/web-client/assets/{quadrantDiagram-ABIIQ3AL-stga3gvq.js → quadrantDiagram-ABIIQ3AL-DINDwblH.js} +1 -1
- package/dist/web-client/assets/{radar-I7S5WNFK-DOGheiwT.js → radar-I7S5WNFK-BOGl9krB.js} +1 -1
- package/dist/web-client/assets/{railroad-3IZDKUUU-_JnU7M6L.js → railroad-3IZDKUUU-CR9kuYSZ.js} +1 -1
- package/dist/web-client/assets/railroad-abnf-AHOZXSZD-BvbCHrlR.js +1 -0
- package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-D869lbCL.js +1 -0
- package/dist/web-client/assets/railroad-peg-LSFZ7HO6-r4TXaJPI.js +1 -0
- package/dist/web-client/assets/{railroadDiagram-RFXS5EU6-C0CkMsOd.js → railroadDiagram-RFXS5EU6-byLCs9hp.js} +1 -1
- package/dist/web-client/assets/{requirementDiagram-TGXJPOKE-DuImwoRD.js → requirementDiagram-TGXJPOKE-Dn_FtbqW.js} +1 -1
- package/dist/web-client/assets/{sankeyDiagram-HTMAVEWB-kprq0XF9.js → sankeyDiagram-HTMAVEWB-DUjRrCeC.js} +1 -1
- package/dist/web-client/assets/{sequenceDiagram-DBY2YBRQ-DiXKJMF6.js → sequenceDiagram-DBY2YBRQ-BmBz8Wpq.js} +1 -1
- package/dist/web-client/assets/{stateDiagram-2N3HPSRC-D5qbVStE.js → stateDiagram-2N3HPSRC-BAYHjmqB.js} +1 -1
- package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-Bl-1K1zV.js +1 -0
- package/dist/web-client/assets/{swimlanes-5IMT3BWC-DCbw389c.js → swimlanes-5IMT3BWC-Bm942AR-.js} +1 -1
- package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DHU7bsfA.js +8 -0
- package/dist/web-client/assets/{timeline-definition-FHXFAJF6-CQeaYN_9.js → timeline-definition-FHXFAJF6-CHAZHhQk.js} +1 -1
- package/dist/web-client/assets/{treeView-QDETBFTQ-Cf7Sq3qo.js → treeView-QDETBFTQ-DHHkLsSy.js} +1 -1
- package/dist/web-client/assets/{treemap-6X3UGDF4-BovzvoTU.js → treemap-6X3UGDF4-BUxZ8fhY.js} +1 -1
- package/dist/web-client/assets/{vennDiagram-L72KCM5P-CZsJy139.js → vennDiagram-L72KCM5P-BL9TRcUU.js} +1 -1
- package/dist/web-client/assets/{wardley-OPB4EBWU-DJ7MS6XZ.js → wardley-OPB4EBWU-CfJ5mO-y.js} +1 -1
- package/dist/web-client/assets/{wardleyDiagram-EHGQE667-rqhcmsbM.js → wardleyDiagram-EHGQE667-BlH1TSjy.js} +1 -1
- package/dist/web-client/assets/{xychartDiagram-FW5EYKEG-HuK4Seps.js → xychartDiagram-FW5EYKEG-BJN6wtrV.js} +1 -1
- package/dist/web-client/index.html +1 -1
- package/dist/web-server/app.d.ts.map +1 -1
- package/dist/web-server/app.js +1 -7
- package/dist/web-server/app.js.map +1 -1
- package/dist/web-server/claude-runner.d.ts +11 -4
- package/dist/web-server/claude-runner.d.ts.map +1 -1
- package/dist/web-server/claude-runner.js +10 -14
- package/dist/web-server/claude-runner.js.map +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +4 -1
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/opencode-client.d.ts +123 -0
- package/dist/web-server/opencode-client.d.ts.map +1 -0
- package/dist/web-server/opencode-client.js +514 -0
- package/dist/web-server/opencode-client.js.map +1 -0
- package/dist/web-server/prompt-assembly.d.ts.map +1 -1
- package/dist/web-server/prompt-assembly.js +1 -2
- package/dist/web-server/prompt-assembly.js.map +1 -1
- package/dist/web-server/routes/sessions.d.ts +9 -6
- package/dist/web-server/routes/sessions.d.ts.map +1 -1
- package/dist/web-server/routes/sessions.js +272 -205
- package/dist/web-server/routes/sessions.js.map +1 -1
- package/dist/web-server/run-driver.d.ts +113 -0
- package/dist/web-server/run-driver.d.ts.map +1 -0
- package/dist/web-server/run-driver.js +214 -0
- package/dist/web-server/run-driver.js.map +1 -0
- package/dist/web-server/run-event-log.d.ts +23 -1
- package/dist/web-server/run-event-log.d.ts.map +1 -1
- package/dist/web-server/run-event-log.js +29 -5
- package/dist/web-server/run-event-log.js.map +1 -1
- package/dist/web-server/web-auth.d.ts +3 -5
- package/dist/web-server/web-auth.d.ts.map +1 -1
- package/dist/web-server/web-auth.js +6 -11
- package/dist/web-server/web-auth.js.map +1 -1
- package/dist/web-server/web-token.d.ts +1 -2
- package/dist/web-server/web-token.d.ts.map +1 -1
- package/dist/web-server/web-token.js +1 -2
- package/dist/web-server/web-token.js.map +1 -1
- package/opencode/arcs/bundle-runtime.json +0 -6
- package/opencode/arcs/manifest.json +8 -25
- package/opencode/arcs/prompts/arcs-docs.txt +19 -157
- package/opencode/arcs/prompts/arcs-flash.txt +46 -155
- package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +48 -164
- package/opencode/arcs/prompts/arcs-orchestrate.txt +47 -157
- package/opencode/arcs/prompts/code-reviewer.txt +20 -60
- package/opencode/arcs/prompts/graph-explorer.txt +19 -49
- package/opencode/arcs/prompts/software-engineer.txt +21 -67
- package/opencode/arcs/prompts/tech-architect.txt +20 -130
- package/opencode/arcs/skills/brainstorming/SKILL.md +20 -100
- package/opencode/arcs/skills/brainstorming/visual-companion.md +6 -264
- package/opencode/arcs/skills/caveman-commit/SKILL.md +6 -43
- package/opencode/arcs/skills/deep-pr-review/SKILL.md +18 -200
- package/opencode/arcs/skills/deep-pr-review/codegraph-diff.md +7 -93
- package/opencode/arcs/skills/deep-pr-review/review-template.md +13 -60
- package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +16 -156
- package/opencode/arcs/skills/implementation/SKILL.md +20 -46
- package/opencode/arcs/skills/init-project/SKILL.md +12 -150
- package/opencode/arcs/skills/systematic-debugging/SKILL.md +13 -152
- package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +7 -110
- package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +7 -119
- package/opencode/arcs/skills/systematic-debugging/phases-reference.md +9 -166
- package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +8 -165
- package/opencode/arcs/skills/test-driven-development/SKILL.md +10 -61
- package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +7 -154
- package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +8 -295
- package/opencode/arcs/skills/to-diagram/SKILL.md +18 -206
- package/opencode/arcs/skills/writing-knowledge/SKILL.md +11 -63
- package/opencode/arcs/skills/writing-plans/SKILL.md +25 -118
- package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +10 -61
- package/package.json +1 -1
- package/skills/explore-dag.md +9 -52
- package/skills/init-project.md +9 -98
- package/skills/orchestrate.md +15 -109
- package/skills/update-docs.md +9 -60
- package/dist/web-client/assets/architecture-TIHT7OUA-Bdo2Yvm9.js +0 -1
- package/dist/web-client/assets/channel-DBNmizpo.js +0 -1
- package/dist/web-client/assets/classDiagram-OUVF2IWQ-CB3HiA1_.js +0 -1
- package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-CB3HiA1_.js +0 -1
- package/dist/web-client/assets/eventmodeling-45OFAUF4-DoTBIvl5.js +0 -1
- package/dist/web-client/assets/flowDiagram-23GEKE2U-BEH23L1A.js +0 -1
- package/dist/web-client/assets/railroad-abnf-AHOZXSZD-nhNub7LE.js +0 -1
- package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-BlQYe7Yf.js +0 -1
- package/dist/web-client/assets/railroad-peg-LSFZ7HO6-B3E8pRVN.js +0 -1
- package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-DWwTAG1r.js +0 -1
- package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DabrCsjZ.js +0 -8
- package/opencode/arcs/prompts/devil-advocate.txt +0 -79
- package/opencode/arcs/skills/executing-plans/SKILL.md +0 -49
- package/opencode/arcs/skills/install-claude-code-hook/SKILL.md +0 -143
- package/scripts/claude-code-session-hook.mjs +0 -146
|
@@ -1,61 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: implementation
|
|
3
|
-
description:
|
|
3
|
+
description: Inspect, edit, verify, or execute a ready plan node
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Implementation
|
|
7
7
|
|
|
8
|
-
## Work
|
|
8
|
+
## Work Modes
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
`bounded`, `inspect`, and `plan-node` are hints, not lifecycle gates:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- **bounded:** files and behavior already clear; start directly.
|
|
13
|
+
- **inspect:** smallest repository surface needed to resolve details.
|
|
14
|
+
- **plan-node:** check declared dependencies, execute the ready node within its scope, run relevant verification, and align task/diagram state through ARCS CLI. Never edit DAG files directly, execute a blocked node, or absorb an adjacent outcome.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
In any mode, ask only when evidence cannot resolve a change to goal, material scope, dependency strategy, or risk.
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
- Read only the dispatched files and context needed to make the change.
|
|
18
|
-
- If a material decision or hidden scope appears, stop and return `STATUS: blocked`; do not guess or switch modes.
|
|
18
|
+
## Method
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
1. Inspect relevant code and tests.
|
|
21
|
+
2. Reuse existing patterns and dependencies.
|
|
22
|
+
3. Edit the minimum code needed for a complete result.
|
|
23
|
+
4. Add proportionate tests for changed behavior.
|
|
24
|
+
5. Verify with targeted checks; broader checks for broad or high-risk work.
|
|
25
|
+
6. If verification fails, fix failures caused by the change and rerun the relevant check.
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
For `plan-node`, read current node metadata, confirm every predecessor is done, and use ARCS CLI task and diagram commands to keep completion state aligned. If dependencies are unmet or the node conflicts with its scope, stop with the concrete blocker instead of selecting other work.
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
2. Infer the answer when tools or established conventions make it clear.
|
|
26
|
-
3. Ask at most one targeted user question, and only for a material decision that is not tool-resolvable.
|
|
27
|
-
4. If uncertainty is design-shaping or scope expands, stop and return `STATUS: blocked` rather than improvising.
|
|
29
|
+
Prefer necessity → standard library → platform capability → installed dependency → minimum custom code. Do not simplify away security, accessibility, validation, error handling, or data-loss protection.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Do not commit, push, deploy, or modify unrelated files without an explicit request.
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
## Return
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
2. **Standard library** — use it when it correctly covers the need.
|
|
35
|
-
3. **Native platform** — prefer a built-in platform capability.
|
|
36
|
-
4. **Installed dependency** — reuse one before adding code or a dependency.
|
|
37
|
-
5. **Minimum code** — write only the smallest correct implementation.
|
|
38
|
-
|
|
39
|
-
Do not introduce abstractions, configuration, scaffolding, or dependencies for hypothetical consumers. Minimal does not mean flimsy: never simplify away security controls, accessibility basics, trust-boundary validation, or error handling that prevents data loss.
|
|
40
|
-
|
|
41
|
-
Mark every deliberate simplification with its known ceiling and concrete revisit trigger:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
// SHORTCUT: <ceiling>, upgrade when <trigger>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Implementation And Verification
|
|
48
|
-
|
|
49
|
-
- Follow existing repository conventions and the dispatch SCOPE.
|
|
50
|
-
- Use test-driven-development when the dispatch requires it or when adding non-trivial behavior; structural changes may rely on existing focused contracts.
|
|
51
|
-
- Run exactly the dispatch VERIFY command, scoped to touched files. NEVER the full suite, project-wide lint, or full build.
|
|
52
|
-
- Fix failures in touched files and re-run VERIFY. Report failures originating outside SCOPE under `BLOCKED_BY`; do not edit those files.
|
|
53
|
-
- Never commit unless explicitly asked.
|
|
54
|
-
|
|
55
|
-
## Knowledge Exit
|
|
56
|
-
|
|
57
|
-
Knowledge is proposal-only. For a durable, non-obvious pattern or gotcha, return a substantive ready-to-run proposal for orchestrator persistence at fan-in; do not execute `arcs knowledge upsert` yourself. Skip mechanical or easily re-derived observations.
|
|
58
|
-
|
|
59
|
-
`arcs knowledge template --kind=<kind> --json`; `arcs knowledge upsert <slug> "<title>" --kind=<pattern|gotcha|lesson|architecture|decision> --summary="<summary>" --body="<substantive filled template>" --keywords="<keywords>" --source-files="<path[:anchor]>" --json`
|
|
60
|
-
|
|
61
|
-
Upsert is idempotent by title.
|
|
35
|
+
Report changed files, verification actually run, remaining risk, and blockers.
|
|
@@ -1,160 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: init-project
|
|
3
|
-
description:
|
|
3
|
+
description: Initialize a repository as an ARCS project with useful minimal metadata
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Initialize Project
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Method
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
An explicit request to init or track a project authorizes local ARCS initialization. Ask only for missing user-owned identity such as name, description, workspace path, or dependency choice.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
1. Check slug conflicts with `arcs project list`.
|
|
13
|
+
2. Verify named dependency projects exist.
|
|
14
|
+
3. Run `arcs project init` with the requested metadata.
|
|
15
|
+
4. Add only requested or clearly useful overview/dependency documentation.
|
|
16
|
+
5. Validate the new project and report slug and paths.
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
Codegraph is optional. When available, initialization may index the workspace and emit structural proposals. When absent, continue without it. If `pending_enrichment` is true, process useful proposals with `enriching-codegraph-proposals`; no broad agent fan-out required.
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
flowchart TD
|
|
18
|
-
classDef sub fill:#8b5cf6,color:#fff
|
|
20
|
+
Raw proposals are not knowledge. Inspect before keep, merge, drop, or promote decisions. Never infer destructive cleanup, deployment, publication, or Git permission from initialization.
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
B --> C[Present summary to user]
|
|
22
|
-
C -->|user confirms| D[arcs project init]
|
|
23
|
-
D --> E[arcs project update-doc × 4]
|
|
24
|
-
E --> F{codegraph on PATH?}
|
|
25
|
-
F -->|yes| G[codegraph index --force --quiet]
|
|
26
|
-
F -->|no| H[Skip graph step, log gap]
|
|
27
|
-
G --> G2[ingestGraph → ≤20 proposals]
|
|
28
|
-
G2 --> G3[Enrich queue: list → keep/merge/drop → promote/drop]
|
|
29
|
-
G3 --> I[Fan out: tech-architect analysis + research modes]:::sub
|
|
30
|
-
H --> I
|
|
31
|
-
I --> K[Done]
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## CLI Primer
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
arcs project init "Foo" --description="..." --path="$(pwd)" --json
|
|
38
|
-
```
|
|
39
|
-
Discovery: `arcs --commands --json`. Mutating commands run directly — no token.
|
|
40
|
-
|
|
41
|
-
## Constraints
|
|
42
|
-
|
|
43
|
-
- Do NOT read repo to infer name/description — gather from user
|
|
44
|
-
- Verify `dependsOn` targets exist via `arcs project list --json`
|
|
45
|
-
- `arcs project init` creates empty `plans/`, `knowledge/`, `tasks/` indexes — don't pre-populate
|
|
46
|
-
- Repo analysis is **fan-out across typed agents**, never a generic "analysis sub-agent" (see Agent Dispatch below)
|
|
47
|
-
- Never block INIT on codegraph — it's optional. Skip cleanly if missing.
|
|
48
|
-
|
|
49
|
-
## Codegraph Sub-Flow (DEFAULT: ON when binary present)
|
|
50
|
-
|
|
51
|
-
The orchestrator runs codegraph directly during INIT to produce structural **proposals** before any sub-agent reads code. Proposals are durable on the proposal-store ledger; agents enrich them into knowledge entries via the `enriching-codegraph-proposals` skill. This is the default path when `codegraph` is on PATH; skip cleanly otherwise.
|
|
52
|
-
|
|
53
|
-
1. **Detect:** call `detectCodegraph()` from `src/utils/codegraph.ts`. If unavailable, log "codegraph not on PATH; proceeding without graph signal" and skip steps 3–6.
|
|
54
|
-
2. **Trust the gitignore guarantee:** `runIndex()` already auto-appends `.codegraph/` to `.gitignore` via `ensureGitignoreEntry`. Do NOT redundantly check or modify `.gitignore` from agents — running the index is sufficient.
|
|
55
|
-
3. **Index** (project-based; CLI drives the bundled runtime — no LLM API key required):
|
|
56
|
-
```bash
|
|
57
|
-
codegraph index <workspacePath> --force --quiet
|
|
58
|
-
```
|
|
59
|
-
Builds a per-project codegraph index under `<workspacePath>/.codegraph/`.
|
|
60
|
-
4. **Ingest as proposals:** `arcs project init` internally calls `ingestGraph(slug)`, which parses codegraph CLI `--json` output and writes up to 20 structural proposals to `proposals/graphify.json` (filename retained for compatibility; rename pending; test files filtered):
|
|
61
|
-
- 8 god nodes (`kind=module`, ranked by callers+callees / impact as a proxy for degree)
|
|
62
|
-
- 8 architecture clusters (`kind=architecture`, synthesized pseudo-communities by directory prefix — codegraph has no community/cluster export)
|
|
63
|
-
- 5 cross-module couplings (`kind=gotcha`, high-degree links across top-level dirs; relations hard-coded as `["calls"]`)
|
|
64
|
-
|
|
65
|
-
Codegraph never writes directly to the knowledge surface. The init envelope returns `data.codegraph.pending_enrichment: true` to signal that proposals are waiting.
|
|
66
|
-
5. **Enrich** with the `enriching-codegraph-proposals` skill — read `arcs proposal list <slug> --json`, decide per-proposal verdicts (keep / merge / drop), and return exact proposed promote/drop commands for orchestrator application. Pending codegraph proposals never bypass this lifecycle into knowledge.
|
|
67
|
-
6. **Optional graph queries** for evidence during enrichment (sub-agents may run these via the codegraph MCP server, which auto-syncs through its own file watcher):
|
|
68
|
-
- `codegraph_search "entry points and main commands"` → seeds for "key files" reference entries
|
|
69
|
-
- `codegraph_explore` on core modules → seeds for "core modules" entries
|
|
70
|
-
- `codegraph_node "<godNodeLabel>"` → structural summary for module entry bodies
|
|
71
|
-
- `codegraph_impact "<critical-symbol>"` → reverse-impact map for high-risk modules
|
|
72
|
-
- `codegraph_callers` / `codegraph_callees "<symbol>"` → dependency paths for architecture entries
|
|
73
|
-
7. **Hand to typed agents** (in parallel) for independently authored, code-grounded follow-up entries beyond the proposal queue — see **Agent Dispatch** below.
|
|
74
|
-
|
|
75
|
-
## Content Guidelines
|
|
76
|
-
|
|
77
|
-
| Doc | Format |
|
|
78
|
-
|-----|--------|
|
|
79
|
-
| `overview.md` | 2-3 sentence summary + goals |
|
|
80
|
-
| `tasks.md` | `[ ]` backlog / `[/]` in-progress / `[x]` done |
|
|
81
|
-
| `dependencies.md` | Upstream + downstream sections |
|
|
82
|
-
| `knowledge.md` | High-level context + pointers to structured entries |
|
|
83
|
-
|
|
84
|
-
Update via `arcs project update-doc <slug> <doc> --content="..."`.
|
|
85
|
-
|
|
86
|
-
## Agent Dispatch (named typed agents — DO NOT default to a generic analysis agent)
|
|
87
|
-
|
|
88
|
-
| Sub-agent | Owns | Knowledge kinds it produces |
|
|
89
|
-
|-----------|------|----------------------------|
|
|
90
|
-
| `tech-architect` (analysis mode) | Module boundaries, clusters, dependency direction, cross-module couplings, structural gotchas, lessons | `architecture`, `module`, `gotcha`, `lesson` |
|
|
91
|
-
| `tech-architect` (`AGENT_MODE: research`) | Tech stack, third-party libraries, key files, features | `reference`, `feature` |
|
|
92
|
-
| `code-reviewer` (audit mode, optional) | Coding-style + convention scan from existing code | `pattern` |
|
|
93
|
-
|
|
94
|
-
Dispatch in parallel — all agents in one message, per the orchestrator's Parallelism rules. Each agent receives:
|
|
95
|
-
- The relevant `KnowledgeProposal` records from `ingestGraph` (so they don't rediscover what codegraph already found)
|
|
96
|
-
- Targeted codegraph queries for evidence (e.g., `codegraph_node` / `codegraph_impact` output for the modules they own)
|
|
97
|
-
- Explicit scope (which files / which kinds to produce)
|
|
98
|
-
|
|
99
|
-
Raw `KnowledgeProposal` records stay in the proposal lifecycle above. Each typed agent may instead return an independently authored finding: `{title, kind, summary, keywords, sourceFiles, body}`. Workers do not execute `arcs knowledge upsert`; after deduplication they return substantive ready-to-run commands for orchestrator fan-in persistence.
|
|
100
|
-
|
|
101
|
-
## Knowledge Categories for Analysis Sub-Agents
|
|
102
|
-
|
|
103
|
-
| Category | Kind | What to discover | Primary agent |
|
|
104
|
-
|----------|------|------------------|---------------|
|
|
105
|
-
| tech stack | `architecture` | Languages, frameworks, runtimes, build tools, versions | `tech-architect` (`AGENT_MODE: research`) |
|
|
106
|
-
| key files | `reference` | Entry points, config files, main modules, purposes | `tech-architect` (`AGENT_MODE: research`; use `codegraph_search "entry points"`) |
|
|
107
|
-
| code patterns | `pattern` | Recurring design patterns, abstractions, error handling | `code-reviewer` (audit mode) or `tech-architect` |
|
|
108
|
-
| coding style | `pattern` | Formatting, linting, import ordering, file organization | `code-reviewer` (audit mode) |
|
|
109
|
-
| core modules | `module` | Core modules / shared functions — what, where, interconnections | `tech-architect` (god nodes from codegraph) |
|
|
110
|
-
| external services | `module` | APIs, databases, message queues the project interacts with | `tech-architect` (`AGENT_MODE: research`) |
|
|
111
|
-
| third-party libraries | `reference` | Key dependencies and why they are used | `tech-architect` (`AGENT_MODE: research`) |
|
|
112
|
-
| features | `feature` | Major user-facing or system-facing features | `tech-architect` (`AGENT_MODE: research`) |
|
|
113
|
-
| cross-module couplings | `gotcha` | Hot edges between modules surfaced by codegraph | `tech-architect` (auto from `ingestGraph`) |
|
|
114
|
-
| architecture clusters | `architecture` | Pseudo-community / directory groupings from codegraph | `tech-architect` (auto from `ingestGraph`) |
|
|
115
|
-
|
|
116
|
-
## Worked Example
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
# 1. Conflict check
|
|
120
|
-
arcs project list --json
|
|
121
|
-
|
|
122
|
-
# 2. Present summary to user; on confirmation, init
|
|
123
|
-
arcs project init "Foo" --description="Foo CLI tool" --path="$(pwd)" --json
|
|
124
|
-
|
|
125
|
-
# 3. Update docs
|
|
126
|
-
arcs project update-doc foo overview --content="..." --json
|
|
127
|
-
# ... repeat for tasks, dependencies, knowledge
|
|
128
|
-
|
|
129
|
-
# 4. Codegraph (if available) — runs inside `arcs project init`
|
|
130
|
-
codegraph index . --force --quiet
|
|
131
|
-
# ingestGraph parses codegraph CLI --json → proposals/graphify.json (filename retained; rename pending)
|
|
132
|
-
# init envelope: data.codegraph.pending_enrichment === true → load
|
|
133
|
-
# `enriching-codegraph-proposals` and run the verdict loop:
|
|
134
|
-
arcs proposal list foo --json
|
|
135
|
-
# keep: promote only after authoring the required title, summary, body, and source files
|
|
136
|
-
arcs proposal promote foo <id> --title="..." --summary="..." --body-file=... --kind=module --source-files=... --json
|
|
137
|
-
# merge: promote with --merge-with=<existing-knowledge-id> and append graph evidence
|
|
138
|
-
arcs proposal promote foo <id> --merge-with=<existing-knowledge-id> --body-file=... --source-files=... --json
|
|
139
|
-
arcs proposal drop foo <id> --reason="..." --json
|
|
140
|
-
|
|
141
|
-
# 5. Fan out typed agents (parallel) for entries beyond proposal scope
|
|
142
|
-
# tech-architect (analysis mode) → architecture/module/gotcha/lesson entries
|
|
143
|
-
# tech-architect (AGENT_MODE: research) → reference/feature entries
|
|
144
|
-
|
|
145
|
-
# 6. Propose only independently authored, non-proposal-derived findings.
|
|
146
|
-
# Obtain the kind-specific body anatomy before authoring the ready-to-run command:
|
|
147
|
-
arcs knowledge template --kind=architecture --json
|
|
148
|
-
arcs knowledge upsert foo "Tech stack: TypeScript + Node 20" --kind=architecture --summary="..." --body-file=... --source-files=package.json --json
|
|
149
|
-
# Return the upsert; do not execute it. The orchestrator persists it at fan-in.
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Exit Conditions
|
|
153
|
-
|
|
154
|
-
| Condition | Action |
|
|
155
|
-
|-----------|--------|
|
|
156
|
-
| Project already in DAG (slug collision) | Stop. Surface conflict; ask user to rename or use existing |
|
|
157
|
-
| User declines summary | Stop. No mutations performed |
|
|
158
|
-
| `codegraph` missing | Continue without graph signal; sub-agents run with code reading only |
|
|
159
|
-
| `dependsOn` target missing | Stop. Ask user to init dependencies first or remove the link |
|
|
160
|
-
| Init succeeds but knowledge fan-out fails | Project exists in DAG; rerun knowledge phase later via SYNC |
|
|
22
|
+
If a write fails, stop and report partial state instead of layering more mutations on an uncertain project.
|
|
@@ -1,162 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: systematic-debugging
|
|
3
|
-
description:
|
|
3
|
+
description: Diagnose bugs and failing tests from evidence before changing code
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Systematic Debugging
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Method
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Observe → reproduce → isolate → regression test → fix → verify.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
1. **Observe:** read the full error, logs, inputs, and recent relevant changes.
|
|
13
|
+
2. **Reproduce:** find the smallest reliable reproduction. Add instrumentation when needed.
|
|
14
|
+
3. **Isolate:** trace backward, compare a working path, and test one hypothesis at a time.
|
|
15
|
+
4. **Regression test:** encode the failure when practical.
|
|
16
|
+
5. **Fix:** change the root cause with the smallest targeted patch.
|
|
17
|
+
6. **Verify:** show the reproduction and relevant checks pass.
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
If three failed fixes do not improve evidence, stop and question architecture or assumptions instead of stacking another guess.
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
flowchart TD
|
|
18
|
-
classDef decision fill:#f59e0b,color:#fff
|
|
19
|
-
classDef stop fill:#ef4444,color:#fff
|
|
21
|
+
Use ARCS knowledge only when a prior gotcha may save time. Capturing durable discovery is optional, not part of success.
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
ARCS --> Found{Match found?}
|
|
23
|
-
Found -->|Yes| Verify[Verify it applies]
|
|
24
|
-
Found -->|No| Observe
|
|
25
|
-
|
|
26
|
-
Verify -->|Applies| Isolate
|
|
27
|
-
Verify -->|Doesn't apply| Observe
|
|
28
|
-
|
|
29
|
-
Observe[Phase 1: Observe] --> Repro{Reproducible?}
|
|
30
|
-
Repro -->|No| Instrument[Add logging/tracing]
|
|
31
|
-
Instrument --> Observe
|
|
32
|
-
Repro -->|Yes| Hypothesize[Phase 2: Hypothesize]
|
|
33
|
-
|
|
34
|
-
Hypothesize --> Compare[Find working example, list differences]
|
|
35
|
-
Compare --> Theory[Form single specific hypothesis]
|
|
36
|
-
|
|
37
|
-
Theory --> Isolate[Phase 3: Isolate]
|
|
38
|
-
Isolate --> Test{Root cause isolated?}
|
|
39
|
-
Test -->|Yes| WriteFail[Write failing regression test]
|
|
40
|
-
Test -->|No| FailCount{3+ failures?}
|
|
41
|
-
FailCount -->|No| Theory
|
|
42
|
-
FailCount -->|Yes| Arch[Question architecture]
|
|
43
|
-
|
|
44
|
-
WriteFail --> Implement[Single targeted fix]
|
|
45
|
-
Implement --> Green{Scoped verification passes?}
|
|
46
|
-
Green -->|Yes| Capture[Propose resolution as ARCS knowledge]
|
|
47
|
-
Green -->|No| FailCount
|
|
48
|
-
|
|
49
|
-
class Found,Repro,Test,FailCount,Green decision
|
|
50
|
-
class Arch stop
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Phase 1: Observe (Root Cause Investigation)
|
|
54
|
-
|
|
55
|
-
- Read the actual error message completely
|
|
56
|
-
- Reproduce consistently before proceeding
|
|
57
|
-
- Check recent changes (`git log`, `git diff`)
|
|
58
|
-
- Trace data flow backward from failure point
|
|
59
|
-
- Instrument component boundaries if cause unclear
|
|
60
|
-
- **Pre-step:** `arcs knowledge search <slug> "<error>" --json` for gotcha/lesson/pattern entries
|
|
61
|
-
|
|
62
|
-
## Phase 2: Hypothesize (Pattern Analysis)
|
|
63
|
-
|
|
64
|
-
- Find a working example in the same codebase
|
|
65
|
-
- Compare working vs broken — list every difference
|
|
66
|
-
- Understand the dependency chain
|
|
67
|
-
- Form ONE specific hypothesis (not multiple)
|
|
68
|
-
|
|
69
|
-
## Phase 3: Root Cause Isolation
|
|
70
|
-
|
|
71
|
-
- Test the hypothesis with the smallest possible diagnostic change
|
|
72
|
-
- One variable at a time — never stack fixes
|
|
73
|
-
- If hypothesis fails, form a new one from evidence
|
|
74
|
-
- Do not proceed until the evidence isolates the root cause
|
|
75
|
-
- **Escalation:** 3+ failed fixes → question the architecture, not the symptom
|
|
76
|
-
|
|
77
|
-
## Phase 4: Fix
|
|
78
|
-
|
|
79
|
-
- Write a failing regression test FIRST (proves the bug exists and prevents a fix-before-test path)
|
|
80
|
-
- Implement a single targeted fix
|
|
81
|
-
- Run scoped verification for the files you changed (your dispatch VERIFY command — never the full suite; the devil-advocate completion gate owns that)
|
|
82
|
-
- Prepare the resolution as an ARCS knowledge proposal after verification passes; do not execute `arcs knowledge upsert`
|
|
83
|
-
- If your fix introduces new failures in YOUR scoped tests, revert and return to Phase 2. Failures in files outside your scope are report-only (BLOCKED_BY) — likely a sibling agent's in-flight work; never fix or revert it
|
|
84
|
-
|
|
85
|
-
## Log Triage Protocol
|
|
86
|
-
|
|
87
|
-
**Scan order:** failure point → errors → warnings → timing anomalies
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
rg -n "ERROR|FATAL|panic|exception" <logfile> # Error grep
|
|
91
|
-
jq 'select(.level == "error")' <json-log> # Structured logs
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**Output:** Timeline of events leading to failure (T-5m, T-3m, T-0).
|
|
95
|
-
|
|
96
|
-
## Git Bisect (Regressions)
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
git bisect start
|
|
100
|
-
git bisect bad HEAD
|
|
101
|
-
git bisect good <last-known-good>
|
|
102
|
-
git bisect run <test-command>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
After finding the commit: read the diff, isolate specific lines, feed into Phase 2.
|
|
106
|
-
|
|
107
|
-
## Dependency Conflict Diagnosis
|
|
108
|
-
|
|
109
|
-
| Symptom | Likely Cause |
|
|
110
|
-
|---------|-------------|
|
|
111
|
-
| `instanceof` fails across modules | Duplicate package copies |
|
|
112
|
-
| Type mismatch on same interface | Different versions loaded |
|
|
113
|
-
| "Cannot find module" intermittent | Hoisting conflict |
|
|
114
|
-
| Works with `--legacy-peer-deps` | Peer dep unsatisfied |
|
|
115
|
-
|
|
116
|
-
Diagnose: `npm ls <pkg>`, `npm explain <pkg>`, check for multiple copies.
|
|
117
|
-
|
|
118
|
-
## ARCS Knowledge Capture
|
|
119
|
-
|
|
120
|
-
After root cause identification, propose durable knowledge for orchestrator fan-in persistence:
|
|
121
|
-
- **gotcha** — environmental/config traps
|
|
122
|
-
- **lesson** — architectural insights from this session
|
|
123
|
-
- **pattern** — reusable solution to recurring problem
|
|
124
|
-
|
|
125
|
-
Include: root cause summary, evidence, affected files, fix approach.
|
|
126
|
-
|
|
127
|
-
### Propose Resolution as Knowledge
|
|
128
|
-
|
|
129
|
-
After resolving the issue, choose the kind and obtain its required anatomy before authoring a complete entry:
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
arcs knowledge template --kind=gotcha --json
|
|
133
|
-
# Fill every returned section with observed evidence, affected files, and the fix approach.
|
|
134
|
-
arcs knowledge upsert <slug> "<specific debugging discovery>" \
|
|
135
|
-
--kind=gotcha --summary="<durable takeaway>" --body-file=<complete-body.md> \
|
|
136
|
-
--keywords="<error,component,root-cause>" --source-files=<affected-paths> --json
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Return that command as a ready-to-run proposal. Do not execute `arcs knowledge upsert`; the orchestrator owns fan-in persistence. Use the same template-first flow for `lesson` and `pattern`; do not copy a body-shaped example that omits the selected kind's required sections.
|
|
140
|
-
|
|
141
|
-
**Kind selection guide:**
|
|
142
|
-
- `gotcha` — surprising behavior, trap, or non-obvious failure mode
|
|
143
|
-
- `lesson` — learned technique, debugging approach, resolution method
|
|
144
|
-
- `pattern` — reusable solution that should be applied going forward
|
|
145
|
-
|
|
146
|
-
## Constraints
|
|
147
|
-
|
|
148
|
-
- **NO FIXES WITHOUT ROOT CAUSE INVESTIGATION.** If Phase 1 incomplete, you cannot propose fixes.
|
|
149
|
-
- **One variable at a time.** Never apply multiple changes simultaneously.
|
|
150
|
-
- **3+ failures = architectural problem.** Stop fixing symptoms, question the pattern.
|
|
151
|
-
- **Test before fix.** Failing test proves the bug; green test proves the fix.
|
|
152
|
-
- **Defense in depth:** After fixing root cause, add validation at multiple layers to prevent recurrence.
|
|
153
|
-
- **Systematic is faster than thrashing.** 15-30min systematic vs 2-3h random fixes.
|
|
154
|
-
|
|
155
|
-
## Red Flags (Return to Phase 1)
|
|
156
|
-
|
|
157
|
-
- "Quick fix for now, investigate later"
|
|
158
|
-
- "Just try changing X and see"
|
|
159
|
-
- Proposing solutions before tracing data flow
|
|
160
|
-
- Each fix reveals a new problem in a different place
|
|
161
|
-
- "I don't fully understand but this might work"
|
|
162
|
-
- Human says "stop guessing" or "is that not happening?"
|
|
23
|
+
Optional references provide concise techniques for tracing, waiting, and defense in depth. Do not run destructive Git operations unless the user requests them.
|
|
@@ -1,115 +1,12 @@
|
|
|
1
1
|
# Condition-Based Waiting
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Wait for an observable condition, not an arbitrary duration.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use a bounded poll or event with:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- a clear success condition;
|
|
8
|
+
- a timeout;
|
|
9
|
+
- useful timeout evidence;
|
|
10
|
+
- cleanup for listeners or timers.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```dot
|
|
12
|
-
digraph when_to_use {
|
|
13
|
-
"Test uses setTimeout/sleep?" [shape=diamond];
|
|
14
|
-
"Testing timing behavior?" [shape=diamond];
|
|
15
|
-
"Document WHY timeout needed" [shape=box];
|
|
16
|
-
"Use condition-based waiting" [shape=box];
|
|
17
|
-
|
|
18
|
-
"Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
|
|
19
|
-
"Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
|
|
20
|
-
"Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Use when:**
|
|
25
|
-
- Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
|
|
26
|
-
- Tests are flaky (pass sometimes, fail under load)
|
|
27
|
-
- Tests timeout when run in parallel
|
|
28
|
-
- Waiting for async operations to complete
|
|
29
|
-
|
|
30
|
-
**Don't use when:**
|
|
31
|
-
- Testing actual timing behavior (debounce, throttle intervals)
|
|
32
|
-
- Always document WHY if using arbitrary timeout
|
|
33
|
-
|
|
34
|
-
## Core Pattern
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
// ❌ BEFORE: Guessing at timing
|
|
38
|
-
await new Promise(r => setTimeout(r, 50));
|
|
39
|
-
const result = getResult();
|
|
40
|
-
expect(result).toBeDefined();
|
|
41
|
-
|
|
42
|
-
// ✅ AFTER: Waiting for condition
|
|
43
|
-
await waitFor(() => getResult() !== undefined);
|
|
44
|
-
const result = getResult();
|
|
45
|
-
expect(result).toBeDefined();
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Quick Patterns
|
|
49
|
-
|
|
50
|
-
| Scenario | Pattern |
|
|
51
|
-
|----------|---------|
|
|
52
|
-
| Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
|
|
53
|
-
| Wait for state | `waitFor(() => machine.state === 'ready')` |
|
|
54
|
-
| Wait for count | `waitFor(() => items.length >= 5)` |
|
|
55
|
-
| Wait for file | `waitFor(() => fs.existsSync(path))` |
|
|
56
|
-
| Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
|
|
57
|
-
|
|
58
|
-
## Implementation
|
|
59
|
-
|
|
60
|
-
Generic polling function:
|
|
61
|
-
```typescript
|
|
62
|
-
async function waitFor<T>(
|
|
63
|
-
condition: () => T | undefined | null | false,
|
|
64
|
-
description: string,
|
|
65
|
-
timeoutMs = 5000
|
|
66
|
-
): Promise<T> {
|
|
67
|
-
const startTime = Date.now();
|
|
68
|
-
|
|
69
|
-
while (true) {
|
|
70
|
-
const result = condition();
|
|
71
|
-
if (result) return result;
|
|
72
|
-
|
|
73
|
-
if (Date.now() - startTime > timeoutMs) {
|
|
74
|
-
throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
See `condition-based-waiting-example.ts` in this directory for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
|
|
83
|
-
|
|
84
|
-
## Common Mistakes
|
|
85
|
-
|
|
86
|
-
**❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
|
|
87
|
-
**✅ Fix:** Poll every 10ms
|
|
88
|
-
|
|
89
|
-
**❌ No timeout:** Loop forever if condition never met
|
|
90
|
-
**✅ Fix:** Always include timeout with clear error
|
|
91
|
-
|
|
92
|
-
**❌ Stale data:** Cache state before loop
|
|
93
|
-
**✅ Fix:** Call getter inside loop for fresh data
|
|
94
|
-
|
|
95
|
-
## When Arbitrary Timeout IS Correct
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
// Tool ticks every 100ms - need 2 ticks to verify partial output
|
|
99
|
-
await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
|
|
100
|
-
await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
|
|
101
|
-
// 200ms = 2 ticks at 100ms intervals - documented and justified
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Requirements:**
|
|
105
|
-
1. First wait for triggering condition
|
|
106
|
-
2. Based on known timing (not guessing)
|
|
107
|
-
3. Comment explaining WHY
|
|
108
|
-
|
|
109
|
-
## Real-World Impact
|
|
110
|
-
|
|
111
|
-
From debugging session (2025-10-03):
|
|
112
|
-
- Fixed 15 flaky tests across 3 files
|
|
113
|
-
- Pass rate: 60% → 100%
|
|
114
|
-
- Execution time: 40% faster
|
|
115
|
-
- No more race conditions
|
|
12
|
+
Fixed sleeps are acceptable only when time itself is the behavior under test.
|