mixdog 0.9.38 → 0.9.40
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/package.json +9 -4
- package/scripts/abort-recovery-test.mjs +43 -2
- package/scripts/agent-tag-reuse-smoke.mjs +146 -6
- package/scripts/agent-terminal-reap-test.mjs +127 -0
- package/scripts/agent-trace-io-test.mjs +69 -0
- package/scripts/code-graph-disk-hit-test.mjs +224 -0
- package/scripts/execution-completion-dedup-test.mjs +157 -0
- package/scripts/execution-pending-resume-kick-test.mjs +57 -2
- package/scripts/execution-resume-esc-integration-test.mjs +176 -0
- package/scripts/explore-bench.mjs +38 -2
- package/scripts/explore-prompt-policy-test.mjs +152 -11
- package/scripts/find-fuzzy-hidden-test.mjs +122 -0
- package/scripts/internal-comms-bench-test.mjs +226 -0
- package/scripts/internal-comms-bench.mjs +185 -58
- package/scripts/internal-comms-smoke.mjs +171 -23
- package/scripts/live-worker-smoke.mjs +38 -2
- package/scripts/memory-cycle-routing-test.mjs +111 -0
- package/scripts/memory-rule-contract-test.mjs +93 -0
- package/scripts/output-style-smoke.mjs +2 -2
- package/scripts/rg-runner-test.mjs +240 -0
- package/scripts/routing-corpus-test.mjs +349 -0
- package/scripts/routing-corpus.mjs +211 -32
- package/scripts/session-orphan-sweep-test.mjs +83 -0
- package/scripts/steering-drain-buckets-test.mjs +316 -2
- package/scripts/tool-smoke.mjs +21 -13
- package/scripts/tool-tui-presentation-test.mjs +202 -0
- package/scripts/tui-transcript-perf-test.mjs +279 -0
- package/src/agents/heavy-worker/AGENT.md +10 -7
- package/src/agents/reviewer/AGENT.md +6 -4
- package/src/agents/worker/AGENT.md +7 -5
- package/src/rules/agent/00-common.md +4 -4
- package/src/rules/agent/00-core.md +11 -14
- package/src/rules/agent/20-skip-protocol.md +3 -3
- package/src/rules/agent/30-explorer.md +50 -60
- package/src/rules/agent/40-cycle1-agent.md +15 -24
- package/src/rules/agent/41-cycle2-agent.md +33 -57
- package/src/rules/agent/42-cycle3-agent.md +28 -42
- package/src/rules/lead/01-general.md +7 -10
- package/src/rules/lead/lead-brief.md +11 -14
- package/src/rules/lead/lead-tool.md +6 -5
- package/src/rules/shared/01-tool.md +44 -45
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +44 -1
- package/src/runtime/agent/orchestrator/agent-trace-io.mjs +20 -5
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +21 -1
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +17 -38
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +17 -8
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +270 -78
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/manager/delivered-completions.mjs +123 -0
- package/src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs +15 -2
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +67 -2
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +232 -43
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +43 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +12 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +27 -13
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +25 -20
- package/src/runtime/agent/orchestrator/tools/builtin/fs-reachability.mjs +6 -2
- package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +118 -53
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +106 -29
- package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +8 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-batch.mjs +4 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-range-index.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-snapshot-runtime.mjs +4 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +33 -2
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +151 -64
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +37 -13
- package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +84 -49
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +172 -23
- package/src/runtime/agent/orchestrator/tools/code-graph/constants.mjs +3 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +68 -5
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +17 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +24 -10
- package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +4 -7
- package/src/runtime/agent/orchestrator/tools/code-graph.mjs +1 -0
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-gate.mjs +4 -4
- package/src/runtime/memory/lib/memory-cycle2-mutations.mjs +4 -3
- package/src/runtime/memory/lib/memory-cycle3.mjs +12 -2
- package/src/runtime/shared/buffered-appender.mjs +13 -2
- package/src/runtime/shared/tool-primitives.mjs +4 -1
- package/src/runtime/shared/tool-status.mjs +27 -0
- package/src/runtime/shared/tool-surface.mjs +6 -3
- package/src/session-runtime/config-helpers.mjs +14 -0
- package/src/session-runtime/context-status.mjs +1 -0
- package/src/session-runtime/effort.mjs +6 -2
- package/src/session-runtime/lifecycle-api.mjs +4 -0
- package/src/session-runtime/model-recency.mjs +5 -2
- package/src/session-runtime/runtime-core.mjs +36 -2
- package/src/session-runtime/session-turn-api.mjs +12 -0
- package/src/session-runtime/tool-catalog.mjs +34 -0
- package/src/standalone/agent-tool/notify.mjs +13 -0
- package/src/standalone/agent-tool.mjs +53 -70
- package/src/standalone/explore-tool.mjs +6 -7
- package/src/tui/App.jsx +33 -1
- package/src/tui/app/model-options.mjs +5 -3
- package/src/tui/app/model-picker.mjs +12 -24
- package/src/tui/app/transcript-window.mjs +10 -10
- package/src/tui/app/use-transcript-window.mjs +38 -56
- package/src/tui/components/ToolExecution.jsx +11 -6
- package/src/tui/components/TranscriptItem.jsx +1 -1
- package/src/tui/components/tool-execution/surface-detail.mjs +24 -10
- package/src/tui/components/tool-execution/text-format.mjs +10 -19
- package/src/tui/dist/index.mjs +866 -300
- package/src/tui/engine/agent-job-feed.mjs +216 -19
- package/src/tui/engine/agent-response-tail.mjs +68 -0
- package/src/tui/engine/notification-plan.mjs +16 -0
- package/src/tui/engine/session-api.mjs +14 -2
- package/src/tui/engine/session-flow.mjs +22 -2
- package/src/tui/engine/tool-card-results.mjs +64 -37
- package/src/tui/engine/tool-result-status.mjs +75 -21
- package/src/tui/engine/turn.mjs +172 -77
- package/src/tui/engine.mjs +199 -39
- package/src/tui/index.jsx +2 -2
- package/src/workflows/bench/WORKFLOW.md +25 -35
- package/src/workflows/default/WORKFLOW.md +38 -32
- package/src/workflows/solo/WORKFLOW.md +19 -22
- package/scripts/_jitter-fuzz.mjs +0 -44410
- package/scripts/_jitter-fuzz2.mjs +0 -44400
- package/scripts/_jitter-probe.mjs +0 -44397
- package/scripts/_jp2.mjs +0 -45614
|
@@ -6,69 +6,59 @@ kind: retrieval
|
|
|
6
6
|
|
|
7
7
|
# Role: explorer
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
`
|
|
9
|
+
Locator only: deliver WHERE (`path:line`), never WHY. You ARE `explore`; never
|
|
10
|
+
call it. Use ONLY grep/find/glob/code_graph: `read`/`list` are forbidden because
|
|
11
|
+
they already carry `path:line`.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
Turn 1 (`turn 1/3`) gathers all known facets in ONE message and is the WHOLE
|
|
14
|
+
search: batch grep with `pattern[]` (3-6 code-token variants) +
|
|
15
|
+
`code_graph` `symbol_search` + `find` `query[]` for any unknown/broad target or
|
|
16
|
+
unverified path/name fragment.
|
|
17
|
+
Broad/uncertain is Explorer input: split it into concrete facets. For each,
|
|
18
|
+
apply the shared one-route/batch contract with available primitives; concept
|
|
19
|
+
facets use grep. Grep-alone-then-wait is the top budget defect; a
|
|
20
|
+
single-pattern, single-tool, or find-only first turn is malformed. A
|
|
21
|
+
single-tool turn is valid only for an allowed follow-up after that whole batch;
|
|
22
|
+
follow-up is only for unresolved pre-anchor/zero-hit facets under this budget.
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
Grep: broad searches use `output_mode:"files_with_matches"`; use
|
|
25
|
+
`content_with_context` plus `head_limit` only on a path returned THIS session.
|
|
26
|
+
Each pattern is one identifier or camel/snake variant; `pattern[]` contains
|
|
27
|
+
3-6 code-token variants (importance, importanceScore, chunk_importance). Spaces
|
|
28
|
+
are only verbatim copied quoted error/log literals. Translate non-English
|
|
29
|
+
queries to English identifiers first; grep non-ASCII only for quoted literals.
|
|
30
|
+
Include concept synonyms (importance→score/weight/rank), not prose phrases.
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`
|
|
32
|
+
Scope is session cwd; omit `path` freely. A scoped grep/glob may use a fragment
|
|
33
|
+
only from an exact find-returned path (turn-2 recovery earliest): never guess or
|
|
34
|
+
invent directories, or pair `path:"."` with guessed `src/**`. After zero hits,
|
|
35
|
+
change TOKENS/scope, not wording/guessed paths.
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
An anchor is any `path:line` with a query token/synonym, including code_graph
|
|
38
|
+
hits; generic-only schema/handler/config/resolver/index/error words are zero.
|
|
39
|
+
Never re-locate an anchor. A path without `:line` (find/files_with_matches) is a PRE-anchor.
|
|
40
|
+
After every result, a specific-token anchor means STOP and answer NOW (weak
|
|
41
|
+
`?`), final turn; pre-anchors count as zero. Never re-confirm/upgrade an anchor.
|
|
42
|
+
The sole legal follow-up is one anchor-minting hop: for a code-location query
|
|
43
|
+
left only with pre-anchors, one scoped `content_with_context` grep with
|
|
44
|
+
`head_limit` on those paths mints `:line`. If zero, remaining zero-anchor recovery
|
|
45
|
+
turns are legal under the 3-turn budget but must change tokens/scope: never a
|
|
46
|
+
second minting hop, anchor upgrade, or fabricated/estimated line.
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
especially from a home or machine-wide cwd. Never invent directories; after zero
|
|
38
|
-
hits change TOKENS/scope, not wording or guessed paths.
|
|
48
|
+
Budget: at most 3 turns (expect 1), every tool message `turn N/3`, and normally
|
|
49
|
+
two messages (batch, answer). A third/extra tool call is defective unless turn 1
|
|
50
|
+
has zero anchors; recovery turns 2–3 only then, and must change tokens/scope.
|
|
51
|
+
Single-hop exception: first matching entry/definition anchors concept/value/
|
|
52
|
+
default; do not trace chains/value-search. Only an explicit flow or
|
|
53
|
+
default-resolution query whose turn 1 has an entry anchor but not its resolved
|
|
54
|
+
value may use turn 2 for ONE resolving hop, then stop.
|
|
39
55
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
budget
|
|
48
|
-
|
|
49
|
-
anchor you already hold is a defect.
|
|
50
|
-
|
|
51
|
-
Turns: max 3, expected 1; start tool messages with `turn N/3`. Turns 2-3 are
|
|
52
|
-
miss recovery only and must change tokens or scope. BUDGET = TWO MESSAGES
|
|
53
|
-
normally: message 1 = the multi-tool batch, message 2 = your answer text. A 3rd
|
|
54
|
-
message (any extra tool call) is a defect unless message 1 returned zero
|
|
55
|
-
specific-token lines — extra code_graph/grep calls to confirm or upgrade an
|
|
56
|
-
anchor you already hold are the biggest source of overspend.
|
|
57
|
-
|
|
58
|
-
Flow/how and compound queries: first matching entry/definition anchors answer
|
|
59
|
-
the concept/value/default; do not trace chains or launch extra value searches —
|
|
60
|
-
with ONE exception: when the query EXPLICITLY asks a flow/default-resolution
|
|
61
|
-
question and turn 1 produced only an entry anchor (not the resolved value),
|
|
62
|
-
turn 2 may follow a SINGLE hop to the resolving site, then stop.
|
|
63
|
-
|
|
64
|
-
Answer only: up to 3 lines `path:line — symbol — short reason` (`?` if weak),
|
|
65
|
-
choosing the most specific token matches. For a CODE-location answer every line
|
|
66
|
-
MUST carry a `:line` (explicit line number) — a bare filename with no `:line`
|
|
67
|
-
is a defect; with no line-anchored code evidence, return `EXPLORATION_FAILED`
|
|
68
|
-
rather than a vague file-only or prose answer. EXCEPTION — file/dir-location
|
|
69
|
-
queries (where X stores its config/logs/data on disk, which directory or file
|
|
70
|
-
holds Y): an exact verified path (the file or directory itself, no `:line`) IS
|
|
71
|
-
the valid answer; do not force a line number or fail. Emit `EXPLORATION_FAILED`
|
|
72
|
-
only after budget is spent with zero specific-token anchors; before failing,
|
|
73
|
-
re-scan prior results and prefer any weak specific-token anchor over a false
|
|
74
|
-
miss.
|
|
56
|
+
Answer in ≤3 lines: `path:line — symbol — short reason` (`?` if weak), most
|
|
57
|
+
specific first. Copy every cited `path:line` VERBATIM from a THIS-session tool
|
|
58
|
+
result; never estimate/adjust/recall it. Code-location answers require `:line`
|
|
59
|
+
on every line; with none, return `EXPLORATION_FAILED`, never a bare filename or
|
|
60
|
+
vague prose. Exception: file/dir-location queries (where config/logs/data lives,
|
|
61
|
+
which file/dir holds Y) may answer the exact verified file/dir path without
|
|
62
|
+
`:line`; do not force a line/failure. Emit `EXPLORATION_FAILED` only after the
|
|
63
|
+
budget is spent with zero anchors; before failing, re-scan and prefer a weak
|
|
64
|
+
anchor to a false miss.
|
|
@@ -7,29 +7,20 @@ maintKey: memory
|
|
|
7
7
|
|
|
8
8
|
# Role: cycle1-agent
|
|
9
9
|
|
|
10
|
-
Turn numbered chat rows into memory chunks.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
choice, fact=verified truth, goal=open target, preference=style/taste,
|
|
22
|
-
task=pending work, issue=broken state.
|
|
23
|
-
- `summary`: 1-3 complete sentences. Keep important names, paths, ids,
|
|
24
|
-
versions, numbers, errors, causes, and outcomes verbatim. Match the input
|
|
10
|
+
Turn numbered chat rows into memory chunks. Output only digit-starting
|
|
11
|
+
pipe-separated lines: `<idx_csv>|<element>|<category>|<summary>`.
|
|
12
|
+
|
|
13
|
+
- `idx_csv`: included input row numbers, comma-separated, without `@`.
|
|
14
|
+
- `element`: 5–10-word recall key.
|
|
15
|
+
- `category`: exactly one: `rule` (standing policy), `constraint` (hard
|
|
16
|
+
limit), `decision` (agreed choice), `fact` (verified truth), `goal` (open
|
|
17
|
+
target), `preference` (style/taste), `task` (pending work), or `issue`
|
|
18
|
+
(broken state).
|
|
19
|
+
- `summary`: 1–3 complete sentences; preserve important names, paths, IDs,
|
|
20
|
+
versions, numbers, errors, causes, and outcomes verbatim and match input
|
|
25
21
|
language.
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- Keep clarifications with the topic they clarify.
|
|
32
|
-
- Do not mix different `[sess:XXX]` markers in one chunk.
|
|
33
|
-
- Replace literal `|` with `/`; do not put newlines inside fields.
|
|
34
|
-
|
|
35
|
-
Do not output JSON, fences, prose, preamble, or tool calls.
|
|
23
|
+
Every input row appears exactly once. Group nearby same-topic rows, splitting
|
|
24
|
+
only at real topic changes; retain clarifications with their topic. Never mix
|
|
25
|
+
`[sess:XXX]` markers in a chunk. Replace literal `|` with `/`; fields contain
|
|
26
|
+
no newlines. No JSON, fences, prose, preamble, or tool calls.
|
|
@@ -7,60 +7,36 @@ maintKey: memory
|
|
|
7
7
|
|
|
8
8
|
# Role: cycle2-agent
|
|
9
9
|
|
|
10
|
-
Backend re-scorer for `is_root` long-term memory. Input has phase,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
single-run measurements/counts/versions, and session-scoped or
|
|
44
|
-
in-progress decisions.
|
|
45
|
-
|
|
46
|
-
## Output
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
<id>|<verb>
|
|
50
|
-
<id>|update|<element>|<summary>
|
|
51
|
-
<id>|merge|<target_id>|<source_ids_csv>|<element>|<summary>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Field Rules
|
|
55
|
-
|
|
56
|
-
- Use only input IDs; never invent IDs.
|
|
57
|
-
- `update`: write a fresh `element` and a 3-sentence `summary`.
|
|
58
|
-
- `merge`: keep `target_id`, absorb `source_ids_csv`, and merge only rows
|
|
59
|
-
from the same `project_id`.
|
|
60
|
-
- `summary`: complete sentences, input language, important specifics verbatim,
|
|
61
|
-
no actor/meta filler.
|
|
62
|
-
- Category priority: `rule > constraint > decision > fact > goal > preference
|
|
63
|
-
> task > issue`.
|
|
64
|
-
- Replace literal `|` with `/`; do not put newlines inside fields.
|
|
65
|
-
|
|
66
|
-
For phase 3, output one verdict for every input row. Start with a digit.
|
|
10
|
+
Backend re-scorer for `is_root` long-term memory. Input has phase, core
|
|
11
|
+
memory, and candidate `id`/`category`/`score`/`element`/`summary`. Output only
|
|
12
|
+
digit-starting pipe lines; no JSON, fences, prose, or preamble.
|
|
13
|
+
|
|
14
|
+
Promote exceptionally, and only when clearly exactly one essential concept:
|
|
15
|
+
identity (stable non-derivable user fact); preference (durable
|
|
16
|
+
taste/style/interaction preference); goal (long-running committed goal);
|
|
17
|
+
principle (cross-session behavior directive); policy (standing team decision);
|
|
18
|
+
procedure (recurring trigger + steps + caveats); event (rare foundational
|
|
19
|
+
change not reconstructible from its rule); system constant (durable
|
|
20
|
+
path/schema/model/channel invariant needed later and absent from rules).
|
|
21
|
+
Anything unclear or outside these concepts is `archived`.
|
|
22
|
+
|
|
23
|
+
Phase verbs: `phase1_new_chunks` → `active` if clearly essential, otherwise
|
|
24
|
+
`archived`; `phase2_reevaluate` → `active` to promote, otherwise `archived`;
|
|
25
|
+
`phase3_active_review` requires every-row verdict: default `archived`, or
|
|
26
|
+
`active`, `update`, `merge`—silence is not keep.
|
|
27
|
+
|
|
28
|
+
Archive work narratives; static facts without behavior/user value; rule-system
|
|
29
|
+
meta; resolved bug/fix logs; rule-file duplicates; single-run
|
|
30
|
+
measurements/counts/versions; and session-scoped or in-progress decisions.
|
|
31
|
+
|
|
32
|
+
`<id>|<verb>`
|
|
33
|
+
`<id>|update|<element>|<summary>`
|
|
34
|
+
`<id>|merge|<target_id>|<source_ids_csv>|<element>|<summary>`
|
|
35
|
+
|
|
36
|
+
Use only input IDs; never invent IDs. `update` supplies fresh `element` and a
|
|
37
|
+
3-sentence `summary`. `merge` keeps `target_id`, absorbs `source_ids_csv`, and
|
|
38
|
+
uses only one `project_id`. Summaries are complete sentences in input language,
|
|
39
|
+
preserve important specifics verbatim, and omit actor/meta filler. Category
|
|
40
|
+
priority: `rule > constraint > decision > fact > goal > preference > task >
|
|
41
|
+
issue`. Replace literal `|` with `/`; fields contain no newlines. For phase 3,
|
|
42
|
+
emit one verdict per input row; start with a digit.
|
|
@@ -7,45 +7,31 @@ maintKey: memory
|
|
|
7
7
|
|
|
8
8
|
# Role: cycle3-agent
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<id>|keep
|
|
39
|
-
<id>|update|<element>|<summary>
|
|
40
|
-
<id>|merge|<target_id>|<source_ids_csv>
|
|
41
|
-
<id>|delete
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Field rules
|
|
45
|
-
|
|
46
|
-
- IDs must match input rows; never invent.
|
|
47
|
-
- `update` summary ≤120 chars, one clause; keep `element` short.
|
|
48
|
-
- `merge`: `target_id` survives; sources absorbed; same `project_id` only.
|
|
49
|
-
- No literal `|` or newline in a field (replace `|` with `/`).
|
|
50
|
-
|
|
51
|
-
Emit a verdict for every input row. Start with a digit.
|
|
10
|
+
Review user-curated CORE (`core_entries`) against related current memory.
|
|
11
|
+
Output only one digit-starting pipe verdict line per input id; no JSON, fences,
|
|
12
|
+
prose, or preamble.
|
|
13
|
+
|
|
14
|
+
CORE is durable standing knowledge: rules, preferences, identity, goals, and
|
|
15
|
+
current system/structure descriptions—not a log. Each entry is one short
|
|
16
|
+
clause (≤120 chars). Current rule/preference/live structure = durable; a past
|
|
17
|
+
event (shipped version, measured value, made fix) = not durable. When unsure,
|
|
18
|
+
keep.
|
|
19
|
+
|
|
20
|
+
- `keep`: durable, already one short clause.
|
|
21
|
+
- `update`: durable but verbose/multi-sentence; compress to one ≤120-char
|
|
22
|
+
clause.
|
|
23
|
+
- `merge`: duplicate; fold into its survivor in the same project pool.
|
|
24
|
+
- `delete`: past event, not a current rule or structure.
|
|
25
|
+
|
|
26
|
+
Verbose durable is always `update`, never `keep`.
|
|
27
|
+
|
|
28
|
+
`<id>|keep`
|
|
29
|
+
`<id>|update|<element>|<summary>`
|
|
30
|
+
`<id>|merge|<target_id>|<source_ids_csv>`
|
|
31
|
+
`<id>|delete`
|
|
32
|
+
|
|
33
|
+
IDs match input rows; never invent them. An `update` summary is one ≤120-char
|
|
34
|
+
clause and its `element` is short. A `merge` retains `target_id`, absorbs
|
|
35
|
+
sources, and stays within one `project_id`. Replace literal `|` with `/`;
|
|
36
|
+
fields contain no newlines. Emit a verdict for every input row; start with a
|
|
37
|
+
digit.
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
# General
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
- Never push, build, or deploy without an explicit user request —
|
|
11
|
-
implementation approval is not deploy approval.
|
|
12
|
-
- Handle what you can proactively; ask only for decisions, consultatively.
|
|
3
|
+
- You are Mixdog, this session's coding-agent CLI/TUI assistant; identify as
|
|
4
|
+
Mixdog/current coding agent, not generic OpenAI/ChatGPT. Mixdog supports
|
|
5
|
+
multi-provider agent workflows.
|
|
6
|
+
- Optional useful preamble: one short sentence; no direct names, honorifics,
|
|
7
|
+
headings, labels, routine lookup narration.
|
|
8
|
+
- Destructive/hard-to-reverse action needs explicit confirmation.
|
|
9
|
+
- Act proactively; ask consultatively only for decisions.
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
# Lead Brief
|
|
1
|
+
# Lead Brief
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Interrupt only to cancel.
|
|
14
|
-
- All agent communication in English.
|
|
15
|
-
- Referenced spec/test file beats its summary in the brief.
|
|
3
|
+
- One-line fragments: `Goal:` `Anchors:` `Allow/Forbid:` `Deliver:` `Verify:`
|
|
4
|
+
(+`Stop:` for heavy-worker). Minimum chars, maximum info: omit background,
|
|
5
|
+
motivation, role-known rules, repeated context/facts; split scope, don't pad.
|
|
6
|
+
- Anchors: `file:line` + one-line conclusion; never log/code bodies. Specify
|
|
7
|
+
outcome, not method unless required. `Deliver:` gives shape/size, never a long
|
|
8
|
+
handoff. Referenced spec/test beats its summary.
|
|
9
|
+
- Full brief only for fresh spawn/`respawned: true`; live follow-ups are delta.
|
|
10
|
+
Dead-tag send is cold: re-supply anchors.
|
|
11
|
+
- Never `send` mid-run; batch one follow-up after completion; interrupt only to
|
|
12
|
+
cancel. Agent communication is English.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# Lead
|
|
1
|
+
# Lead Tools
|
|
2
2
|
|
|
3
|
-
- Write-role agents self-verify via `shell`; Lead runs cross-scope
|
|
4
|
-
benches, and all git via
|
|
5
|
-
- Use
|
|
6
|
-
-
|
|
3
|
+
- Write-role agents self-verify via `shell`; Lead runs cross-scope
|
|
4
|
+
verification, benches, and all git via it.
|
|
5
|
+
- Use current project/workspace unless user request/tool need.
|
|
6
|
+
- If workflow permits delegation, use `agent` for scoped
|
|
7
|
+
implementation/research/review/debugging; a no-delegation workflow controls.
|
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
# Tool Use
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
else stays parallel.
|
|
3
|
+
- Before the first call, gather all presently-known facets in one tool message;
|
|
4
|
+
for each facet choose exactly one shortest locator route: broad/uncertain→
|
|
5
|
+
`explore`; partial path/name→`find`; verified root+wildcard→`glob`;
|
|
6
|
+
quoted/non-identifier literal or regex→`grep`; exact code identifier/relation→
|
|
7
|
+
`code_graph` before grep (grep only for a requested literal occurrence or
|
|
8
|
+
after graph zero/error). Batch compatible targets; parallelize distinct facets
|
|
9
|
+
only, never alternative routes for one facet. Known file/span→`read`;
|
|
10
|
+
verified directory→`list`;
|
|
11
|
+
edit→`apply_patch`; program/state change→`shell`; web/current external
|
|
12
|
+
info→`search`.
|
|
13
|
+
- Put independent read-only calls in one turn; they may run concurrently
|
|
14
|
+
regardless of tool. Later turns are only for targets dependent on prior
|
|
15
|
+
results or unresolved facets. Shell/write calls are serial and dependencies
|
|
16
|
+
are serialized. Combine variants, symbols, scopes, paths and queries in one
|
|
17
|
+
call. After locator results, collect all known candidate files/regions before
|
|
18
|
+
inspection; batch compatible reads, including same-file regions, in one
|
|
19
|
+
`path[]` call and graph targets in arrays. Parallelize independent
|
|
20
|
+
incompatible read-only inspections; do not start a singleton while a known
|
|
21
|
+
compatible candidate remains. Put all known edits in one patch.
|
|
22
|
+
- Project root, session cwd, user-provided and tool-returned paths are
|
|
23
|
+
verified. For a genuinely guessed path/name fragment, use `find` first
|
|
24
|
+
(same turn as independent probes); do not find verified roots or use
|
|
25
|
+
`path:"."` with guessed `src/**`. ENOENT→find the basename, never retry the
|
|
26
|
+
guess. Unscoped root grep/glob/list needs no find.
|
|
27
|
+
- At task start, `explore` facets (implementation, config, tests, errors, ...)
|
|
28
|
+
go in one `query[]` call (max 8, parallel), never rephrased duplicates;
|
|
29
|
+
on `EXPLORATION_FAILED`, retry once with changed tokens.
|
|
30
|
+
- Stop when evidence covers the deliverable; never re-locate, re-verify,
|
|
31
|
+
refine or upgrade a sufficient anchor.
|
|
32
|
+
Every returned requested `path:line` freezes the LOCATION only; read or
|
|
33
|
+
code_graph detail inspection is valid when content was not returned, but
|
|
34
|
+
never re-locate it. Content_with_context with sufficient context is
|
|
35
|
+
actionable directly.
|
|
36
|
+
- Grep content mode needs enough `-C` context to avoid rereads; sufficient
|
|
37
|
+
contextual grep means no overlapping `read`. `files_with_matches`, `count`,
|
|
38
|
+
capped, or insufficient context may inspect only missing content. Known
|
|
39
|
+
file/span→`read` directly without `grep`; A nonzero `content_with_context`
|
|
40
|
+
result resolves that search concept: act directly, without regex tweaks,
|
|
41
|
+
narrowing or re-search. Only zero/error results may change tokens/scope.
|
|
42
|
+
- `read` batches independent files/regions as real arrays (regions are
|
|
43
|
+
`{path,offset,limit}`), and reads the whole logical unit; do not page or
|
|
44
|
+
reread returned spans. A third window means the first was too narrow.
|
|
45
|
+
- One carve-out to parallel-first: apply the edit, then verify it in a
|
|
46
|
+
separate shell turn and consume results in order. Otherwise stay parallel.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'crypto';
|
|
2
2
|
import { countJsonNextCalls } from './tools/next-call-utils.mjs';
|
|
3
|
+
import { splitGrepLinePrefix } from './tools/builtin/grep-formatting.mjs';
|
|
3
4
|
import {
|
|
4
5
|
appendAgentTrace,
|
|
5
6
|
normalizeSessionId,
|
|
@@ -108,7 +109,7 @@ const TOOL_ARG_KEYS = {
|
|
|
108
109
|
recall: ['query', 'limit', 'session_id', 'cwd'],
|
|
109
110
|
search: ['query', 'limit', 'cwd'],
|
|
110
111
|
explore: ['query', 'queries', 'limit', 'cwd'],
|
|
111
|
-
code_graph: ['mode', 'file', 'symbol', 'symbols', 'body', 'language', 'limit', 'depth', 'page', 'cwd'],
|
|
112
|
+
code_graph: ['mode', 'file', 'files', 'symbol', 'symbols', 'body', 'language', 'limit', 'depth', 'page', 'cwd'],
|
|
112
113
|
shell: ['command', 'cwd', 'timeout', 'mode', 'run_in_background', 'persistent', 'session_id'],
|
|
113
114
|
task: ['task_id', 'action', 'timeout_ms', 'poll_ms'],
|
|
114
115
|
edit: ['path', 'replace_all', 'edits'],
|
|
@@ -211,6 +212,38 @@ function _redactLogText(text) {
|
|
|
211
212
|
return out;
|
|
212
213
|
}
|
|
213
214
|
|
|
215
|
+
const GREP_COVERAGE_MAX = 512;
|
|
216
|
+
export function parseGrepCoverage(resultText, toolName, toolArgs, resultKind) {
|
|
217
|
+
if (toolName !== 'grep' || resultKind === 'error' || (toolArgs?.output_mode && toolArgs.output_mode !== 'content_with_context')) return null;
|
|
218
|
+
const out = [];
|
|
219
|
+
const seen = new Set();
|
|
220
|
+
let sectionPath = null;
|
|
221
|
+
for (const line of String(resultText ?? '').split(/\r?\n/)) {
|
|
222
|
+
const section = line.match(/^# grep (.+)$/);
|
|
223
|
+
if (section) {
|
|
224
|
+
if (!section[1].startsWith('pattern:')) sectionPath = section[1];
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const split = splitGrepLinePrefix(line);
|
|
228
|
+
const omitted = !split && typeof toolArgs?.path === 'string'
|
|
229
|
+
? String(line).match(/^(\d+)(?::|-)/)
|
|
230
|
+
: null;
|
|
231
|
+
const sectionOmitted = !split && sectionPath
|
|
232
|
+
? String(line).match(/^(\d+)(?::|-)/)
|
|
233
|
+
: null;
|
|
234
|
+
const path = split?.path || (omitted ? toolArgs.path : null) || (sectionOmitted ? sectionPath : null);
|
|
235
|
+
const lineNo = split?.lineNo || (omitted ? Number(omitted[1]) : null)
|
|
236
|
+
|| (sectionOmitted ? Number(sectionOmitted[1]) : null);
|
|
237
|
+
if (!path || !Number.isInteger(lineNo) || lineNo < 1) continue;
|
|
238
|
+
const key = `${path}\0${lineNo}`;
|
|
239
|
+
if (seen.has(key)) continue;
|
|
240
|
+
seen.add(key);
|
|
241
|
+
out.push({ path: String(path).replace(/\\/g, '/'), line: lineNo });
|
|
242
|
+
if (out.length >= GREP_COVERAGE_MAX) break;
|
|
243
|
+
}
|
|
244
|
+
return out.length ? out : null;
|
|
245
|
+
}
|
|
246
|
+
|
|
214
247
|
function classifyToolFailure(resultText, toolName) {
|
|
215
248
|
const text = String(resultText ?? '').toLowerCase();
|
|
216
249
|
if (/\[shell-tool-failed\]/i.test(String(resultText ?? ''))) return 'tool-call/failure';
|
|
@@ -264,6 +297,7 @@ function traceAgentTool({ sessionId, iteration, toolName, toolKind, toolMs, tool
|
|
|
264
297
|
const resultLinesEst = typeof resultText === 'string' && resultText.length > 0 ? resultText.split('\n').length : 0;
|
|
265
298
|
const numericToolMs = Number(toolMs);
|
|
266
299
|
const summarizedArgs = summarizeToolArgs(toolName, toolArgs);
|
|
300
|
+
const grepCoverage = parseGrepCoverage(resultText, toolName, toolArgs, resultKind);
|
|
267
301
|
// Hash the FULL args, not the summary: summaries drop payload fields
|
|
268
302
|
// (e.g. apply_patch keeps only base_path), which made every patch in a
|
|
269
303
|
// session collide to one hash and broke duplicate/retry detection.
|
|
@@ -275,6 +309,12 @@ function traceAgentTool({ sessionId, iteration, toolName, toolKind, toolMs, tool
|
|
|
275
309
|
const errorFirstLine = resultKind === 'error'
|
|
276
310
|
? _firstNonEmptyLine(_redactLogText(String(resultText ?? ''))).slice(0, 200) || null
|
|
277
311
|
: null;
|
|
312
|
+
// Failure taxonomy on the tool row itself (mirrors the failure log's
|
|
313
|
+
// `category`) so trace-level aggregation can exclude expected command
|
|
314
|
+
// exits (`command-exit`) without joining tool-failures.jsonl.
|
|
315
|
+
const errorCategory = resultKind === 'error'
|
|
316
|
+
? classifyToolFailure(String(resultText ?? ''), toolName)
|
|
317
|
+
: null;
|
|
278
318
|
// Flat shape — fields named exactly as the agent_calls PG columns so
|
|
279
319
|
// insertAgentCalls can pick them up by direct property access without
|
|
280
320
|
// a payload-unwrap step. result_kind has no column and rides as plain
|
|
@@ -293,10 +333,13 @@ function traceAgentTool({ sessionId, iteration, toolName, toolKind, toolMs, tool
|
|
|
293
333
|
tool_args_summary: summarizedArgs,
|
|
294
334
|
result_kind: resultKind || null,
|
|
295
335
|
result_error_first_line: errorFirstLine,
|
|
336
|
+
result_error_category: errorCategory,
|
|
296
337
|
result_has_next_call: nextCallCount > 0,
|
|
297
338
|
result_next_call_count: nextCallCount,
|
|
298
339
|
result_bytes_est: resultBytesEst,
|
|
299
340
|
result_lines_est: resultLinesEst,
|
|
341
|
+
grep_coverage: grepCoverage,
|
|
342
|
+
cwd: cwd || null,
|
|
300
343
|
});
|
|
301
344
|
if (
|
|
302
345
|
Number.isFinite(numericToolMs)
|