homegraph 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +268 -243
- package/dist/arkts/ohos-api-index.d.ts +15 -0
- package/dist/arkts/ohos-api-index.d.ts.map +1 -0
- package/dist/arkts/ohos-api-index.js +190 -0
- package/dist/arkts/ohos-api-index.js.map +1 -0
- package/dist/arkts/ohos-sdk-input.d.ts +36 -0
- package/dist/arkts/ohos-sdk-input.d.ts.map +1 -0
- package/dist/arkts/ohos-sdk-input.js +214 -0
- package/dist/arkts/ohos-sdk-input.js.map +1 -0
- package/dist/bin/command-supervision.d.ts +12 -0
- package/dist/bin/command-supervision.d.ts.map +1 -0
- package/dist/bin/command-supervision.js +86 -0
- package/dist/bin/command-supervision.js.map +1 -0
- package/dist/bin/homegraph.d.ts +1 -1
- package/dist/bin/homegraph.js +971 -71
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/db/index.d.ts +20 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +39 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +58 -19
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +14 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +314 -143
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +172 -152
- package/dist/directory.d.ts +32 -0
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +88 -5
- package/dist/directory.js.map +1 -1
- package/dist/extraction/arkts-batch-worker.d.ts +2 -0
- package/dist/extraction/arkts-batch-worker.d.ts.map +1 -0
- package/dist/extraction/arkts-batch-worker.js +28 -0
- package/dist/extraction/arkts-batch-worker.js.map +1 -0
- package/dist/extraction/context.d.ts +11 -0
- package/dist/extraction/context.d.ts.map +1 -1
- package/dist/extraction/context.js +20 -0
- package/dist/extraction/context.js.map +1 -1
- package/dist/extraction/index.d.ts +16 -2
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +619 -380
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +13 -0
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +1 -0
- package/dist/extraction/languages/arkts-state-decorators.js +26 -0
- package/dist/extraction/languages/arkts-state-decorators.js.map +1 -0
- package/dist/extraction/languages/arkts-viewtree.d.ts +4 -2
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +21 -6
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +98 -2
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1290 -61
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +56 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +198 -1
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/ohos-api-consumer.d.ts +34 -0
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +1 -0
- package/dist/extraction/languages/ohos-api-consumer.js +283 -0
- package/dist/extraction/languages/ohos-api-consumer.js.map +1 -0
- package/dist/extraction/parse-pool.d.ts +126 -0
- package/dist/extraction/parse-pool.d.ts.map +1 -0
- package/dist/extraction/parse-pool.js +319 -0
- package/dist/extraction/parse-pool.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +17 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +21 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +198 -27
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +76 -17
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -4
- package/dist/index.js.map +1 -1
- package/dist/installer/instructions-template.js +9 -9
- package/dist/installer/targets/shared.d.ts +5 -6
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +5 -6
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +30 -3
- package/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.js +50 -10
- package/dist/mcp/daemon-paths.js.map +1 -1
- package/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/dist/mcp/daemon-registry.js +7 -3
- package/dist/mcp/daemon-registry.js.map +1 -1
- package/dist/mcp/daemon.d.ts +48 -0
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +196 -32
- package/dist/mcp/daemon.js.map +1 -1
- package/dist/mcp/engine.d.ts +17 -0
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +73 -1
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +25 -43
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/liveness-watchdog.js +16 -16
- package/dist/mcp/ppid-watchdog.d.ts +18 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -1
- package/dist/mcp/ppid-watchdog.js +37 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -1
- package/dist/mcp/query-cache.d.ts +25 -0
- package/dist/mcp/query-cache.d.ts.map +1 -0
- package/dist/mcp/query-cache.js +191 -0
- package/dist/mcp/query-cache.js.map +1 -0
- package/dist/mcp/query-pool.d.ts +94 -0
- package/dist/mcp/query-pool.d.ts.map +1 -0
- package/dist/mcp/query-pool.js +297 -0
- package/dist/mcp/query-pool.js.map +1 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/query-worker.d.ts.map +1 -0
- package/dist/mcp/query-worker.js +87 -0
- package/dist/mcp/query-worker.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +5 -7
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +72 -74
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/tools.d.ts +94 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +877 -71
- package/dist/mcp/tools.js.map +1 -1
- package/dist/project-config.d.ts +20 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +42 -2
- package/dist/project-config.js.map +1 -1
- package/dist/reasoning/login.js +1 -1
- package/dist/reasoning/login.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/resolution/c-fnptr-synthesizer.d.ts +0 -28
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.js +765 -79
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +72 -11
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +32 -0
- package/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/dist/resolution/cooperative-yield.js +42 -0
- package/dist/resolution/cooperative-yield.js.map +1 -0
- package/dist/resolution/index.d.ts +11 -2
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +72 -4
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts +22 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +317 -20
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/spec/config.d.ts +39 -0
- package/dist/spec/config.d.ts.map +1 -0
- package/dist/spec/config.js +304 -0
- package/dist/spec/config.js.map +1 -0
- package/dist/spec/db/commit-node.d.ts +23 -0
- package/dist/spec/db/commit-node.d.ts.map +1 -0
- package/dist/spec/db/commit-node.js +62 -0
- package/dist/spec/db/commit-node.js.map +1 -0
- package/dist/spec/db/fragment-node.d.ts +24 -0
- package/dist/spec/db/fragment-node.d.ts.map +1 -0
- package/dist/spec/db/fragment-node.js +128 -0
- package/dist/spec/db/fragment-node.js.map +1 -0
- package/dist/spec/db/fts.d.ts +74 -0
- package/dist/spec/db/fts.d.ts.map +1 -0
- package/dist/spec/db/fts.js +324 -0
- package/dist/spec/db/fts.js.map +1 -0
- package/dist/spec/db/index.d.ts +13 -0
- package/dist/spec/db/index.d.ts.map +1 -0
- package/dist/spec/db/index.js +50 -0
- package/dist/spec/db/index.js.map +1 -0
- package/dist/spec/db/relations.d.ts +55 -0
- package/dist/spec/db/relations.d.ts.map +1 -0
- package/dist/spec/db/relations.js +158 -0
- package/dist/spec/db/relations.js.map +1 -0
- package/dist/spec/db/schema.d.ts +33 -0
- package/dist/spec/db/schema.d.ts.map +1 -0
- package/dist/spec/db/schema.js +119 -0
- package/dist/spec/db/schema.js.map +1 -0
- package/dist/spec/db/schema.sql +117 -0
- package/dist/spec/db/spec-node.d.ts +41 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -0
- package/dist/spec/db/spec-node.js +114 -0
- package/dist/spec/db/spec-node.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +13 -0
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -0
- package/dist/spec/evolve/impact-locator.js +25 -0
- package/dist/spec/evolve/impact-locator.js.map +1 -0
- package/dist/spec/evolve/llm-client.d.ts +50 -0
- package/dist/spec/evolve/llm-client.d.ts.map +1 -0
- package/dist/spec/evolve/llm-client.js +176 -0
- package/dist/spec/evolve/llm-client.js.map +1 -0
- package/dist/spec/evolve/logic-checker.d.ts +12 -0
- package/dist/spec/evolve/logic-checker.d.ts.map +1 -0
- package/dist/spec/evolve/logic-checker.js +24 -0
- package/dist/spec/evolve/logic-checker.js.map +1 -0
- package/dist/spec/evolve/pipeline.d.ts +42 -0
- package/dist/spec/evolve/pipeline.d.ts.map +1 -0
- package/dist/spec/evolve/pipeline.js +567 -0
- package/dist/spec/evolve/pipeline.js.map +1 -0
- package/dist/spec/evolve/spec-rewriter.d.ts +42 -0
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -0
- package/dist/spec/evolve/spec-rewriter.js +230 -0
- package/dist/spec/evolve/spec-rewriter.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +155 -0
- package/dist/spec/graph/queries.d.ts.map +1 -0
- package/dist/spec/graph/queries.js +440 -0
- package/dist/spec/graph/queries.js.map +1 -0
- package/dist/spec/llm/client.d.ts +29 -0
- package/dist/spec/llm/client.d.ts.map +1 -0
- package/dist/spec/llm/client.js +123 -0
- package/dist/spec/llm/client.js.map +1 -0
- package/dist/spec/llm/index.d.ts +3 -0
- package/dist/spec/llm/index.d.ts.map +1 -0
- package/dist/spec/llm/index.js +11 -0
- package/dist/spec/llm/index.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +13 -0
- package/dist/spec/llm/prompts.d.ts.map +1 -0
- package/dist/spec/llm/prompts.js +75 -0
- package/dist/spec/llm/prompts.js.map +1 -0
- package/dist/spec/mining/diff-parser.d.ts +33 -0
- package/dist/spec/mining/diff-parser.d.ts.map +1 -0
- package/dist/spec/mining/diff-parser.js +166 -0
- package/dist/spec/mining/diff-parser.js.map +1 -0
- package/dist/spec/mining/git-scanner.d.ts +103 -0
- package/dist/spec/mining/git-scanner.d.ts.map +1 -0
- package/dist/spec/mining/git-scanner.js +307 -0
- package/dist/spec/mining/git-scanner.js.map +1 -0
- package/dist/spec/mining/pipeline.d.ts +53 -0
- package/dist/spec/mining/pipeline.d.ts.map +1 -0
- package/dist/spec/mining/pipeline.js +178 -0
- package/dist/spec/mining/pipeline.js.map +1 -0
- package/dist/spec/mining/scope-resolver.d.ts +45 -0
- package/dist/spec/mining/scope-resolver.d.ts.map +1 -0
- package/dist/spec/mining/scope-resolver.js +103 -0
- package/dist/spec/mining/scope-resolver.js.map +1 -0
- package/dist/spec/mining/spec-extractor.d.ts +69 -0
- package/dist/spec/mining/spec-extractor.d.ts.map +1 -0
- package/dist/spec/mining/spec-extractor.js +369 -0
- package/dist/spec/mining/spec-extractor.js.map +1 -0
- package/dist/spec/types.d.ts +149 -0
- package/dist/spec/types.d.ts.map +1 -0
- package/dist/spec/types.js +15 -0
- package/dist/spec/types.js.map +1 -0
- package/dist/spec/utils.d.ts +167 -0
- package/dist/spec/utils.d.ts.map +1 -0
- package/dist/spec/utils.js +463 -0
- package/dist/spec/utils.js.map +1 -0
- package/dist/sync/worktree.d.ts +9 -0
- package/dist/sync/worktree.d.ts.map +1 -1
- package/dist/sync/worktree.js +40 -0
- package/dist/sync/worktree.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.d.ts +2 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.js +19 -2
- package/dist/ui/shimmer-progress.js.map +1 -1
- package/dist/upgrade/index.js +1 -1
- package/dist/upgrade/index.js.map +1 -1
- package/package.json +58 -57
- package/scripts/add-lang/bench.sh +60 -60
- package/scripts/add-lang/check-grammar.mjs +75 -75
- package/scripts/add-lang/dump-ast.mjs +103 -103
- package/scripts/add-lang/verify-extraction.mjs +70 -70
- package/scripts/agent-eval/ab-adoption.sh +91 -91
- package/scripts/agent-eval/ab-hook.sh +86 -86
- package/scripts/agent-eval/ab-impl.sh +78 -78
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
- package/scripts/agent-eval/ab-sufficiency.sh +78 -78
- package/scripts/agent-eval/arms-F.sh +21 -21
- package/scripts/agent-eval/arms-matrix.sh +37 -37
- package/scripts/agent-eval/audit.sh +68 -68
- package/scripts/agent-eval/bench-readme.sh +28 -28
- package/scripts/agent-eval/bench-why-repo.sh +22 -22
- package/scripts/agent-eval/block-read-hook.sh +19 -19
- package/scripts/agent-eval/hook-settings.json +15 -15
- package/scripts/agent-eval/itrun.sh +120 -120
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
- package/scripts/agent-eval/offload-eval-setup.sh +24 -24
- package/scripts/agent-eval/offload-eval-styles.sh +71 -71
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
- package/scripts/agent-eval/offload-eval.md +76 -76
- package/scripts/agent-eval/parse-arms.mjs +116 -116
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
- package/scripts/agent-eval/parse-run.mjs +45 -45
- package/scripts/agent-eval/parse-session.mjs +93 -93
- package/scripts/agent-eval/probe-context.mjs +21 -21
- package/scripts/agent-eval/probe-explore.mjs +40 -40
- package/scripts/agent-eval/probe-node.mjs +20 -20
- package/scripts/agent-eval/probe-sweep.mjs +119 -119
- package/scripts/agent-eval/probe-trace.mjs +20 -20
- package/scripts/agent-eval/redirect-read-hook.sh +38 -38
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +69 -69
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/build-bundle.sh +118 -118
- package/scripts/exp_boundary_eval/README.md +247 -0
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -0
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -0
- package/scripts/exp_boundary_eval/_utils.py +1116 -0
- package/scripts/exp_boundary_eval/analyze.py +1313 -0
- package/scripts/exp_boundary_eval/data/agents.json +109 -0
- package/scripts/exp_boundary_eval/data/experiments.json +140 -0
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -0
- package/scripts/exp_boundary_eval/run_all.py +378 -0
- package/scripts/exp_boundary_eval/run_one.py +165 -0
- package/scripts/exp_boundary_eval/run_session.py +158 -0
- package/scripts/exp_boundary_eval/setup.py +120 -0
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -0
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -0
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -0
- package/scripts/extract-release-notes.mjs +130 -130
- package/scripts/local-install.sh +41 -41
- package/scripts/npm-sdk.js +75 -75
- package/scripts/npm-shim.js +268 -246
- package/scripts/ohos-sdk-publish.mjs +133 -0
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/qa_eval/README.md +407 -404
- package/scripts/qa_eval/_test_deveco_probe.py +41 -41
- package/scripts/qa_eval/agent_runner.py +526 -526
- package/scripts/qa_eval/data/.gitignore +4 -4
- package/scripts/qa_eval/data/test-set.jsonl +2 -22
- package/scripts/qa_eval/eval_metrics.py +274 -233
- package/scripts/qa_eval/external_agent.py +976 -671
- package/scripts/qa_eval/llm_config.py +92 -92
- package/scripts/qa_eval/memory_monitor.py +132 -132
- package/scripts/qa_eval/my_answer_accuracy.py +187 -187
- package/scripts/qa_eval/requirements.txt +2 -2
- package/scripts/qa_eval/run_pipeline.py +804 -711
- package/scripts/qa_eval/stats_efficiency.py +279 -279
- package/scripts/qa_eval/stats_scores.py +207 -207
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Headless Claude Code run against a repo with homegraph MCP, capturing the
|
|
3
|
-
# full stream-json so we can see tool calls + token usage. Complements the
|
|
4
|
-
# interactive itrun.sh: headless gives a clean per-tool breakdown + exact
|
|
5
|
-
# tokens/cost, but defaults to the general-purpose subagent (not Explore).
|
|
6
|
-
# To force the Explore path, ask for it in the prompt.
|
|
7
|
-
#
|
|
8
|
-
# Usage: run-agent.sh <repo-path> <label> "<prompt>"
|
|
9
|
-
# Env: AGENT_EVAL_OUT (default /tmp/agent-eval), CG_BIN (homegraph dist binary)
|
|
10
|
-
set -uo pipefail
|
|
11
|
-
|
|
12
|
-
REPO="$1"; LABEL="$2"; PROMPT="$3"
|
|
13
|
-
CG_BIN="${CG_BIN:-$(command -v homegraph || echo /usr/local/bin/homegraph)}"
|
|
14
|
-
OUT_DIR="${AGENT_EVAL_OUT:-/tmp/agent-eval}"; mkdir -p "$OUT_DIR"
|
|
15
|
-
OUT="$OUT_DIR/run-${LABEL}.jsonl"
|
|
16
|
-
|
|
17
|
-
MCP_CONFIG=$(cat <<JSON
|
|
18
|
-
{"mcpServers":{"homegraph":{"command":"${CG_BIN}","args":["serve","--mcp","--path","${REPO}"]}}}
|
|
19
|
-
JSON
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
echo "→ running [$LABEL] in $REPO"
|
|
23
|
-
cd "$REPO" || exit 1
|
|
24
|
-
|
|
25
|
-
claude -p "$PROMPT" \
|
|
26
|
-
--output-format stream-json --verbose \
|
|
27
|
-
--permission-mode bypassPermissions \
|
|
28
|
-
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
29
|
-
--max-budget-usd 2 \
|
|
30
|
-
--strict-mcp-config --mcp-config "$MCP_CONFIG" \
|
|
31
|
-
> "$OUT" 2>"$OUT_DIR/run-${LABEL}.err"
|
|
32
|
-
|
|
33
|
-
echo "exit: $? | wrote $OUT ($(wc -l < "$OUT") lines)"
|
|
34
|
-
node "$(cd "$(dirname "$0")" && pwd)/parse-run.mjs" "$OUT" 2>/dev/null || true
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Headless Claude Code run against a repo with homegraph MCP, capturing the
|
|
3
|
+
# full stream-json so we can see tool calls + token usage. Complements the
|
|
4
|
+
# interactive itrun.sh: headless gives a clean per-tool breakdown + exact
|
|
5
|
+
# tokens/cost, but defaults to the general-purpose subagent (not Explore).
|
|
6
|
+
# To force the Explore path, ask for it in the prompt.
|
|
7
|
+
#
|
|
8
|
+
# Usage: run-agent.sh <repo-path> <label> "<prompt>"
|
|
9
|
+
# Env: AGENT_EVAL_OUT (default /tmp/agent-eval), CG_BIN (homegraph dist binary)
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
|
|
12
|
+
REPO="$1"; LABEL="$2"; PROMPT="$3"
|
|
13
|
+
CG_BIN="${CG_BIN:-$(command -v homegraph || echo /usr/local/bin/homegraph)}"
|
|
14
|
+
OUT_DIR="${AGENT_EVAL_OUT:-/tmp/agent-eval}"; mkdir -p "$OUT_DIR"
|
|
15
|
+
OUT="$OUT_DIR/run-${LABEL}.jsonl"
|
|
16
|
+
|
|
17
|
+
MCP_CONFIG=$(cat <<JSON
|
|
18
|
+
{"mcpServers":{"homegraph":{"command":"${CG_BIN}","args":["serve","--mcp","--path","${REPO}"]}}}
|
|
19
|
+
JSON
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
echo "→ running [$LABEL] in $REPO"
|
|
23
|
+
cd "$REPO" || exit 1
|
|
24
|
+
|
|
25
|
+
claude -p "$PROMPT" \
|
|
26
|
+
--output-format stream-json --verbose \
|
|
27
|
+
--permission-mode bypassPermissions \
|
|
28
|
+
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
29
|
+
--max-budget-usd 2 \
|
|
30
|
+
--strict-mcp-config --mcp-config "$MCP_CONFIG" \
|
|
31
|
+
> "$OUT" 2>"$OUT_DIR/run-${LABEL}.err"
|
|
32
|
+
|
|
33
|
+
echo "exit: $? | wrote $OUT ($(wc -l < "$OUT") lines)"
|
|
34
|
+
node "$(cd "$(dirname "$0")" && pwd)/parse-run.mjs" "$OUT" 2>/dev/null || true
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# With/without A/B (and optional interactive) eval for a homegraph version on a
|
|
3
|
-
# repo. Codegraph is the ONLY variable: both arms launch claude with
|
|
4
|
-
# --strict-mcp-config — with = homegraph-only MCP (pointed at $CG_BIN),
|
|
5
|
-
# without = empty MCP. Built-in Read/Grep/Bash stay available in both arms.
|
|
6
|
-
#
|
|
7
|
-
# Usage: run-all.sh <repo-path> "<question>" [headless|tmux|all]
|
|
8
|
-
# Env: CG_BIN homegraph binary (default: command -v homegraph)
|
|
9
|
-
# AGENT_EVAL_OUT output dir (default: /tmp/agent-eval)
|
|
10
|
-
# MODEL / EFFORT claude model/effort (default: sonnet / high — the
|
|
11
|
-
# standing A/B policy; see CLAUDE.md, don't raise)
|
|
12
|
-
set -uo pipefail
|
|
13
|
-
|
|
14
|
-
REPO="${1:?usage: run-all.sh <repo-path> \"<question>\" [headless|tmux|all]}"
|
|
15
|
-
Q="${2:?question required}"
|
|
16
|
-
MODE="${3:-headless}"
|
|
17
|
-
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
18
|
-
OUT="${AGENT_EVAL_OUT:-/tmp/agent-eval}"
|
|
19
|
-
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
20
|
-
mkdir -p "$OUT"
|
|
21
|
-
|
|
22
|
-
[ -n "$CG_BIN" ] || { echo "no homegraph binary on PATH (set CG_BIN)"; exit 1; }
|
|
23
|
-
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO — index it first"; exit 1; }
|
|
24
|
-
case "$MODE" in headless|tmux|all) ;; *) echo "mode must be headless|tmux|all (got '$MODE')"; exit 1;; esac
|
|
25
|
-
|
|
26
|
-
# MCP config files (path form avoids inline-JSON quoting through tmux).
|
|
27
|
-
cat > "$OUT/mcp-homegraph.json" <<JSON
|
|
28
|
-
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
29
|
-
JSON
|
|
30
|
-
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
31
|
-
|
|
32
|
-
echo "###### homegraph: $CG_BIN"
|
|
33
|
-
echo "###### repo: $REPO"
|
|
34
|
-
echo "###### question: $Q"
|
|
35
|
-
echo
|
|
36
|
-
|
|
37
|
-
# Headless arm: claude -p with stream-json -> exact tool sequence + tokens/cost.
|
|
38
|
-
headless() {
|
|
39
|
-
local label="$1" cfg="$2"
|
|
40
|
-
echo "############################## HEADLESS [$label] ##############################"
|
|
41
|
-
( cd "$REPO" && claude -p "$Q" \
|
|
42
|
-
--output-format stream-json --verbose \
|
|
43
|
-
--permission-mode bypassPermissions \
|
|
44
|
-
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
45
|
-
--max-budget-usd 4 \
|
|
46
|
-
--strict-mcp-config --mcp-config "$cfg" \
|
|
47
|
-
> "$OUT/run-$label.jsonl" 2>"$OUT/run-$label.err" )
|
|
48
|
-
echo "exit $? -> $OUT/run-$label.jsonl ($(wc -l < "$OUT/run-$label.jsonl" | tr -d ' ') lines)"
|
|
49
|
-
tail -2 "$OUT/run-$label.err" 2>/dev/null
|
|
50
|
-
node "$HARNESS/parse-run.mjs" "$OUT/run-$label.jsonl" 2>&1 || true
|
|
51
|
-
echo
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if [ "$MODE" = headless ] || [ "$MODE" = all ]; then
|
|
55
|
-
headless "headless-with" "$OUT/mcp-homegraph.json"
|
|
56
|
-
headless "headless-without" "$OUT/mcp-empty.json"
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
if [ "$MODE" = tmux ] || [ "$MODE" = all ]; then
|
|
60
|
-
echo "############################## INTERACTIVE [with] ##############################"
|
|
61
|
-
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-homegraph.json" \
|
|
62
|
-
bash "$HARNESS/itrun.sh" "$REPO" "int-with" "$Q" 2>&1 || echo "[itrun WITH failed]"
|
|
63
|
-
echo
|
|
64
|
-
echo "############################## INTERACTIVE [without] ##############################"
|
|
65
|
-
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-empty.json" \
|
|
66
|
-
bash "$HARNESS/itrun.sh" "$REPO" "int-without" "$Q" 2>&1 || echo "[itrun WITHOUT failed]"
|
|
67
|
-
echo
|
|
68
|
-
fi
|
|
69
|
-
echo "############################## RUN-ALL COMPLETE ##############################"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# With/without A/B (and optional interactive) eval for a homegraph version on a
|
|
3
|
+
# repo. Codegraph is the ONLY variable: both arms launch claude with
|
|
4
|
+
# --strict-mcp-config — with = homegraph-only MCP (pointed at $CG_BIN),
|
|
5
|
+
# without = empty MCP. Built-in Read/Grep/Bash stay available in both arms.
|
|
6
|
+
#
|
|
7
|
+
# Usage: run-all.sh <repo-path> "<question>" [headless|tmux|all]
|
|
8
|
+
# Env: CG_BIN homegraph binary (default: command -v homegraph)
|
|
9
|
+
# AGENT_EVAL_OUT output dir (default: /tmp/agent-eval)
|
|
10
|
+
# MODEL / EFFORT claude model/effort (default: sonnet / high — the
|
|
11
|
+
# standing A/B policy; see CLAUDE.md, don't raise)
|
|
12
|
+
set -uo pipefail
|
|
13
|
+
|
|
14
|
+
REPO="${1:?usage: run-all.sh <repo-path> \"<question>\" [headless|tmux|all]}"
|
|
15
|
+
Q="${2:?question required}"
|
|
16
|
+
MODE="${3:-headless}"
|
|
17
|
+
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
18
|
+
OUT="${AGENT_EVAL_OUT:-/tmp/agent-eval}"
|
|
19
|
+
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
20
|
+
mkdir -p "$OUT"
|
|
21
|
+
|
|
22
|
+
[ -n "$CG_BIN" ] || { echo "no homegraph binary on PATH (set CG_BIN)"; exit 1; }
|
|
23
|
+
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO — index it first"; exit 1; }
|
|
24
|
+
case "$MODE" in headless|tmux|all) ;; *) echo "mode must be headless|tmux|all (got '$MODE')"; exit 1;; esac
|
|
25
|
+
|
|
26
|
+
# MCP config files (path form avoids inline-JSON quoting through tmux).
|
|
27
|
+
cat > "$OUT/mcp-homegraph.json" <<JSON
|
|
28
|
+
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
29
|
+
JSON
|
|
30
|
+
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
31
|
+
|
|
32
|
+
echo "###### homegraph: $CG_BIN"
|
|
33
|
+
echo "###### repo: $REPO"
|
|
34
|
+
echo "###### question: $Q"
|
|
35
|
+
echo
|
|
36
|
+
|
|
37
|
+
# Headless arm: claude -p with stream-json -> exact tool sequence + tokens/cost.
|
|
38
|
+
headless() {
|
|
39
|
+
local label="$1" cfg="$2"
|
|
40
|
+
echo "############################## HEADLESS [$label] ##############################"
|
|
41
|
+
( cd "$REPO" && claude -p "$Q" \
|
|
42
|
+
--output-format stream-json --verbose \
|
|
43
|
+
--permission-mode bypassPermissions \
|
|
44
|
+
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
45
|
+
--max-budget-usd 4 \
|
|
46
|
+
--strict-mcp-config --mcp-config "$cfg" \
|
|
47
|
+
> "$OUT/run-$label.jsonl" 2>"$OUT/run-$label.err" )
|
|
48
|
+
echo "exit $? -> $OUT/run-$label.jsonl ($(wc -l < "$OUT/run-$label.jsonl" | tr -d ' ') lines)"
|
|
49
|
+
tail -2 "$OUT/run-$label.err" 2>/dev/null
|
|
50
|
+
node "$HARNESS/parse-run.mjs" "$OUT/run-$label.jsonl" 2>&1 || true
|
|
51
|
+
echo
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if [ "$MODE" = headless ] || [ "$MODE" = all ]; then
|
|
55
|
+
headless "headless-with" "$OUT/mcp-homegraph.json"
|
|
56
|
+
headless "headless-without" "$OUT/mcp-empty.json"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
if [ "$MODE" = tmux ] || [ "$MODE" = all ]; then
|
|
60
|
+
echo "############################## INTERACTIVE [with] ##############################"
|
|
61
|
+
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-homegraph.json" \
|
|
62
|
+
bash "$HARNESS/itrun.sh" "$REPO" "int-with" "$Q" 2>&1 || echo "[itrun WITH failed]"
|
|
63
|
+
echo
|
|
64
|
+
echo "############################## INTERACTIVE [without] ##############################"
|
|
65
|
+
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-empty.json" \
|
|
66
|
+
bash "$HARNESS/itrun.sh" "$REPO" "int-without" "$Q" 2>&1 || echo "[itrun WITHOUT failed]"
|
|
67
|
+
echo
|
|
68
|
+
fi
|
|
69
|
+
echo "############################## RUN-ALL COMPLETE ##############################"
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Tool-surface ablation — run ONE repo+question under ONE arm.
|
|
3
|
-
#
|
|
4
|
-
# Arms vary (exposed homegraph tools, trace-first steering). Tools are trimmed
|
|
5
|
-
# SERVER-SIDE via HOMEGRAPH_MCP_TOOLS in the MCP config's `env` block, so an
|
|
6
|
-
# ablated tool is genuinely absent from ListTools — no deferred-ToolSearch or
|
|
7
|
-
# denied-call confound (which --disallowedTools would introduce). Steering is
|
|
8
|
-
# injected with --append-system-prompt, so no rebuild of the shipped
|
|
9
|
-
# server-instructions is needed to A/B it.
|
|
10
|
-
#
|
|
11
|
-
# A control all tools no steering
|
|
12
|
-
# B steer all tools trace-first
|
|
13
|
-
# C no-explore hide explore trace-first
|
|
14
|
-
# D trace-centric hide explore+context trace-first
|
|
15
|
-
# E control-probe hide explore+context trace-first (caller passes a NON-flow Q)
|
|
16
|
-
#
|
|
17
|
-
# Usage: run-arms.sh <repo-path> "<question>" <A|B|C|D|E> [run-id]
|
|
18
|
-
set -uo pipefail
|
|
19
|
-
REPO="${1:?repo path}"; Q="${2:?question}"; ARM="${3:?arm A-E}"; RID="${4:-1}"
|
|
20
|
-
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
21
|
-
OUT="${ARMS_OUT:-/tmp/arms}/$(basename "$REPO")"
|
|
22
|
-
mkdir -p "$OUT"
|
|
23
|
-
[ -n "$CG_BIN" ] || { echo "no homegraph binary (set CG_BIN)"; exit 1; }
|
|
24
|
-
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO"; exit 1; }
|
|
25
|
-
|
|
26
|
-
STEER='Flow questions ("how does X reach/become Y", "trace the flow", request to handler, state to render): call homegraph_trace(from,to) FIRST — one call returns the whole path. Use homegraph_context/search only to locate the two endpoint symbols if you do not know them. Do NOT reconstruct the path with repeated search/callers/explore.'
|
|
27
|
-
KEEP_NO_EXPLORE="trace,search,node,context,callers,callees,impact,files,status"
|
|
28
|
-
KEEP_TRACE_CENTRIC="trace,search,node,callers,callees,impact,files,status"
|
|
29
|
-
|
|
30
|
-
case "$ARM" in
|
|
31
|
-
A|G|H|I) TOOLS=""; STEERING="" ;; # no steering; H = body-trace, I = body-trace + destination callees (sufficiency)
|
|
32
|
-
B|F) TOOLS=""; STEERING="$STEER" ;; # F = B's surface, run on the body-inlining trace build
|
|
33
|
-
C) TOOLS="$KEEP_NO_EXPLORE"; STEERING="$STEER" ;;
|
|
34
|
-
D|E) TOOLS="$KEEP_TRACE_CENTRIC"; STEERING="$STEER" ;;
|
|
35
|
-
*) echo "bad arm '$ARM' (want A|B|C|D|E)"; exit 1 ;;
|
|
36
|
-
esac
|
|
37
|
-
|
|
38
|
-
CFG="$OUT/mcp-$ARM.json"
|
|
39
|
-
if [ -n "$TOOLS" ]; then
|
|
40
|
-
cat > "$CFG" <<JSON
|
|
41
|
-
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"],"env":{"HOMEGRAPH_MCP_TOOLS":"$TOOLS"}}}}
|
|
42
|
-
JSON
|
|
43
|
-
else
|
|
44
|
-
cat > "$CFG" <<JSON
|
|
45
|
-
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
46
|
-
JSON
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
LOG="$OUT/$ARM-r$RID.jsonl"; ERR="$OUT/$ARM-r$RID.err"
|
|
50
|
-
ARGS=( -p "$Q" --output-format stream-json --verbose
|
|
51
|
-
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" --max-budget-usd 4
|
|
52
|
-
--strict-mcp-config --mcp-config "$CFG" )
|
|
53
|
-
[ -n "$STEERING" ] && ARGS+=( --append-system-prompt "$STEERING" )
|
|
54
|
-
|
|
55
|
-
( cd "$REPO" && claude "${ARGS[@]}" > "$LOG" 2>"$ERR" )
|
|
56
|
-
echo "[$(basename "$REPO") $ARM r$RID] exit $? -> $LOG ($(wc -l < "$LOG" | tr -d ' ') lines)"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Tool-surface ablation — run ONE repo+question under ONE arm.
|
|
3
|
+
#
|
|
4
|
+
# Arms vary (exposed homegraph tools, trace-first steering). Tools are trimmed
|
|
5
|
+
# SERVER-SIDE via HOMEGRAPH_MCP_TOOLS in the MCP config's `env` block, so an
|
|
6
|
+
# ablated tool is genuinely absent from ListTools — no deferred-ToolSearch or
|
|
7
|
+
# denied-call confound (which --disallowedTools would introduce). Steering is
|
|
8
|
+
# injected with --append-system-prompt, so no rebuild of the shipped
|
|
9
|
+
# server-instructions is needed to A/B it.
|
|
10
|
+
#
|
|
11
|
+
# A control all tools no steering
|
|
12
|
+
# B steer all tools trace-first
|
|
13
|
+
# C no-explore hide explore trace-first
|
|
14
|
+
# D trace-centric hide explore+context trace-first
|
|
15
|
+
# E control-probe hide explore+context trace-first (caller passes a NON-flow Q)
|
|
16
|
+
#
|
|
17
|
+
# Usage: run-arms.sh <repo-path> "<question>" <A|B|C|D|E> [run-id]
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
REPO="${1:?repo path}"; Q="${2:?question}"; ARM="${3:?arm A-E}"; RID="${4:-1}"
|
|
20
|
+
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
21
|
+
OUT="${ARMS_OUT:-/tmp/arms}/$(basename "$REPO")"
|
|
22
|
+
mkdir -p "$OUT"
|
|
23
|
+
[ -n "$CG_BIN" ] || { echo "no homegraph binary (set CG_BIN)"; exit 1; }
|
|
24
|
+
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO"; exit 1; }
|
|
25
|
+
|
|
26
|
+
STEER='Flow questions ("how does X reach/become Y", "trace the flow", request to handler, state to render): call homegraph_trace(from,to) FIRST — one call returns the whole path. Use homegraph_context/search only to locate the two endpoint symbols if you do not know them. Do NOT reconstruct the path with repeated search/callers/explore.'
|
|
27
|
+
KEEP_NO_EXPLORE="trace,search,node,context,callers,callees,impact,files,status"
|
|
28
|
+
KEEP_TRACE_CENTRIC="trace,search,node,callers,callees,impact,files,status"
|
|
29
|
+
|
|
30
|
+
case "$ARM" in
|
|
31
|
+
A|G|H|I) TOOLS=""; STEERING="" ;; # no steering; H = body-trace, I = body-trace + destination callees (sufficiency)
|
|
32
|
+
B|F) TOOLS=""; STEERING="$STEER" ;; # F = B's surface, run on the body-inlining trace build
|
|
33
|
+
C) TOOLS="$KEEP_NO_EXPLORE"; STEERING="$STEER" ;;
|
|
34
|
+
D|E) TOOLS="$KEEP_TRACE_CENTRIC"; STEERING="$STEER" ;;
|
|
35
|
+
*) echo "bad arm '$ARM' (want A|B|C|D|E)"; exit 1 ;;
|
|
36
|
+
esac
|
|
37
|
+
|
|
38
|
+
CFG="$OUT/mcp-$ARM.json"
|
|
39
|
+
if [ -n "$TOOLS" ]; then
|
|
40
|
+
cat > "$CFG" <<JSON
|
|
41
|
+
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"],"env":{"HOMEGRAPH_MCP_TOOLS":"$TOOLS"}}}}
|
|
42
|
+
JSON
|
|
43
|
+
else
|
|
44
|
+
cat > "$CFG" <<JSON
|
|
45
|
+
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
46
|
+
JSON
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
LOG="$OUT/$ARM-r$RID.jsonl"; ERR="$OUT/$ARM-r$RID.err"
|
|
50
|
+
ARGS=( -p "$Q" --output-format stream-json --verbose
|
|
51
|
+
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" --max-budget-usd 4
|
|
52
|
+
--strict-mcp-config --mcp-config "$CFG" )
|
|
53
|
+
[ -n "$STEERING" ] && ARGS+=( --append-system-prompt "$STEERING" )
|
|
54
|
+
|
|
55
|
+
( cd "$REPO" && claude "${ARGS[@]}" > "$LOG" 2>"$ERR" )
|
|
56
|
+
echo "[$(basename "$REPO") $ARM r$RID] exit $? -> $LOG ($(wc -l < "$LOG" | tr -d ' ') lines)"
|
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Mine the surviving A/B stream-json logs (/tmp/ab-matrix/<Cell>/run-headless-*.jsonl)
|
|
3
|
-
// for what the aggregate matrix can't see: the call SEQUENCE and per-call output SIZE.
|
|
4
|
-
//
|
|
5
|
-
// Answers three questions:
|
|
6
|
-
// 1. Trace adoption — on a flow question, does the with-arm actually call homegraph_trace?
|
|
7
|
-
// 2. Payload size vs repo size — is trace path-scoped (tiny, size-independent) while
|
|
8
|
-
// explore is breadth-scoped (grows with the repo / over-returns on small repos)?
|
|
9
|
-
// 3. Round-trips — num_turns with vs without (the real wall-clock driver).
|
|
10
|
-
//
|
|
11
|
-
// Usage: node scripts/agent-eval/seq-matrix.mjs [/tmp/ab-matrix]
|
|
12
|
-
import { readFileSync, readdirSync, existsSync } from 'fs';
|
|
13
|
-
import { join } from 'path';
|
|
14
|
-
|
|
15
|
-
const AB = process.argv[2] || '/tmp/ab-matrix';
|
|
16
|
-
const MD = new URL('../../docs/benchmarks/homegraph-ab-matrix.md', import.meta.url).pathname;
|
|
17
|
-
|
|
18
|
-
// repo -> {lang,size,files} from the published matrix table
|
|
19
|
-
const repoMeta = {};
|
|
20
|
-
if (existsSync(MD)) for (const line of readFileSync(MD, 'utf8').split('\n')) {
|
|
21
|
-
const m = line.match(/^\|\s*([^|]+?)\s*\|\s*(S|M|L)\s*\|\s*`([^`]+)`\s*\|\s*(\d+)\s*\|/);
|
|
22
|
-
if (m) repoMeta[m[3]] = { lang: m[1].trim(), size: m[2], files: +m[4] };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const cgShort = (n) => n.replace('mcp__homegraph__homegraph_', '').replace('mcp__homegraph__', '');
|
|
26
|
-
const tag = (n) => n === 'Read' ? 'R' : n === 'Grep' ? 'G' : n === 'Glob' ? 'Gl'
|
|
27
|
-
: n === 'Bash' ? 'B' : n === 'Task' ? 'Ag' : n === 'ToolSearch' ? 'TS'
|
|
28
|
-
: n.includes('homegraph') ? cgShort(n) : n;
|
|
29
|
-
|
|
30
|
-
function parse(file) {
|
|
31
|
-
if (!existsSync(file)) return null;
|
|
32
|
-
const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean);
|
|
33
|
-
const calls = []; let result = null, initCg = 0;
|
|
34
|
-
for (const l of lines) {
|
|
35
|
-
let ev; try { ev = JSON.parse(l); } catch { continue; }
|
|
36
|
-
if (ev.type === 'system' && ev.subtype === 'init') initCg = (ev.tools || []).filter(t => /homegraph/.test(t)).length;
|
|
37
|
-
if (ev.type === 'assistant') for (const b of (ev.message?.content || [])) if (b.type === 'tool_use') {
|
|
38
|
-
const i = b.input || {};
|
|
39
|
-
const q = i.query ?? i.symbol ?? i.task ?? (i.from && i.to ? `${i.from}->${i.to}` : (i.file_path || i.command || ''));
|
|
40
|
-
calls.push({ id: b.id, name: b.name, q: String(q ?? '').slice(0, 38), out: 0 });
|
|
41
|
-
}
|
|
42
|
-
if (ev.type === 'user') for (const b of (ev.message?.content || [])) if (b.type === 'tool_result') {
|
|
43
|
-
const c = b.content;
|
|
44
|
-
const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map(x => x?.text || '').join('') : '';
|
|
45
|
-
const call = calls.find(k => k.id === b.tool_use_id); if (call) call.out = txt.length;
|
|
46
|
-
}
|
|
47
|
-
if (ev.type === 'result') result = ev;
|
|
48
|
-
}
|
|
49
|
-
const cg = calls.filter(c => c.name.includes('homegraph'));
|
|
50
|
-
const perTool = {};
|
|
51
|
-
for (const c of cg) { const k = cgShort(c.name); (perTool[k] ??= { n: 0, out: 0 }); perTool[k].n++; perTool[k].out += c.out; }
|
|
52
|
-
const traceIdx = cg.findIndex(c => c.name.includes('trace'));
|
|
53
|
-
const u = result?.usage || {};
|
|
54
|
-
return {
|
|
55
|
-
initCg, cg, perTool,
|
|
56
|
-
cgSeq: cg.map(c => cgShort(c.name)),
|
|
57
|
-
seq: calls.map(c => tag(c.name)),
|
|
58
|
-
reads: calls.filter(c => c.name === 'Read').length,
|
|
59
|
-
greps: calls.filter(c => c.name === 'Grep').length,
|
|
60
|
-
cgOut: cg.reduce((s, c) => s + c.out, 0),
|
|
61
|
-
traceUsed: traceIdx >= 0,
|
|
62
|
-
afterTrace: traceIdx >= 0 ? cg.slice(traceIdx + 1).map(c => cgShort(c.name)) : null,
|
|
63
|
-
turns: result?.num_turns ?? null,
|
|
64
|
-
dur: result?.duration_ms ? Math.round(result.duration_ms / 1000) : null,
|
|
65
|
-
cost: result?.total_cost_usd || 0,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const cells = [];
|
|
70
|
-
for (const d of readdirSync(AB)) {
|
|
71
|
-
const dir = join(AB, d);
|
|
72
|
-
if (!existsSync(join(dir, 'run-headless-with.jsonl'))) continue;
|
|
73
|
-
const log = existsSync(join(AB, d + '.log')) ? readFileSync(join(AB, d + '.log'), 'utf8') : '';
|
|
74
|
-
const repo = (log.match(/repo:\s*\S*\/([^\s/]+)/) || [])[1] || d;
|
|
75
|
-
const question = (log.match(/question:\s*(.+)/) || [])[1] || '';
|
|
76
|
-
cells.push({ cell: d, repo, question, ...(repoMeta[repo] || {}),
|
|
77
|
-
with: parse(join(dir, 'run-headless-with.jsonl')),
|
|
78
|
-
without: parse(join(dir, 'run-headless-without.jsonl')) });
|
|
79
|
-
}
|
|
80
|
-
cells.sort((a, b) => (a.files || 0) - (b.files || 0));
|
|
81
|
-
|
|
82
|
-
const k = (n) => (n / 1000).toFixed(1);
|
|
83
|
-
const pad = (s, n) => String(s).padEnd(n);
|
|
84
|
-
|
|
85
|
-
// ---- per-cell sequence table ----
|
|
86
|
-
console.log('\n=== PER-CELL: with-arm homegraph sequence + payload (sorted by repo size) ===');
|
|
87
|
-
console.log(pad('repo', 22), pad('files', 6), 'trace', pad('cg-call sequence', 40), pad('cgOutK', 7), 'turns(w/wo)');
|
|
88
|
-
for (const c of cells) {
|
|
89
|
-
const w = c.with;
|
|
90
|
-
console.log(
|
|
91
|
-
pad(c.repo, 22), pad(c.files ?? '?', 6),
|
|
92
|
-
pad(w.traceUsed ? 'YES' : 'no', 5),
|
|
93
|
-
pad(w.cgSeq.join(',') || '(none)', 40),
|
|
94
|
-
pad(k(w.cgOut), 7),
|
|
95
|
-
`${w.turns}/${c.without?.turns}`,
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ---- trace adoption ----
|
|
100
|
-
const flow = cells; // every matrix question is a canonical flow question by design
|
|
101
|
-
const used = flow.filter(c => c.with.traceUsed);
|
|
102
|
-
console.log(`\n=== TRACE ADOPTION (all ${flow.length} cells are flow questions) ===`);
|
|
103
|
-
console.log(`trace called in ${used.length}/${flow.length} cells`);
|
|
104
|
-
console.log('used trace:', used.map(c => c.repo).join(', ') || '(none)');
|
|
105
|
-
if (used.length) console.log('after-trace follow-ups:', used.map(c => `${c.repo}[${c.with.afterTrace.join(',') || 'none'}]`).join(' '));
|
|
106
|
-
|
|
107
|
-
// ---- payload size by repo-size tier ----
|
|
108
|
-
const tier = (f) => f < 200 ? 'S(<200)' : f < 2000 ? 'M(<2000)' : 'L(>=2000)';
|
|
109
|
-
const byTier = {};
|
|
110
|
-
for (const c of cells) { (byTier[tier(c.files || 0)] ??= []).push(c.with.cgOut); }
|
|
111
|
-
console.log('\n=== with-arm TOTAL homegraph payload by repo-size tier ===');
|
|
112
|
-
for (const t of ['S(<200)', 'M(<2000)', 'L(>=2000)']) {
|
|
113
|
-
const a = byTier[t] || []; if (!a.length) continue;
|
|
114
|
-
const avg = a.reduce((s, x) => s + x, 0) / a.length;
|
|
115
|
-
console.log(` ${pad(t, 10)} n=${a.length} avg cgOut=${k(avg)}K range ${k(Math.min(...a))}-${k(Math.max(...a))}K`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// ---- per-tool usage + avg payload (breadth vs path evidence) ----
|
|
119
|
-
const tot = {};
|
|
120
|
-
for (const c of cells) for (const [name, v] of Object.entries(c.with.perTool)) {
|
|
121
|
-
(tot[name] ??= { n: 0, out: 0 }); tot[name].n += v.n; tot[name].out += v.out;
|
|
122
|
-
}
|
|
123
|
-
console.log('\n=== homegraph tool usage across all cells (n calls, avg payload/call) ===');
|
|
124
|
-
for (const [name, v] of Object.entries(tot).sort((a, b) => b[1].n - a[1].n)) {
|
|
125
|
-
console.log(` ${pad(name, 10)} calls=${pad(v.n, 4)} avg=${k(v.out / v.n)}K/call total=${k(v.out)}K`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// ---- round-trips ----
|
|
129
|
-
const sum = (arr, f) => arr.reduce((s, x) => s + (f(x) || 0), 0);
|
|
130
|
-
const wTurns = sum(cells, c => c.with.turns), woTurns = sum(cells, c => c.without?.turns);
|
|
131
|
-
const wCalls = sum(cells, c => c.with.cg.length);
|
|
132
|
-
const tsAll = cells.every(c => c.with.seq[0] === 'TS');
|
|
133
|
-
console.log('\n=== ROUND-TRIPS ===');
|
|
134
|
-
console.log(`turns: with=${wTurns} without=${woTurns} (${((1 - wTurns / woTurns) * 100).toFixed(0)}% fewer with)`);
|
|
135
|
-
console.log(`avg turns/cell: with=${(wTurns / cells.length).toFixed(1)} without=${(woTurns / cells.length).toFixed(1)}`);
|
|
136
|
-
console.log(`total homegraph calls=${wCalls} (avg ${(wCalls / cells.length).toFixed(1)}/cell)`);
|
|
137
|
-
console.log(`every with-arm opens with a ToolSearch round-trip (deferred tools): ${tsAll ? 'YES — 1 fixed tax/run' : 'no'}`);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Mine the surviving A/B stream-json logs (/tmp/ab-matrix/<Cell>/run-headless-*.jsonl)
|
|
3
|
+
// for what the aggregate matrix can't see: the call SEQUENCE and per-call output SIZE.
|
|
4
|
+
//
|
|
5
|
+
// Answers three questions:
|
|
6
|
+
// 1. Trace adoption — on a flow question, does the with-arm actually call homegraph_trace?
|
|
7
|
+
// 2. Payload size vs repo size — is trace path-scoped (tiny, size-independent) while
|
|
8
|
+
// explore is breadth-scoped (grows with the repo / over-returns on small repos)?
|
|
9
|
+
// 3. Round-trips — num_turns with vs without (the real wall-clock driver).
|
|
10
|
+
//
|
|
11
|
+
// Usage: node scripts/agent-eval/seq-matrix.mjs [/tmp/ab-matrix]
|
|
12
|
+
import { readFileSync, readdirSync, existsSync } from 'fs';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
|
|
15
|
+
const AB = process.argv[2] || '/tmp/ab-matrix';
|
|
16
|
+
const MD = new URL('../../docs/benchmarks/homegraph-ab-matrix.md', import.meta.url).pathname;
|
|
17
|
+
|
|
18
|
+
// repo -> {lang,size,files} from the published matrix table
|
|
19
|
+
const repoMeta = {};
|
|
20
|
+
if (existsSync(MD)) for (const line of readFileSync(MD, 'utf8').split('\n')) {
|
|
21
|
+
const m = line.match(/^\|\s*([^|]+?)\s*\|\s*(S|M|L)\s*\|\s*`([^`]+)`\s*\|\s*(\d+)\s*\|/);
|
|
22
|
+
if (m) repoMeta[m[3]] = { lang: m[1].trim(), size: m[2], files: +m[4] };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const cgShort = (n) => n.replace('mcp__homegraph__homegraph_', '').replace('mcp__homegraph__', '');
|
|
26
|
+
const tag = (n) => n === 'Read' ? 'R' : n === 'Grep' ? 'G' : n === 'Glob' ? 'Gl'
|
|
27
|
+
: n === 'Bash' ? 'B' : n === 'Task' ? 'Ag' : n === 'ToolSearch' ? 'TS'
|
|
28
|
+
: n.includes('homegraph') ? cgShort(n) : n;
|
|
29
|
+
|
|
30
|
+
function parse(file) {
|
|
31
|
+
if (!existsSync(file)) return null;
|
|
32
|
+
const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean);
|
|
33
|
+
const calls = []; let result = null, initCg = 0;
|
|
34
|
+
for (const l of lines) {
|
|
35
|
+
let ev; try { ev = JSON.parse(l); } catch { continue; }
|
|
36
|
+
if (ev.type === 'system' && ev.subtype === 'init') initCg = (ev.tools || []).filter(t => /homegraph/.test(t)).length;
|
|
37
|
+
if (ev.type === 'assistant') for (const b of (ev.message?.content || [])) if (b.type === 'tool_use') {
|
|
38
|
+
const i = b.input || {};
|
|
39
|
+
const q = i.query ?? i.symbol ?? i.task ?? (i.from && i.to ? `${i.from}->${i.to}` : (i.file_path || i.command || ''));
|
|
40
|
+
calls.push({ id: b.id, name: b.name, q: String(q ?? '').slice(0, 38), out: 0 });
|
|
41
|
+
}
|
|
42
|
+
if (ev.type === 'user') for (const b of (ev.message?.content || [])) if (b.type === 'tool_result') {
|
|
43
|
+
const c = b.content;
|
|
44
|
+
const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map(x => x?.text || '').join('') : '';
|
|
45
|
+
const call = calls.find(k => k.id === b.tool_use_id); if (call) call.out = txt.length;
|
|
46
|
+
}
|
|
47
|
+
if (ev.type === 'result') result = ev;
|
|
48
|
+
}
|
|
49
|
+
const cg = calls.filter(c => c.name.includes('homegraph'));
|
|
50
|
+
const perTool = {};
|
|
51
|
+
for (const c of cg) { const k = cgShort(c.name); (perTool[k] ??= { n: 0, out: 0 }); perTool[k].n++; perTool[k].out += c.out; }
|
|
52
|
+
const traceIdx = cg.findIndex(c => c.name.includes('trace'));
|
|
53
|
+
const u = result?.usage || {};
|
|
54
|
+
return {
|
|
55
|
+
initCg, cg, perTool,
|
|
56
|
+
cgSeq: cg.map(c => cgShort(c.name)),
|
|
57
|
+
seq: calls.map(c => tag(c.name)),
|
|
58
|
+
reads: calls.filter(c => c.name === 'Read').length,
|
|
59
|
+
greps: calls.filter(c => c.name === 'Grep').length,
|
|
60
|
+
cgOut: cg.reduce((s, c) => s + c.out, 0),
|
|
61
|
+
traceUsed: traceIdx >= 0,
|
|
62
|
+
afterTrace: traceIdx >= 0 ? cg.slice(traceIdx + 1).map(c => cgShort(c.name)) : null,
|
|
63
|
+
turns: result?.num_turns ?? null,
|
|
64
|
+
dur: result?.duration_ms ? Math.round(result.duration_ms / 1000) : null,
|
|
65
|
+
cost: result?.total_cost_usd || 0,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const cells = [];
|
|
70
|
+
for (const d of readdirSync(AB)) {
|
|
71
|
+
const dir = join(AB, d);
|
|
72
|
+
if (!existsSync(join(dir, 'run-headless-with.jsonl'))) continue;
|
|
73
|
+
const log = existsSync(join(AB, d + '.log')) ? readFileSync(join(AB, d + '.log'), 'utf8') : '';
|
|
74
|
+
const repo = (log.match(/repo:\s*\S*\/([^\s/]+)/) || [])[1] || d;
|
|
75
|
+
const question = (log.match(/question:\s*(.+)/) || [])[1] || '';
|
|
76
|
+
cells.push({ cell: d, repo, question, ...(repoMeta[repo] || {}),
|
|
77
|
+
with: parse(join(dir, 'run-headless-with.jsonl')),
|
|
78
|
+
without: parse(join(dir, 'run-headless-without.jsonl')) });
|
|
79
|
+
}
|
|
80
|
+
cells.sort((a, b) => (a.files || 0) - (b.files || 0));
|
|
81
|
+
|
|
82
|
+
const k = (n) => (n / 1000).toFixed(1);
|
|
83
|
+
const pad = (s, n) => String(s).padEnd(n);
|
|
84
|
+
|
|
85
|
+
// ---- per-cell sequence table ----
|
|
86
|
+
console.log('\n=== PER-CELL: with-arm homegraph sequence + payload (sorted by repo size) ===');
|
|
87
|
+
console.log(pad('repo', 22), pad('files', 6), 'trace', pad('cg-call sequence', 40), pad('cgOutK', 7), 'turns(w/wo)');
|
|
88
|
+
for (const c of cells) {
|
|
89
|
+
const w = c.with;
|
|
90
|
+
console.log(
|
|
91
|
+
pad(c.repo, 22), pad(c.files ?? '?', 6),
|
|
92
|
+
pad(w.traceUsed ? 'YES' : 'no', 5),
|
|
93
|
+
pad(w.cgSeq.join(',') || '(none)', 40),
|
|
94
|
+
pad(k(w.cgOut), 7),
|
|
95
|
+
`${w.turns}/${c.without?.turns}`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ---- trace adoption ----
|
|
100
|
+
const flow = cells; // every matrix question is a canonical flow question by design
|
|
101
|
+
const used = flow.filter(c => c.with.traceUsed);
|
|
102
|
+
console.log(`\n=== TRACE ADOPTION (all ${flow.length} cells are flow questions) ===`);
|
|
103
|
+
console.log(`trace called in ${used.length}/${flow.length} cells`);
|
|
104
|
+
console.log('used trace:', used.map(c => c.repo).join(', ') || '(none)');
|
|
105
|
+
if (used.length) console.log('after-trace follow-ups:', used.map(c => `${c.repo}[${c.with.afterTrace.join(',') || 'none'}]`).join(' '));
|
|
106
|
+
|
|
107
|
+
// ---- payload size by repo-size tier ----
|
|
108
|
+
const tier = (f) => f < 200 ? 'S(<200)' : f < 2000 ? 'M(<2000)' : 'L(>=2000)';
|
|
109
|
+
const byTier = {};
|
|
110
|
+
for (const c of cells) { (byTier[tier(c.files || 0)] ??= []).push(c.with.cgOut); }
|
|
111
|
+
console.log('\n=== with-arm TOTAL homegraph payload by repo-size tier ===');
|
|
112
|
+
for (const t of ['S(<200)', 'M(<2000)', 'L(>=2000)']) {
|
|
113
|
+
const a = byTier[t] || []; if (!a.length) continue;
|
|
114
|
+
const avg = a.reduce((s, x) => s + x, 0) / a.length;
|
|
115
|
+
console.log(` ${pad(t, 10)} n=${a.length} avg cgOut=${k(avg)}K range ${k(Math.min(...a))}-${k(Math.max(...a))}K`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ---- per-tool usage + avg payload (breadth vs path evidence) ----
|
|
119
|
+
const tot = {};
|
|
120
|
+
for (const c of cells) for (const [name, v] of Object.entries(c.with.perTool)) {
|
|
121
|
+
(tot[name] ??= { n: 0, out: 0 }); tot[name].n += v.n; tot[name].out += v.out;
|
|
122
|
+
}
|
|
123
|
+
console.log('\n=== homegraph tool usage across all cells (n calls, avg payload/call) ===');
|
|
124
|
+
for (const [name, v] of Object.entries(tot).sort((a, b) => b[1].n - a[1].n)) {
|
|
125
|
+
console.log(` ${pad(name, 10)} calls=${pad(v.n, 4)} avg=${k(v.out / v.n)}K/call total=${k(v.out)}K`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ---- round-trips ----
|
|
129
|
+
const sum = (arr, f) => arr.reduce((s, x) => s + (f(x) || 0), 0);
|
|
130
|
+
const wTurns = sum(cells, c => c.with.turns), woTurns = sum(cells, c => c.without?.turns);
|
|
131
|
+
const wCalls = sum(cells, c => c.with.cg.length);
|
|
132
|
+
const tsAll = cells.every(c => c.with.seq[0] === 'TS');
|
|
133
|
+
console.log('\n=== ROUND-TRIPS ===');
|
|
134
|
+
console.log(`turns: with=${wTurns} without=${woTurns} (${((1 - wTurns / woTurns) * 100).toFixed(0)}% fewer with)`);
|
|
135
|
+
console.log(`avg turns/cell: with=${(wTurns / cells.length).toFixed(1)} without=${(woTurns / cells.length).toFixed(1)}`);
|
|
136
|
+
console.log(`total homegraph calls=${wCalls} (avg ${(wCalls / cells.length).toFixed(1)}/cell)`);
|
|
137
|
+
console.log(`every with-arm opens with a ToolSearch round-trip (deferred tools): ${tsAll ? 'YES — 1 fixed tax/run' : 'no'}`);
|