@memnexus-ai/mx-agent-cli 0.1.294-next.0 → 0.1.294
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/dist/__tests__/config-sync.test.js +1 -54
- package/dist/__tests__/config-sync.test.js.map +1 -1
- package/dist/agent-config/hooks/auto-capture-precompact.sh +256 -74
- package/dist/agent-config/hooks/auto-capture-session-end.sh +254 -106
- package/dist/agent-config/hooks/auto-checkpoint.sh +5 -75
- package/dist/agent-config/hooks/observability-sync.sh +9 -46
- package/dist/commands/config-sync.d.ts +0 -37
- package/dist/commands/config-sync.d.ts.map +1 -1
- package/dist/commands/config-sync.js +18 -36
- package/dist/commands/config-sync.js.map +1 -1
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +2 -10
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +2 -8
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/start.d.ts +0 -4
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +0 -6
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/update.d.ts +1 -13
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +1 -50
- package/dist/commands/update.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -67
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-session.d.ts +0 -12
- package/dist/lib/agent-session.d.ts.map +1 -1
- package/dist/lib/agent-session.js +41 -183
- package/dist/lib/agent-session.js.map +1 -1
- package/dist/lib/claude.d.ts +0 -12
- package/dist/lib/claude.d.ts.map +1 -1
- package/dist/lib/claude.js +2 -29
- package/dist/lib/claude.js.map +1 -1
- package/dist/lib/terminal-ui.d.ts.map +1 -1
- package/dist/lib/terminal-ui.js +1 -12
- package/dist/lib/terminal-ui.js.map +1 -1
- package/package.json +2 -3
- package/dist/__tests__/decision-check.test.d.ts +0 -2
- package/dist/__tests__/decision-check.test.d.ts.map +0 -1
- package/dist/__tests__/decision-check.test.js +0 -105
- package/dist/__tests__/decision-check.test.js.map +0 -1
- package/dist/__tests__/harness-extract.test.d.ts +0 -19
- package/dist/__tests__/harness-extract.test.d.ts.map +0 -1
- package/dist/__tests__/harness-extract.test.js +0 -566
- package/dist/__tests__/harness-extract.test.js.map +0 -1
- package/dist/__tests__/harness-wiring.test.d.ts +0 -16
- package/dist/__tests__/harness-wiring.test.d.ts.map +0 -1
- package/dist/__tests__/harness-wiring.test.js +0 -469
- package/dist/__tests__/harness-wiring.test.js.map +0 -1
- package/dist/__tests__/report-format.test.d.ts +0 -2
- package/dist/__tests__/report-format.test.d.ts.map +0 -1
- package/dist/__tests__/report-format.test.js +0 -219
- package/dist/__tests__/report-format.test.js.map +0 -1
- package/dist/__tests__/standards-injection.test.d.ts +0 -2
- package/dist/__tests__/standards-injection.test.d.ts.map +0 -1
- package/dist/__tests__/standards-injection.test.js +0 -157
- package/dist/__tests__/standards-injection.test.js.map +0 -1
- package/dist/commands/decision.d.ts +0 -20
- package/dist/commands/decision.d.ts.map +0 -1
- package/dist/commands/decision.js +0 -54
- package/dist/commands/decision.js.map +0 -1
- package/dist/commands/report.d.ts +0 -33
- package/dist/commands/report.d.ts.map +0 -1
- package/dist/commands/report.js +0 -73
- package/dist/commands/report.js.map +0 -1
- package/dist/lib/decision-check.d.ts +0 -48
- package/dist/lib/decision-check.d.ts.map +0 -1
- package/dist/lib/decision-check.js +0 -149
- package/dist/lib/decision-check.js.map +0 -1
- package/dist/lib/harness/console/announce.d.ts +0 -45
- package/dist/lib/harness/console/announce.d.ts.map +0 -1
- package/dist/lib/harness/console/announce.js +0 -48
- package/dist/lib/harness/console/announce.js.map +0 -1
- package/dist/lib/harness/console/announce.test.d.ts +0 -2
- package/dist/lib/harness/console/announce.test.d.ts.map +0 -1
- package/dist/lib/harness/console/announce.test.js +0 -104
- package/dist/lib/harness/console/announce.test.js.map +0 -1
- package/dist/lib/harness/console/by-session.d.ts +0 -50
- package/dist/lib/harness/console/by-session.d.ts.map +0 -1
- package/dist/lib/harness/console/by-session.js +0 -83
- package/dist/lib/harness/console/by-session.js.map +0 -1
- package/dist/lib/harness/console/by-session.test.d.ts +0 -2
- package/dist/lib/harness/console/by-session.test.d.ts.map +0 -1
- package/dist/lib/harness/console/by-session.test.js +0 -86
- package/dist/lib/harness/console/by-session.test.js.map +0 -1
- package/dist/lib/harness/console/console.d.ts +0 -67
- package/dist/lib/harness/console/console.d.ts.map +0 -1
- package/dist/lib/harness/console/console.js +0 -373
- package/dist/lib/harness/console/console.js.map +0 -1
- package/dist/lib/harness/console/console.test.d.ts +0 -2
- package/dist/lib/harness/console/console.test.d.ts.map +0 -1
- package/dist/lib/harness/console/console.test.js +0 -269
- package/dist/lib/harness/console/console.test.js.map +0 -1
- package/dist/lib/harness/console/decision-request.d.ts +0 -32
- package/dist/lib/harness/console/decision-request.d.ts.map +0 -1
- package/dist/lib/harness/console/decision-request.js +0 -112
- package/dist/lib/harness/console/decision-request.js.map +0 -1
- package/dist/lib/harness/console/decision-request.test.d.ts +0 -2
- package/dist/lib/harness/console/decision-request.test.d.ts.map +0 -1
- package/dist/lib/harness/console/decision-request.test.js +0 -75
- package/dist/lib/harness/console/decision-request.test.js.map +0 -1
- package/dist/lib/harness/console/fixtures.d.ts +0 -16
- package/dist/lib/harness/console/fixtures.d.ts.map +0 -1
- package/dist/lib/harness/console/fixtures.js +0 -49
- package/dist/lib/harness/console/fixtures.js.map +0 -1
- package/dist/lib/harness/console/index.d.ts +0 -15
- package/dist/lib/harness/console/index.d.ts.map +0 -1
- package/dist/lib/harness/console/index.js +0 -14
- package/dist/lib/harness/console/index.js.map +0 -1
- package/dist/lib/harness/console/rank.d.ts +0 -73
- package/dist/lib/harness/console/rank.d.ts.map +0 -1
- package/dist/lib/harness/console/rank.js +0 -113
- package/dist/lib/harness/console/rank.js.map +0 -1
- package/dist/lib/harness/console/rank.test.d.ts +0 -2
- package/dist/lib/harness/console/rank.test.d.ts.map +0 -1
- package/dist/lib/harness/console/rank.test.js +0 -124
- package/dist/lib/harness/console/rank.test.js.map +0 -1
- package/dist/lib/harness/console/render.d.ts +0 -22
- package/dist/lib/harness/console/render.d.ts.map +0 -1
- package/dist/lib/harness/console/render.js +0 -65
- package/dist/lib/harness/console/render.js.map +0 -1
- package/dist/lib/harness/console/render.test.d.ts +0 -2
- package/dist/lib/harness/console/render.test.d.ts.map +0 -1
- package/dist/lib/harness/console/render.test.js +0 -96
- package/dist/lib/harness/console/render.test.js.map +0 -1
- package/dist/lib/harness/console/replay-cli.test.d.ts +0 -2
- package/dist/lib/harness/console/replay-cli.test.d.ts.map +0 -1
- package/dist/lib/harness/console/replay-cli.test.js +0 -96
- package/dist/lib/harness/console/replay-cli.test.js.map +0 -1
- package/dist/lib/harness/console/replay.d.ts +0 -36
- package/dist/lib/harness/console/replay.d.ts.map +0 -1
- package/dist/lib/harness/console/replay.js +0 -59
- package/dist/lib/harness/console/replay.js.map +0 -1
- package/dist/lib/harness/console/replay.test.d.ts +0 -2
- package/dist/lib/harness/console/replay.test.d.ts.map +0 -1
- package/dist/lib/harness/console/replay.test.js +0 -81
- package/dist/lib/harness/console/replay.test.js.map +0 -1
- package/dist/lib/harness/console/turn-reader.d.ts +0 -50
- package/dist/lib/harness/console/turn-reader.d.ts.map +0 -1
- package/dist/lib/harness/console/turn-reader.js +0 -184
- package/dist/lib/harness/console/turn-reader.js.map +0 -1
- package/dist/lib/harness/console/turn-reader.test.d.ts +0 -2
- package/dist/lib/harness/console/turn-reader.test.d.ts.map +0 -1
- package/dist/lib/harness/console/turn-reader.test.js +0 -108
- package/dist/lib/harness/console/turn-reader.test.js.map +0 -1
- package/dist/lib/harness/console/types.d.ts +0 -109
- package/dist/lib/harness/console/types.d.ts.map +0 -1
- package/dist/lib/harness/console/types.js +0 -2
- package/dist/lib/harness/console/types.js.map +0 -1
- package/dist/lib/harness/contract.d.ts +0 -229
- package/dist/lib/harness/contract.d.ts.map +0 -1
- package/dist/lib/harness/contract.js +0 -22
- package/dist/lib/harness/contract.js.map +0 -1
- package/dist/lib/harness/credential.d.ts +0 -23
- package/dist/lib/harness/credential.d.ts.map +0 -1
- package/dist/lib/harness/credential.js +0 -81
- package/dist/lib/harness/credential.js.map +0 -1
- package/dist/lib/harness/credential.test.d.ts +0 -2
- package/dist/lib/harness/credential.test.d.ts.map +0 -1
- package/dist/lib/harness/credential.test.js +0 -74
- package/dist/lib/harness/credential.test.js.map +0 -1
- package/dist/lib/harness/evaluate.d.ts +0 -390
- package/dist/lib/harness/evaluate.d.ts.map +0 -1
- package/dist/lib/harness/evaluate.js +0 -988
- package/dist/lib/harness/evaluate.js.map +0 -1
- package/dist/lib/harness/evaluate.test.d.ts +0 -2
- package/dist/lib/harness/evaluate.test.d.ts.map +0 -1
- package/dist/lib/harness/evaluate.test.js +0 -621
- package/dist/lib/harness/evaluate.test.js.map +0 -1
- package/dist/lib/harness/extract.d.ts +0 -152
- package/dist/lib/harness/extract.d.ts.map +0 -1
- package/dist/lib/harness/extract.js +0 -1601
- package/dist/lib/harness/extract.js.map +0 -1
- package/dist/lib/harness/gate.d.ts +0 -48
- package/dist/lib/harness/gate.d.ts.map +0 -1
- package/dist/lib/harness/gate.js +0 -60
- package/dist/lib/harness/gate.js.map +0 -1
- package/dist/lib/harness/gate.test.d.ts +0 -2
- package/dist/lib/harness/gate.test.d.ts.map +0 -1
- package/dist/lib/harness/gate.test.js +0 -111
- package/dist/lib/harness/gate.test.js.map +0 -1
- package/dist/lib/harness/self-check.d.ts +0 -59
- package/dist/lib/harness/self-check.d.ts.map +0 -1
- package/dist/lib/harness/self-check.js +0 -56
- package/dist/lib/harness/self-check.js.map +0 -1
- package/dist/lib/harness/self-check.test.d.ts +0 -2
- package/dist/lib/harness/self-check.test.d.ts.map +0 -1
- package/dist/lib/harness/self-check.test.js +0 -43
- package/dist/lib/harness/self-check.test.js.map +0 -1
- package/dist/lib/harness/transcript.d.ts +0 -65
- package/dist/lib/harness/transcript.d.ts.map +0 -1
- package/dist/lib/harness/transcript.js +0 -144
- package/dist/lib/harness/transcript.js.map +0 -1
- package/dist/lib/harness/transcript.test.d.ts +0 -2
- package/dist/lib/harness/transcript.test.d.ts.map +0 -1
- package/dist/lib/harness/transcript.test.js +0 -118
- package/dist/lib/harness/transcript.test.js.map +0 -1
- package/dist/lib/harness-wiring.d.ts +0 -145
- package/dist/lib/harness-wiring.d.ts.map +0 -1
- package/dist/lib/harness-wiring.js +0 -280
- package/dist/lib/harness-wiring.js.map +0 -1
- package/dist/lib/report-format.d.ts +0 -132
- package/dist/lib/report-format.d.ts.map +0 -1
- package/dist/lib/report-format.js +0 -317
- package/dist/lib/report-format.js.map +0 -1
- package/dist/lib/standards.d.ts +0 -90
- package/dist/lib/standards.d.ts.map +0 -1
- package/dist/lib/standards.js +0 -194
- package/dist/lib/standards.js.map +0 -1
- package/dist/standards/decision-request.md +0 -90
- package/dist/standards/fail-loud-standard.md +0 -495
- package/dist/standards/report-format.md +0 -120
- package/dist/standards/writing-standard.md +0 -240
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* report-format.ts — the seven sections every agent report answers, the
|
|
3
|
-
* skeleton the framework writes, and the check that refuses a report missing
|
|
4
|
-
* one.
|
|
5
|
-
*
|
|
6
|
-
* PROBLEM. Across 12 real sessions and 190 moments where an agent needed the
|
|
7
|
-
* operator, 3 reached him. 25 of the 28 moments classed as an explicit question
|
|
8
|
-
* were agents writing that they needed a decision, in prose, into a channel
|
|
9
|
-
* nobody reads (`docs/fleet-behavior-from-transcripts.md` finding 3c). The same
|
|
10
|
-
* repository produced roughly forty commits and nine documents in two days, and
|
|
11
|
-
* the person they were written for asked four times what the work was. The
|
|
12
|
-
* defect is the format rather than the effort, so the format is the fix.
|
|
13
|
-
*
|
|
14
|
-
* Two sections do most of the work. Section 3 states the command behind each
|
|
15
|
-
* claim, which is what makes a finding challengeable; this repository published
|
|
16
|
-
* eight figures in one week that were correct against the wrong thing, and the
|
|
17
|
-
* source line is what made them findable (`.mx-agent/lessons.md` L2). Section 5
|
|
18
|
-
* states what would overturn the finding, which is what makes a wrong finding
|
|
19
|
-
* cheap to check.
|
|
20
|
-
*
|
|
21
|
-
* FAILURE MODEL — loud and FAIL-CLOSED at the check. `checkReport` is pure and
|
|
22
|
-
* never throws; it returns every problem it found. `mx-agent report check`
|
|
23
|
-
* refuses on any problem, the same shape as the provisioning behavioral-block
|
|
24
|
-
* contract in `commands/create.ts`: a throw rather than a `process.exit`, so a
|
|
25
|
-
* caller that wraps it keeps its recovery path. Refusing at the moment a person
|
|
26
|
-
* is looking is what stops the state being created, and warning is what let the
|
|
27
|
-
* roleguide gap run for four weeks (#4541).
|
|
28
|
-
*
|
|
29
|
-
* ONE SOURCE FOR THE SEVEN. `REPORT_SECTIONS` below is the only list. The
|
|
30
|
-
* skeleton is generated from it and `mx-agent-system/standards/report-format.md`
|
|
31
|
-
* is checked against it by a test, so the document and the validator cannot
|
|
32
|
-
* drift apart.
|
|
33
|
-
*/
|
|
34
|
-
export const REPORT_SECTIONS = [
|
|
35
|
-
{
|
|
36
|
-
index: 1,
|
|
37
|
-
heading: 'What I was asked',
|
|
38
|
-
aliases: ['what i was asked', 'what i was asked to do'],
|
|
39
|
-
prompt: 'One sentence. Then name the rung: Level 1, Level 2 or Level 3 from .mx-agent/goals.md.',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
index: 2,
|
|
43
|
-
heading: 'What I did',
|
|
44
|
-
aliases: ['what i did'],
|
|
45
|
-
prompt: 'The actions, not the reasoning. What you ran, read, wrote and changed.',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
index: 3,
|
|
49
|
-
heading: 'What I found',
|
|
50
|
-
aliases: ['what i found'],
|
|
51
|
-
prompt: 'Each claim with the command, the file:line, or the query that produced it. ' +
|
|
52
|
-
'A claim with no source belongs in section 4.',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
index: 4,
|
|
56
|
-
heading: 'What I am not sure about',
|
|
57
|
-
aliases: ['what i am not sure about', 'what im not sure about'],
|
|
58
|
-
prompt: 'State it rather than omitting it. Anything you could not run belongs here by name.',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
index: 5,
|
|
62
|
-
heading: 'What would change my mind',
|
|
63
|
-
aliases: ['what would change my mind'],
|
|
64
|
-
prompt: 'The specific observation that would overturn each finding. Not "more data": ' +
|
|
65
|
-
'name the file, the run or the number.',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
index: 6,
|
|
69
|
-
heading: 'What I need from you',
|
|
70
|
-
aliases: ['what i need from you'],
|
|
71
|
-
prompt: 'A decision, or the word Nothing. This section is the channel, not your prose.',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
index: 7,
|
|
75
|
-
heading: 'What I would do next',
|
|
76
|
-
aliases: ['what i would do next'],
|
|
77
|
-
prompt: 'What you would pick up, and why that rather than something else.',
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
/**
|
|
81
|
-
* Match a heading tolerantly.
|
|
82
|
-
*
|
|
83
|
-
* Any heading level, an optional leading number, optional bold, and any
|
|
84
|
-
* trailing punctuation. Apostrophes are dropped so "What I'm not sure about"
|
|
85
|
-
* matches "what im not sure about". A report is refused for missing a section,
|
|
86
|
-
* never for how it punctuated one.
|
|
87
|
-
*/
|
|
88
|
-
export function normaliseHeading(line) {
|
|
89
|
-
return line
|
|
90
|
-
.replace(/^\s*#{1,6}\s*/, '')
|
|
91
|
-
.replace(/\*\*/g, '')
|
|
92
|
-
.replace(/^\s*\d+\s*[.)::-]\s*/, '')
|
|
93
|
-
.replace(/['‘’]/g, '')
|
|
94
|
-
.replace(/[.:;!?,\s]+$/, '')
|
|
95
|
-
.replace(/\s+/g, ' ')
|
|
96
|
-
.trim()
|
|
97
|
-
.toLowerCase();
|
|
98
|
-
}
|
|
99
|
-
function sectionForHeading(line) {
|
|
100
|
-
const key = normaliseHeading(line);
|
|
101
|
-
if (key === '')
|
|
102
|
-
return null;
|
|
103
|
-
return REPORT_SECTIONS.find((s) => s.aliases.includes(key)) ?? null;
|
|
104
|
-
}
|
|
105
|
-
/** True for a markdown ATX heading line, outside a fenced block. */
|
|
106
|
-
function isHeadingLine(line) {
|
|
107
|
-
return /^\s*#{1,6}\s+\S/.test(line);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Strip what the writer did not write.
|
|
111
|
-
*
|
|
112
|
-
* The skeleton's prompts are HTML comments, so an unfilled skeleton has no body
|
|
113
|
-
* text at all and fails `section-empty`. That is deliberate: `report new` piped
|
|
114
|
-
* straight into `report check` must be refused, or the skeleton becomes a way
|
|
115
|
-
* to pass the check without answering anything.
|
|
116
|
-
*/
|
|
117
|
-
export function stripNonContent(body) {
|
|
118
|
-
return body
|
|
119
|
-
.replace(/<!--[\s\S]*?-->/g, ' ')
|
|
120
|
-
.replace(/^\s*[-*+]\s*$/gm, ' ')
|
|
121
|
-
.trim();
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Does section 3 state a source a reader could re-run?
|
|
125
|
-
*
|
|
126
|
-
* Deliberately shallow. It cannot tell whether the command is the one that
|
|
127
|
-
* produced the number, which is exactly the failure L2 records, and only
|
|
128
|
-
* re-running catches that. What it can do is refuse a section of bare
|
|
129
|
-
* assertions, which is the common case.
|
|
130
|
-
*/
|
|
131
|
-
export function statesEvidence(body) {
|
|
132
|
-
if (/```/.test(body))
|
|
133
|
-
return true;
|
|
134
|
-
if (/`[^`\n]{3,}`/.test(body))
|
|
135
|
-
return true;
|
|
136
|
-
if (/\b[\w./-]+\.[a-z]{1,5}:\d+\b/i.test(body))
|
|
137
|
-
return true;
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
/** Does section 1 name a rung of the goal ladder? */
|
|
141
|
-
export function namesGoalRung(body) {
|
|
142
|
-
return /\blevel\s*[123]\b/i.test(body);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Check a report. Pure, never throws, returns every problem it found.
|
|
146
|
-
*
|
|
147
|
-
* Reporting all problems at once matters more than it sounds. A check that
|
|
148
|
-
* stops at the first missing section turns one fix into seven round trips, and
|
|
149
|
-
* an agent that has been refused seven times stops using the format.
|
|
150
|
-
*/
|
|
151
|
-
export function checkReport(text) {
|
|
152
|
-
const lines = text.split('\n');
|
|
153
|
-
const bodies = new Map();
|
|
154
|
-
const order = [];
|
|
155
|
-
const problems = [];
|
|
156
|
-
const seen = new Map();
|
|
157
|
-
let fenced = false;
|
|
158
|
-
let current = null;
|
|
159
|
-
let buffer = [];
|
|
160
|
-
const flush = () => {
|
|
161
|
-
if (!current)
|
|
162
|
-
return;
|
|
163
|
-
const body = stripNonContent(buffer.join('\n'));
|
|
164
|
-
// A repeated heading keeps the first body rather than the last. Which of two
|
|
165
|
-
// bodies is "the" section is not a question this parser is entitled to
|
|
166
|
-
// guess, and the repetition is reported either way.
|
|
167
|
-
if (!bodies.has(current.index))
|
|
168
|
-
bodies.set(current.index, body);
|
|
169
|
-
buffer = [];
|
|
170
|
-
};
|
|
171
|
-
for (const line of lines) {
|
|
172
|
-
if (/^\s*```/.test(line)) {
|
|
173
|
-
fenced = !fenced;
|
|
174
|
-
if (current)
|
|
175
|
-
buffer.push(line);
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (!fenced && isHeadingLine(line)) {
|
|
179
|
-
const section = sectionForHeading(line);
|
|
180
|
-
if (section) {
|
|
181
|
-
flush();
|
|
182
|
-
current = section;
|
|
183
|
-
order.push(section.index);
|
|
184
|
-
seen.set(section.index, (seen.get(section.index) ?? 0) + 1);
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
// A heading that is not one of the seven ends the previous section's body
|
|
188
|
-
// and starts no new one, so text under an unrelated heading is never
|
|
189
|
-
// counted as answering a required section.
|
|
190
|
-
flush();
|
|
191
|
-
current = null;
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
if (current)
|
|
195
|
-
buffer.push(line);
|
|
196
|
-
}
|
|
197
|
-
flush();
|
|
198
|
-
for (const section of REPORT_SECTIONS) {
|
|
199
|
-
const count = seen.get(section.index) ?? 0;
|
|
200
|
-
if (count === 0) {
|
|
201
|
-
problems.push({
|
|
202
|
-
code: 'section-missing',
|
|
203
|
-
section: section.index,
|
|
204
|
-
detail: `Section ${section.index} "${section.heading}" is absent.`,
|
|
205
|
-
});
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
if (count > 1) {
|
|
209
|
-
problems.push({
|
|
210
|
-
code: 'section-repeated',
|
|
211
|
-
section: section.index,
|
|
212
|
-
detail: `Section ${section.index} "${section.heading}" appears ${count} times. ` +
|
|
213
|
-
`Exactly one of each is required.`,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
const body = bodies.get(section.index) ?? '';
|
|
217
|
-
if (body === '') {
|
|
218
|
-
problems.push({
|
|
219
|
-
code: 'section-empty',
|
|
220
|
-
section: section.index,
|
|
221
|
-
detail: `Section ${section.index} "${section.heading}" has a heading and no content. ` +
|
|
222
|
-
`An empty section is the same failure as a missing one.`,
|
|
223
|
-
});
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
|
-
if (section.index === 1 && !namesGoalRung(body)) {
|
|
227
|
-
problems.push({
|
|
228
|
-
code: 'goal-rung-missing',
|
|
229
|
-
section: 1,
|
|
230
|
-
detail: 'Section 1 names no rung. State Level 1, Level 2 or Level 3 from ' +
|
|
231
|
-
'.mx-agent/goals.md. An agent that cannot name its rung has an assignment ' +
|
|
232
|
-
'nobody can evaluate.',
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
if (section.index === 3 && !statesEvidence(body)) {
|
|
236
|
-
problems.push({
|
|
237
|
-
code: 'evidence-missing',
|
|
238
|
-
section: 3,
|
|
239
|
-
detail: 'Section 3 states no source. Every claim needs the command, the file:line, or ' +
|
|
240
|
-
'the query that produced it, so a reader can re-run it instead of believing it.',
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
const found = order.filter((index, i) => order.indexOf(index) === i);
|
|
245
|
-
const ascending = found.every((index, i) => i === 0 || index > found[i - 1]);
|
|
246
|
-
if (found.length > 1 && !ascending) {
|
|
247
|
-
problems.push({
|
|
248
|
-
code: 'sections-out-of-order',
|
|
249
|
-
section: null,
|
|
250
|
-
detail: `Sections appear as ${found.join(', ')}. The order is fixed at 1 to 7, because a ` +
|
|
251
|
-
`reader looks for section 5 in the same place in every report.`,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
return { ok: problems.length === 0, problems, bodies, order };
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Write the seven headings.
|
|
258
|
-
*
|
|
259
|
-
* Prompts are HTML comments so they render as nothing and strip to nothing.
|
|
260
|
-
* A skeleton with no answers therefore fails `report check`, which is the
|
|
261
|
-
* property that keeps the skeleton from becoming a way past it.
|
|
262
|
-
*/
|
|
263
|
-
export function renderReportSkeleton(options = {}) {
|
|
264
|
-
const out = [];
|
|
265
|
-
if (options.title)
|
|
266
|
-
out.push(`# ${options.title}`, '');
|
|
267
|
-
for (const section of REPORT_SECTIONS) {
|
|
268
|
-
out.push(`## ${section.index}. ${section.heading}`);
|
|
269
|
-
out.push('');
|
|
270
|
-
out.push(`<!-- ${section.prompt} -->`);
|
|
271
|
-
if (section.index === 1) {
|
|
272
|
-
if (options.task)
|
|
273
|
-
out.push('', options.task);
|
|
274
|
-
if (options.rung)
|
|
275
|
-
out.push('', `Serves Level ${options.rung}.`);
|
|
276
|
-
}
|
|
277
|
-
out.push('');
|
|
278
|
-
}
|
|
279
|
-
return out.join('\n').replace(/\n{3,}/g, '\n\n').trimEnd() + '\n';
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Refusal from the report-format contract.
|
|
283
|
-
*
|
|
284
|
-
* A THROW, not a `process.exit`, for the reason `BehavioralContractError`
|
|
285
|
-
* records: a caller that wraps this keeps its own recovery path, and the
|
|
286
|
-
* top-level action already catches, prints and exits 1.
|
|
287
|
-
*/
|
|
288
|
-
export class ReportFormatError extends Error {
|
|
289
|
-
code = 'report-format-refused';
|
|
290
|
-
problems;
|
|
291
|
-
constructor(message, problems) {
|
|
292
|
-
super(message);
|
|
293
|
-
this.name = 'ReportFormatError';
|
|
294
|
-
this.problems = problems;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* The refusal an operator reads. Plain text, no colour, so it is testable and
|
|
299
|
-
* so it survives being piped into a file or a pull request comment.
|
|
300
|
-
*/
|
|
301
|
-
export function refusalMessage(result, label) {
|
|
302
|
-
const missing = result.problems.filter((p) => p.code === 'section-missing').length;
|
|
303
|
-
const headline = missing > 0
|
|
304
|
-
? `Report REFUSED — ${missing} of ${REPORT_SECTIONS.length} sections are absent.`
|
|
305
|
-
: 'Report REFUSED — the format contract is not met.';
|
|
306
|
-
const lines = ['', headline, '', ` File: ${label}`, ` Problems: ${result.problems.length}`, ''];
|
|
307
|
-
for (const problem of result.problems) {
|
|
308
|
-
lines.push(` [${problem.code}] ${problem.detail}`);
|
|
309
|
-
}
|
|
310
|
-
lines.push('', ' Every agent report answers the same seven things in the same order, so a reader', ' finds section 5 in the same place every time. Section 3 makes a finding', ' challengeable. Section 5 makes a wrong finding cheap to overturn.', '', ' The seven:');
|
|
311
|
-
for (const section of REPORT_SECTIONS) {
|
|
312
|
-
lines.push(` ${section.index}. ${section.heading}`);
|
|
313
|
-
}
|
|
314
|
-
lines.push('', ` Fix: mx-agent report new > ${label} then answer each section.`, ' Standard: mx-agent-system/standards/report-format.md', '');
|
|
315
|
-
return lines.join('\n');
|
|
316
|
-
}
|
|
317
|
-
//# sourceMappingURL=report-format.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-format.js","sourceRoot":"","sources":["../../src/lib/report-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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H,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/lib/standards.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* standards.ts — read the framework's writing standard and report format, and
|
|
3
|
-
* render them for injection into every conversation turn.
|
|
4
|
-
*
|
|
5
|
-
* PROBLEM. The style rules this project runs on existed in one person's memory
|
|
6
|
-
* and in corrections made during conversation. Every new agent rediscovered
|
|
7
|
-
* them by being corrected, and the corrections cost a turn each. The report
|
|
8
|
-
* format did not exist at all, so 25 of 28 moments where an agent needed a
|
|
9
|
-
* decision went out as prose into a channel nobody reads
|
|
10
|
-
* (`docs/fleet-behavior-from-transcripts.md` finding 3c).
|
|
11
|
-
*
|
|
12
|
-
* WHY INJECTION RATHER THAN A FILE. `product/mx-agent-prd.md:268` records the
|
|
13
|
-
* pattern this repository already measured: when we built a mechanism, teams
|
|
14
|
-
* followed the practice, and when we only wrote a rule, they stopped. The
|
|
15
|
-
* correction-of-errors requirement lived in process documents as an
|
|
16
|
-
* instruction, and 16 required records were never filed. A standard read once
|
|
17
|
-
* at session start is that same shape. So these two documents go into
|
|
18
|
-
* `CLAUDE.local.md`, which the runtime re-reads on every turn.
|
|
19
|
-
*
|
|
20
|
-
* THE BLOCKS ARE MARKED, NOT WHOLE FILES. Each standard carries the same
|
|
21
|
-
* `<!-- behavioral-start -->` markers a roleguide uses, and only the marked
|
|
22
|
-
* block is injected. That is deliberate reuse: `extractMarkerBlock` already
|
|
23
|
-
* enforces exactly one marker pair, a non-empty block, a byte ceiling, and no
|
|
24
|
-
* control characters, and every one of those failures is a real way to poison
|
|
25
|
-
* per-turn context. It also means the documents can hold worked examples and
|
|
26
|
-
* git history without paying for them on every turn.
|
|
27
|
-
*
|
|
28
|
-
* FAILURE MODEL — loud, named, FAIL-OPEN. A standard that cannot be read is a
|
|
29
|
-
* real degradation and is not a reason to refuse a session. It is the same tier
|
|
30
|
-
* as the behavioral block in `claude.ts`: warn once, name the file and the
|
|
31
|
-
* problem, continue. The fail-closed control for this pair is
|
|
32
|
-
* `mx-agent report check`, which refuses a report rather than a session.
|
|
33
|
-
*/
|
|
34
|
-
/** Files read from the standards directory, in the order they are injected. */
|
|
35
|
-
export declare const INJECTED_STANDARDS: readonly [{
|
|
36
|
-
readonly file: "writing-standard.md";
|
|
37
|
-
readonly title: "Writing standard";
|
|
38
|
-
}, {
|
|
39
|
-
readonly file: "report-format.md";
|
|
40
|
-
readonly title: "Report format";
|
|
41
|
-
}, {
|
|
42
|
-
readonly file: "decision-request.md";
|
|
43
|
-
readonly title: "Decision request";
|
|
44
|
-
}];
|
|
45
|
-
/** Bytes the rendered block may reach before it is dropped rather than injected. */
|
|
46
|
-
export declare const MAX_STANDARDS_BLOCK_BYTES: number;
|
|
47
|
-
/**
|
|
48
|
-
* Resolve the directory holding the shipped standards.
|
|
49
|
-
*
|
|
50
|
-
* Order, mirroring `bundled-config.ts`:
|
|
51
|
-
* 1. `MX_STANDARDS_DIR` — test seam and power-user override
|
|
52
|
-
* 2. `<cliDist>/standards/` — the copy bundled into the package
|
|
53
|
-
* 3. `<repoRoot>/mx-agent-system/standards/` — dev and monorepo fallback
|
|
54
|
-
*
|
|
55
|
-
* TRUST BOUNDARY. Whatever the override points at is injected verbatim into
|
|
56
|
-
* every turn of every team. Set it only to a directory you control.
|
|
57
|
-
*/
|
|
58
|
-
export declare function getStandardsDir(): string | null;
|
|
59
|
-
export type StandardProblem = 'dir-missing' | 'file-missing' | 'file-unreadable' | 'markers-missing' | 'markers-repeated' | 'markers-inverted' | 'content-empty' | 'content-too-large' | 'content-control-characters';
|
|
60
|
-
export interface StandardBlock {
|
|
61
|
-
file: string;
|
|
62
|
-
title: string;
|
|
63
|
-
ok: boolean;
|
|
64
|
-
content: string | null;
|
|
65
|
-
problem: StandardProblem | null;
|
|
66
|
-
detail: string | null;
|
|
67
|
-
}
|
|
68
|
-
export interface StandardsResolution {
|
|
69
|
-
/** Directory the blocks were read from, or null when none was found. */
|
|
70
|
-
dir: string | null;
|
|
71
|
-
blocks: StandardBlock[];
|
|
72
|
-
/** Text to insert into CLAUDE.local.md. Empty when nothing could be read. */
|
|
73
|
-
rendered: string;
|
|
74
|
-
/** True when every configured standard produced a block. */
|
|
75
|
-
complete: boolean;
|
|
76
|
-
/** One line per degradation, for the caller to log. Empty on the good path. */
|
|
77
|
-
warnings: string[];
|
|
78
|
-
}
|
|
79
|
-
/** Read one standard and extract its marked block. Never throws. */
|
|
80
|
-
export declare function readStandardBlock(dir: string, file: string, title: string): StandardBlock;
|
|
81
|
-
/**
|
|
82
|
-
* Read every shipped standard and render the injectable text.
|
|
83
|
-
*
|
|
84
|
-
* A partial result is still injected. One readable standard reaching every turn
|
|
85
|
-
* beats nothing reaching any turn, and the missing one is named in `warnings`.
|
|
86
|
-
*/
|
|
87
|
-
export declare function resolveStandards(dirOverride?: string): StandardsResolution;
|
|
88
|
-
/** Compose the blocks into the text written into CLAUDE.local.md. */
|
|
89
|
-
export declare function renderStandards(blocks: StandardBlock[]): string;
|
|
90
|
-
//# sourceMappingURL=standards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standards.d.ts","sourceRoot":"","sources":["../../src/lib/standards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB;;;;;;;;;EAIrB,CAAC;AAEX,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,QAAY,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAiB/C;AAED,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,4BAA4B,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAqCzF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,mBAAmB,CA4D1E;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAc/D"}
|
package/dist/lib/standards.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* standards.ts — read the framework's writing standard and report format, and
|
|
3
|
-
* render them for injection into every conversation turn.
|
|
4
|
-
*
|
|
5
|
-
* PROBLEM. The style rules this project runs on existed in one person's memory
|
|
6
|
-
* and in corrections made during conversation. Every new agent rediscovered
|
|
7
|
-
* them by being corrected, and the corrections cost a turn each. The report
|
|
8
|
-
* format did not exist at all, so 25 of 28 moments where an agent needed a
|
|
9
|
-
* decision went out as prose into a channel nobody reads
|
|
10
|
-
* (`docs/fleet-behavior-from-transcripts.md` finding 3c).
|
|
11
|
-
*
|
|
12
|
-
* WHY INJECTION RATHER THAN A FILE. `product/mx-agent-prd.md:268` records the
|
|
13
|
-
* pattern this repository already measured: when we built a mechanism, teams
|
|
14
|
-
* followed the practice, and when we only wrote a rule, they stopped. The
|
|
15
|
-
* correction-of-errors requirement lived in process documents as an
|
|
16
|
-
* instruction, and 16 required records were never filed. A standard read once
|
|
17
|
-
* at session start is that same shape. So these two documents go into
|
|
18
|
-
* `CLAUDE.local.md`, which the runtime re-reads on every turn.
|
|
19
|
-
*
|
|
20
|
-
* THE BLOCKS ARE MARKED, NOT WHOLE FILES. Each standard carries the same
|
|
21
|
-
* `<!-- behavioral-start -->` markers a roleguide uses, and only the marked
|
|
22
|
-
* block is injected. That is deliberate reuse: `extractMarkerBlock` already
|
|
23
|
-
* enforces exactly one marker pair, a non-empty block, a byte ceiling, and no
|
|
24
|
-
* control characters, and every one of those failures is a real way to poison
|
|
25
|
-
* per-turn context. It also means the documents can hold worked examples and
|
|
26
|
-
* git history without paying for them on every turn.
|
|
27
|
-
*
|
|
28
|
-
* FAILURE MODEL — loud, named, FAIL-OPEN. A standard that cannot be read is a
|
|
29
|
-
* real degradation and is not a reason to refuse a session. It is the same tier
|
|
30
|
-
* as the behavioral block in `claude.ts`: warn once, name the file and the
|
|
31
|
-
* problem, continue. The fail-closed control for this pair is
|
|
32
|
-
* `mx-agent report check`, which refuses a report rather than a session.
|
|
33
|
-
*/
|
|
34
|
-
import { existsSync, readFileSync, statSync } from 'fs';
|
|
35
|
-
import { dirname, join } from 'path';
|
|
36
|
-
import { fileURLToPath } from 'url';
|
|
37
|
-
import { extractMarkerBlock, sanitizeForMessage } from './behavioral-injection.js';
|
|
38
|
-
/** Files read from the standards directory, in the order they are injected. */
|
|
39
|
-
export const INJECTED_STANDARDS = [
|
|
40
|
-
{ file: 'writing-standard.md', title: 'Writing standard' },
|
|
41
|
-
{ file: 'report-format.md', title: 'Report format' },
|
|
42
|
-
{ file: 'decision-request.md', title: 'Decision request' },
|
|
43
|
-
];
|
|
44
|
-
/** Bytes the rendered block may reach before it is dropped rather than injected. */
|
|
45
|
-
export const MAX_STANDARDS_BLOCK_BYTES = 16 * 1024;
|
|
46
|
-
/**
|
|
47
|
-
* Resolve the directory holding the shipped standards.
|
|
48
|
-
*
|
|
49
|
-
* Order, mirroring `bundled-config.ts`:
|
|
50
|
-
* 1. `MX_STANDARDS_DIR` — test seam and power-user override
|
|
51
|
-
* 2. `<cliDist>/standards/` — the copy bundled into the package
|
|
52
|
-
* 3. `<repoRoot>/mx-agent-system/standards/` — dev and monorepo fallback
|
|
53
|
-
*
|
|
54
|
-
* TRUST BOUNDARY. Whatever the override points at is injected verbatim into
|
|
55
|
-
* every turn of every team. Set it only to a directory you control.
|
|
56
|
-
*/
|
|
57
|
-
export function getStandardsDir() {
|
|
58
|
-
const override = process.env.MX_STANDARDS_DIR;
|
|
59
|
-
if (override && existsSync(join(override, INJECTED_STANDARDS[0].file)))
|
|
60
|
-
return override;
|
|
61
|
-
const here = dirname(fileURLToPath(import.meta.url)); // dist/lib or src/lib
|
|
62
|
-
const bundled = join(here, '..', 'standards');
|
|
63
|
-
if (existsSync(join(bundled, INJECTED_STANDARDS[0].file)))
|
|
64
|
-
return bundled;
|
|
65
|
-
let dir = here;
|
|
66
|
-
for (let i = 0; i < 20; i += 1) {
|
|
67
|
-
const guess = join(dir, 'mx-agent-system', 'standards');
|
|
68
|
-
if (existsSync(join(guess, INJECTED_STANDARDS[0].file)))
|
|
69
|
-
return guess;
|
|
70
|
-
const parent = dirname(dir);
|
|
71
|
-
if (parent === dir)
|
|
72
|
-
break;
|
|
73
|
-
dir = parent;
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
/** Read one standard and extract its marked block. Never throws. */
|
|
78
|
-
export function readStandardBlock(dir, file, title) {
|
|
79
|
-
const path = join(dir, file);
|
|
80
|
-
const base = { file, title };
|
|
81
|
-
let raw;
|
|
82
|
-
try {
|
|
83
|
-
const stat = statSync(path);
|
|
84
|
-
if (!stat.isFile()) {
|
|
85
|
-
return {
|
|
86
|
-
...base, ok: false, content: null, problem: 'file-missing',
|
|
87
|
-
detail: `${sanitizeForMessage(path)} is not a regular file`,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
raw = readFileSync(path, 'utf-8');
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
const code = err?.code;
|
|
94
|
-
return {
|
|
95
|
-
...base, ok: false,
|
|
96
|
-
content: null,
|
|
97
|
-
problem: code === 'ENOENT' ? 'file-missing' : 'file-unreadable',
|
|
98
|
-
detail: `${sanitizeForMessage(path)} could not be read (${sanitizeForMessage(code ?? 'unknown')})`,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
// Reuse the roleguide extractor rather than writing a second marker parser.
|
|
102
|
-
// It already refuses repeated, nested and inverted markers, an empty block,
|
|
103
|
-
// an oversize block and control characters, and each of those is a real way
|
|
104
|
-
// to corrupt per-turn context.
|
|
105
|
-
const result = extractMarkerBlock(raw, `${file}`);
|
|
106
|
-
if (!result.ok || !result.content) {
|
|
107
|
-
return {
|
|
108
|
-
...base, ok: false, content: null,
|
|
109
|
-
problem: result.problem ?? 'content-empty',
|
|
110
|
-
detail: result.detail,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
return { ...base, ok: true, content: result.content, problem: null, detail: null };
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Read every shipped standard and render the injectable text.
|
|
117
|
-
*
|
|
118
|
-
* A partial result is still injected. One readable standard reaching every turn
|
|
119
|
-
* beats nothing reaching any turn, and the missing one is named in `warnings`.
|
|
120
|
-
*/
|
|
121
|
-
export function resolveStandards(dirOverride) {
|
|
122
|
-
const dir = dirOverride ?? getStandardsDir();
|
|
123
|
-
if (!dir) {
|
|
124
|
-
return {
|
|
125
|
-
dir: null,
|
|
126
|
-
blocks: [],
|
|
127
|
-
rendered: '',
|
|
128
|
-
complete: false,
|
|
129
|
-
warnings: [
|
|
130
|
-
'Writing standard and report format NOT injected: no standards directory was found. ' +
|
|
131
|
-
'This team writes with no per-turn style or report contract. ' +
|
|
132
|
-
'Fix: set MX_STANDARDS_DIR, or run from a checkout containing ' +
|
|
133
|
-
'mx-agent-system/standards/.',
|
|
134
|
-
],
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
const blocks = INJECTED_STANDARDS.map((s) => readStandardBlock(dir, s.file, s.title));
|
|
138
|
-
const warnings = [];
|
|
139
|
-
for (const block of blocks) {
|
|
140
|
-
if (block.ok)
|
|
141
|
-
continue;
|
|
142
|
-
warnings.push(`Standard "${sanitizeForMessage(block.file)}" NOT injected (${block.problem}): ` +
|
|
143
|
-
`${sanitizeForMessage(block.detail ?? 'no detail')}. This team writes without it on ` +
|
|
144
|
-
`every turn. Fix: restore the ${sanitizeForMessage(block.file)} marker block in ` +
|
|
145
|
-
`${sanitizeForMessage(dir)}.`);
|
|
146
|
-
}
|
|
147
|
-
const usable = blocks.filter((b) => b.ok && b.content);
|
|
148
|
-
const rendered = usable.length === 0 ? '' : renderStandards(usable);
|
|
149
|
-
// The ceiling is separate from the per-file one because what costs the team is
|
|
150
|
-
// the total re-sent on every turn, and two blocks under the file limit can be
|
|
151
|
-
// over it together.
|
|
152
|
-
const bytes = Buffer.byteLength(rendered, 'utf-8');
|
|
153
|
-
if (bytes > MAX_STANDARDS_BLOCK_BYTES) {
|
|
154
|
-
return {
|
|
155
|
-
dir,
|
|
156
|
-
blocks,
|
|
157
|
-
rendered: '',
|
|
158
|
-
complete: false,
|
|
159
|
-
warnings: [
|
|
160
|
-
...warnings,
|
|
161
|
-
`Writing standard and report format NOT injected: the rendered block is ` +
|
|
162
|
-
`${Math.round(bytes / 1024)} KiB, over the ${MAX_STANDARDS_BLOCK_BYTES / 1024} KiB ` +
|
|
163
|
-
`limit. This text is re-sent on EVERY conversation turn, so an oversize block ` +
|
|
164
|
-
`evicts the team's working context. Fix: shorten the marked blocks in ` +
|
|
165
|
-
`${sanitizeForMessage(dir)}.`,
|
|
166
|
-
],
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
dir,
|
|
171
|
-
blocks,
|
|
172
|
-
rendered,
|
|
173
|
-
complete: usable.length === INJECTED_STANDARDS.length,
|
|
174
|
-
warnings,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
/** Compose the blocks into the text written into CLAUDE.local.md. */
|
|
178
|
-
export function renderStandards(blocks) {
|
|
179
|
-
const parts = [
|
|
180
|
-
'# Framework standards (every-turn reinforcement)',
|
|
181
|
-
'',
|
|
182
|
-
'> Pinned here so they re-inject on every conversation turn. The full standards, with' +
|
|
183
|
-
' worked before-and-after corrections, are in `mx-agent-system/standards/`.',
|
|
184
|
-
'',
|
|
185
|
-
];
|
|
186
|
-
for (const block of blocks) {
|
|
187
|
-
if (!block.ok || !block.content)
|
|
188
|
-
continue;
|
|
189
|
-
parts.push(`## ${block.title}`, '', block.content, '');
|
|
190
|
-
}
|
|
191
|
-
parts.push('---', '');
|
|
192
|
-
return parts.join('\n');
|
|
193
|
-
}
|
|
194
|
-
//# sourceMappingURL=standards.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standards.js","sourceRoot":"","sources":["../../src/lib/standards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEnF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,kBAAkB,EAAE;IAC1D,EAAE,IAAI,EAAE,k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