@groundnuty/macf 0.2.35 → 0.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/.build-info.json +2 -2
  2. package/dist/cli/claude-sh.d.ts +12 -10
  3. package/dist/cli/claude-sh.d.ts.map +1 -1
  4. package/dist/cli/claude-sh.js +26 -13
  5. package/dist/cli/claude-sh.js.map +1 -1
  6. package/dist/cli/commands/certs.js +3 -3
  7. package/dist/cli/commands/certs.js.map +1 -1
  8. package/dist/cli/commands/init.d.ts.map +1 -1
  9. package/dist/cli/commands/init.js +10 -0
  10. package/dist/cli/commands/init.js.map +1 -1
  11. package/dist/cli/commands/monitor.d.ts +16 -0
  12. package/dist/cli/commands/monitor.d.ts.map +1 -0
  13. package/dist/cli/commands/monitor.js +96 -0
  14. package/dist/cli/commands/monitor.js.map +1 -0
  15. package/dist/cli/commands/propose.d.ts +21 -0
  16. package/dist/cli/commands/propose.d.ts.map +1 -0
  17. package/dist/cli/commands/propose.js +128 -0
  18. package/dist/cli/commands/propose.js.map +1 -0
  19. package/dist/cli/commands/rules-refresh.d.ts +1 -0
  20. package/dist/cli/commands/rules-refresh.d.ts.map +1 -1
  21. package/dist/cli/commands/rules-refresh.js +22 -1
  22. package/dist/cli/commands/rules-refresh.js.map +1 -1
  23. package/dist/cli/commands/update.d.ts.map +1 -1
  24. package/dist/cli/commands/update.js +23 -2
  25. package/dist/cli/commands/update.js.map +1 -1
  26. package/dist/cli/env-files-update.d.ts.map +1 -1
  27. package/dist/cli/env-files-update.js +5 -1
  28. package/dist/cli/env-files-update.js.map +1 -1
  29. package/dist/cli/env-files.d.ts +38 -13
  30. package/dist/cli/env-files.d.ts.map +1 -1
  31. package/dist/cli/env-files.js +73 -14
  32. package/dist/cli/env-files.js.map +1 -1
  33. package/dist/cli/index.js +109 -0
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/cli/monitor/digest.d.ts +89 -0
  36. package/dist/cli/monitor/digest.d.ts.map +1 -0
  37. package/dist/cli/monitor/digest.js +232 -0
  38. package/dist/cli/monitor/digest.js.map +1 -0
  39. package/dist/cli/monitor/github-reader.d.ts +38 -0
  40. package/dist/cli/monitor/github-reader.d.ts.map +1 -0
  41. package/dist/cli/monitor/github-reader.js +65 -0
  42. package/dist/cli/monitor/github-reader.js.map +1 -0
  43. package/dist/cli/monitor/reflections.d.ts +18 -0
  44. package/dist/cli/monitor/reflections.d.ts.map +1 -0
  45. package/dist/cli/monitor/reflections.js +72 -0
  46. package/dist/cli/monitor/reflections.js.map +1 -0
  47. package/dist/cli/monitor/run.d.ts +30 -0
  48. package/dist/cli/monitor/run.d.ts.map +1 -0
  49. package/dist/cli/monitor/run.js +67 -0
  50. package/dist/cli/monitor/run.js.map +1 -0
  51. package/dist/cli/project-rules.d.ts +105 -0
  52. package/dist/cli/project-rules.d.ts.map +1 -0
  53. package/dist/cli/project-rules.js +305 -0
  54. package/dist/cli/project-rules.js.map +1 -0
  55. package/dist/cli/propose/candidates.d.ts +95 -0
  56. package/dist/cli/propose/candidates.d.ts.map +1 -0
  57. package/dist/cli/propose/candidates.js +117 -0
  58. package/dist/cli/propose/candidates.js.map +1 -0
  59. package/dist/cli/propose/invariants.d.ts +49 -0
  60. package/dist/cli/propose/invariants.d.ts.map +1 -0
  61. package/dist/cli/propose/invariants.js +154 -0
  62. package/dist/cli/propose/invariants.js.map +1 -0
  63. package/dist/cli/propose/proposal-writer.d.ts +33 -0
  64. package/dist/cli/propose/proposal-writer.d.ts.map +1 -0
  65. package/dist/cli/propose/proposal-writer.js +53 -0
  66. package/dist/cli/propose/proposal-writer.js.map +1 -0
  67. package/dist/cli/propose/report.d.ts +49 -0
  68. package/dist/cli/propose/report.d.ts.map +1 -0
  69. package/dist/cli/propose/report.js +227 -0
  70. package/dist/cli/propose/report.js.map +1 -0
  71. package/dist/cli/propose/run.d.ts +41 -0
  72. package/dist/cli/propose/run.d.ts.map +1 -0
  73. package/dist/cli/propose/run.js +62 -0
  74. package/dist/cli/propose/run.js.map +1 -0
  75. package/dist/cli/settings-writer.d.ts +87 -6
  76. package/dist/cli/settings-writer.d.ts.map +1 -1
  77. package/dist/cli/settings-writer.js +141 -6
  78. package/dist/cli/settings-writer.js.map +1 -1
  79. package/dist/reconciler/parse-delivered.d.ts +32 -0
  80. package/dist/reconciler/parse-delivered.d.ts.map +1 -0
  81. package/dist/reconciler/parse-delivered.js +18 -0
  82. package/dist/reconciler/parse-delivered.js.map +1 -0
  83. package/dist/reconciler/parse-processed.d.ts +57 -0
  84. package/dist/reconciler/parse-processed.d.ts.map +1 -0
  85. package/dist/reconciler/parse-processed.js +41 -0
  86. package/dist/reconciler/parse-processed.js.map +1 -0
  87. package/dist/reconciler/reconcile.d.ts +130 -0
  88. package/dist/reconciler/reconcile.d.ts.map +1 -0
  89. package/dist/reconciler/reconcile.js +119 -0
  90. package/dist/reconciler/reconcile.js.map +1 -0
  91. package/dist/reconciler/run.d.ts +23 -0
  92. package/dist/reconciler/run.d.ts.map +1 -0
  93. package/dist/reconciler/run.js +273 -0
  94. package/dist/reconciler/run.js.map +1 -0
  95. package/package.json +2 -2
  96. package/plugin/rules/coordination.md +22 -13
  97. package/plugin/rules/gh-token-attribution-traps.md +4 -0
  98. package/plugin/rules/mention-routing-hygiene.md +2 -0
  99. package/plugin/rules/observability-wiring.md +3 -3
  100. package/plugin/rules/reflection-staging.md +65 -0
  101. package/plugin/rules/silent-fallback-hazards.md +64 -8
  102. package/scripts/check-auditor-never-acts.sh +167 -0
  103. package/scripts/check-gh-attribution.sh +230 -0
  104. package/scripts/emit-turn-receipt.sh +81 -0
  105. package/scripts/harvest-reflection.sh +125 -0
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Pure formatters for the auditor Plan membrane (groundnuty/macf#503, DR-026 G1).
3
+ *
4
+ * Two outputs, both deterministic (no I/O, no clock):
5
+ * - `buildProposalBody` — the Markdown body of ONE ratifiable proposal issue,
6
+ * assembled from the AGENT-AUTHORED signal content (signal text + rationales)
7
+ * plus the mechanical metadata (tier, route, distinct-agent corroboration,
8
+ * invariant touchpoints, HIGH-RISK flag).
9
+ * - `buildReport` — the dry-run Markdown report printed to stdout/--output: the
10
+ * promoted candidates (each rendered as a proposal preview) PLUS a separate,
11
+ * visible "HELD (N<threshold)" section. The default mode opens NOTHING; this
12
+ * report IS the default-mode artifact.
13
+ *
14
+ * Every proposal makes its non-actuation explicit: the operator ratifies; the
15
+ * auditor never merges/applies (invariants #8 + #9).
16
+ */
17
+ import { PROPOSAL_LABEL } from './proposal-writer.js';
18
+ /** Human-readable route label for the report + body. */
19
+ function routeLabel(route) {
20
+ switch (route) {
21
+ case 'needs-confirmation':
22
+ return 'NEEDS-CONFIRMATION (universal/canonical — never auto-routed)';
23
+ case 'project-draft':
24
+ return 'project-rule draft';
25
+ case 'review':
26
+ return 'operator review (unrecognised tier hint)';
27
+ }
28
+ }
29
+ /** A short, stable proposal title from the candidate. */
30
+ export function proposalTitle(c) {
31
+ const flag = c.highRisk ? '[HIGH-RISK] ' : '';
32
+ const oneLine = c.signal.replace(/\s+/g, ' ').trim();
33
+ const truncated = oneLine.length > 90 ? `${oneLine.slice(0, 87)}…` : oneLine;
34
+ return `auditor-proposal: ${flag}${truncated}`;
35
+ }
36
+ /** Render the invariant-touchpoints block (SURFACED — never a drop). */
37
+ function invariantBlock(c) {
38
+ const lines = [];
39
+ lines.push('## Subordination check (protected invariants)');
40
+ lines.push('');
41
+ if (c.invariantTouches.length === 0) {
42
+ lines.push('_No protected invariant appears to be touched (heuristic match)._');
43
+ }
44
+ else {
45
+ lines.push('This candidate plausibly TOUCHES the following protected invariant(s). ' +
46
+ 'Touched ≠ rejected: `protected-invariants.md` permits the auditor to ' +
47
+ '*propose* an operator-ratified amendment, so this is SURFACED for the ' +
48
+ 'operator to judge weaken-vs-amend — it is never auto-dropped (DR-026 G1).');
49
+ lines.push('');
50
+ for (const t of c.invariantTouches) {
51
+ lines.push(`- **#${t.index} ${t.title}** (matched: ${t.matchedKeywords.join(', ')})`);
52
+ }
53
+ }
54
+ lines.push('');
55
+ if (c.highRisk) {
56
+ lines.push('> **HIGH-RISK — apparent relaxation.** The candidate text reads like it ' +
57
+ 'WEAKENS a touched invariant. An invariant-weakening proposal is wrong by ' +
58
+ 'construction (reject at ratification) UNLESS it is a deliberate ' +
59
+ 'constitutional amendment — route it as one. The operator distinguishes ' +
60
+ '(v1-manual; the automated weaken-vs-amend call is DR-026 G3).');
61
+ lines.push('');
62
+ }
63
+ return lines;
64
+ }
65
+ /**
66
+ * Build the Markdown body for one ratifiable proposal issue. Pure assembly of
67
+ * agent-authored content + mechanical metadata; no LLM judgment is encoded.
68
+ */
69
+ export function buildProposalBody(c) {
70
+ const lines = [];
71
+ lines.push('> **Auditor proposal (DR-026 G1).** Generated by `macf propose` ' +
72
+ 'from corroborated F2 reflection signals. The auditor PROPOSES only — the ' +
73
+ 'operator ratifies. This issue is **never auto-merged or auto-applied** ' +
74
+ '(invariants #8 auditor-never-acts + #9 operator-as-ratifier).');
75
+ lines.push('');
76
+ lines.push('## Proposed rule signal');
77
+ lines.push('');
78
+ lines.push(c.signal.trim());
79
+ lines.push('');
80
+ lines.push('## Tier + routing');
81
+ lines.push('');
82
+ lines.push(`- Proposed tier (agent hint): \`${c.proposedTier}\``);
83
+ lines.push(`- Routing: ${routeLabel(c.route)}`);
84
+ lines.push(`- Dedup handle: \`${c.handle}\`${c.hasKey ? ' (explicit key)' : ' (from signal text)'}`);
85
+ lines.push('');
86
+ lines.push('## Corroboration (GATE 1 — distinct agents)');
87
+ lines.push('');
88
+ lines.push(`- Distinct agents: **${c.distinctAgents}** ` +
89
+ `(${c.corroboratingAgents.join(', ')})`);
90
+ lines.push(`- Raw occurrences: ${c.occurrences}`);
91
+ lines.push('- Promotability is gated on DISTINCT AGENTS, not occurrences: ' +
92
+ 'one agent reflecting N times is N=1 (reflection ≠ verification).');
93
+ lines.push('');
94
+ lines.push('## Rationale (agent-authored)');
95
+ lines.push('');
96
+ if (c.rationales.length === 0) {
97
+ lines.push('_No rationale supplied in the reflection signal(s)._');
98
+ }
99
+ else {
100
+ for (const r of c.rationales) {
101
+ lines.push(`- ${r.trim()}`);
102
+ }
103
+ }
104
+ lines.push('');
105
+ lines.push(...invariantBlock(c));
106
+ lines.push('---');
107
+ lines.push('');
108
+ lines.push('_Ratification is the operator\'s. To accept: distil into the appropriate ' +
109
+ 'rule tier via a PR (universal → upstream; project → local project rule), ' +
110
+ 'review + merge per `pr-discipline`. To reject: close with rationale. ' +
111
+ 'A touched/HIGH-RISK invariant is an operator judgment call, not an ' +
112
+ 'auto-drop (DR-026 G1; weaken-vs-amend automation is G3)._');
113
+ return lines.join('\n') + '\n';
114
+ }
115
+ /** Build the full `ProposalIssueInput` (title + body + labels) for a candidate. */
116
+ export function buildProposalIssueInput(repo, c) {
117
+ const labels = [PROPOSAL_LABEL];
118
+ if (c.route === 'needs-confirmation')
119
+ labels.push('needs-confirmation');
120
+ if (c.highRisk)
121
+ labels.push('high-risk');
122
+ return {
123
+ repo,
124
+ title: proposalTitle(c),
125
+ body: buildProposalBody(c),
126
+ labels,
127
+ };
128
+ }
129
+ /** Render one promoted candidate as a compact preview in the report. */
130
+ function candidatePreview(c) {
131
+ const lines = [];
132
+ const flag = c.highRisk ? ' **[HIGH-RISK]**' : '';
133
+ lines.push(`### ${proposalTitle(c)}${flag}`);
134
+ lines.push('');
135
+ lines.push(`- Tier hint: \`${c.proposedTier}\` → ${routeLabel(c.route)}`);
136
+ lines.push(`- Distinct agents: **${c.distinctAgents}** ` +
137
+ `(${c.corroboratingAgents.join(', ')}) | occurrences: ${c.occurrences}`);
138
+ if (c.invariantTouches.length > 0) {
139
+ const list = c.invariantTouches.map((t) => `#${t.index} ${t.title}`).join('; ');
140
+ lines.push(`- Touches invariant(s): ${list} _(surfaced, not dropped)_`);
141
+ }
142
+ else {
143
+ lines.push('- Touches invariant(s): none detected');
144
+ }
145
+ lines.push('- Signal:');
146
+ lines.push('');
147
+ for (const ln of c.signal.trim().split('\n')) {
148
+ lines.push(` > ${ln}`);
149
+ }
150
+ lines.push('');
151
+ return lines;
152
+ }
153
+ /**
154
+ * Build the dry-run Markdown report. Promoted candidates render as previews; the
155
+ * HELD set renders in its own clearly-labelled section so a sub-threshold
156
+ * candidate is VISIBLE, never silently dropped.
157
+ */
158
+ export function buildReport(input) {
159
+ const { candidates } = input;
160
+ const lines = [];
161
+ lines.push(`# Auditor proposal report — ${input.project}`);
162
+ lines.push('');
163
+ lines.push(`- Repo: \`${input.repo}\``);
164
+ lines.push(`- Min distinct agents (GATE 1 threshold): ${candidates.minAgents}`);
165
+ lines.push(`- Mode: ${input.fileMode ? '**--file (artifacts opened)**' : '**dry-run (default — opens nothing)**'}`);
166
+ if (!input.invariantsLoaded) {
167
+ lines.push('- ⚠ `design/protected-invariants.md` not found — subordination-check ' +
168
+ 'surfaced no invariants (loud-but-proceeds).');
169
+ }
170
+ lines.push(`- Reflection records: ${input.reflectionRecords} across ` +
171
+ `${input.reflectionFiles} ledger file(s) ` +
172
+ `(skipped malformed: ${input.reflectionsSkipped})`);
173
+ lines.push('');
174
+ lines.push('> The auditor PROPOSES only (DR-026 G1). Candidates below are corroborated ' +
175
+ 'across distinct agents; HELD candidates fell below the distinct-agent ' +
176
+ 'threshold. Nothing is auto-applied — the operator ratifies (invariants ' +
177
+ '#8 + #9).');
178
+ lines.push('');
179
+ // --- Promoted candidates ---
180
+ lines.push('## Candidate proposals (promoted)');
181
+ lines.push('');
182
+ if (candidates.promoted.length === 0) {
183
+ lines.push('_No candidate cleared the distinct-agent threshold._');
184
+ lines.push('');
185
+ }
186
+ else {
187
+ for (const c of candidates.promoted) {
188
+ lines.push(...candidatePreview(c));
189
+ }
190
+ }
191
+ // --- HELD section (visible, never silently dropped) ---
192
+ lines.push(`## HELD (N < ${candidates.minAgents} distinct agents)`);
193
+ lines.push('');
194
+ lines.push('_These signals are real but under-corroborated — held, NOT dropped. ' +
195
+ 'Reflection ≠ verification: one agent reflecting repeatedly is still N=1._');
196
+ lines.push('');
197
+ if (candidates.held.length === 0) {
198
+ lines.push('_None._');
199
+ lines.push('');
200
+ }
201
+ else {
202
+ for (const h of candidates.held) {
203
+ const dedup = h.hasKey ? ` [key: \`${h.handle}\`]` : '';
204
+ lines.push(`- (\`${h.proposedTier}\`) ${h.signal.replace(/\s+/g, ' ').trim()}${dedup} ` +
205
+ `— ${h.distinctAgents} distinct agent(s), ${h.occurrences} occurrence(s)`);
206
+ }
207
+ lines.push('');
208
+ }
209
+ // --- Summary ---
210
+ lines.push('## Summary');
211
+ lines.push('');
212
+ lines.push(`- Promoted: ${candidates.promoted.length}`);
213
+ lines.push(`- Held (N<${candidates.minAgents}): ${candidates.held.length}`);
214
+ const highRisk = candidates.promoted.filter((c) => c.highRisk).length;
215
+ const needsConfirm = candidates.promoted.filter((c) => c.route === 'needs-confirmation').length;
216
+ lines.push(`- HIGH-RISK (apparent invariant relaxation): ${highRisk}`);
217
+ lines.push(`- NEEDS-CONFIRMATION (universal/canonical): ${needsConfirm}`);
218
+ lines.push('');
219
+ lines.push(input.fileMode
220
+ ? `> \`--file\` mode: ${candidates.promoted.length} ratifiable ` +
221
+ `\`${PROPOSAL_LABEL}\` issue(s) opened (create-only; never merged/closed/edited). ` +
222
+ 'The operator ratifies.'
223
+ : '> Dry-run: NOTHING was opened. Re-run with `--file` to open one ratifiable ' +
224
+ `\`${PROPOSAL_LABEL}\` issue per promoted candidate (create-only).`);
225
+ return lines.join('\n').replace(/\n{3,}/g, '\n\n') + '\n';
226
+ }
227
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/cli/propose/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAA2B,MAAM,sBAAsB,CAAC;AAG/E,wDAAwD;AACxD,SAAS,UAAU,CAAC,KAAoB;IACtC,QAAQ,KAAK,EAAE,CAAC;QAC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AAC,CAAC;IACvE,KAAK,CAAC,IAAI,CAAC,+CAA+C,YAAY,EAAE,CAAC,CAAC;IAC1E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CACR,KAAK,CAAC,QAAQ;QACZ,CAAC,CAAC,sBAAsB,UAAU,CAAC,QAAQ,CAAC,MAAM,cAAc;YAC9D,KAAK,cAAc,gEAAgE;YACnF,wBAAwB;QAC1B,CAAC,CAAC,6EAA6E;YAC7E,KAAK,cAAc,gDAAgD,CACxE,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ProposalIssueWriter } from './proposal-writer.js';
2
+ export interface RunProposeOptions {
3
+ readonly project: string;
4
+ readonly repo: string;
5
+ /** Directory holding the F2 reflection JSONL ledgers. */
6
+ readonly reflectionsDir: string;
7
+ /**
8
+ * Framework-source repo root where `design/protected-invariants.md` lives.
9
+ * The subordination-check surfaces against this set; absence is loud-but-proceeds.
10
+ */
11
+ readonly repoRoot: string;
12
+ /** Distinct-agent threshold for GATE 1 (default `DEFAULT_MIN_AGENTS`). */
13
+ readonly minAgents?: number;
14
+ /** When true, OPEN ratifiable artifacts via the writer. Default false (dry-run). */
15
+ readonly fileMode: boolean;
16
+ /**
17
+ * Create-only writer seam. REQUIRED when `fileMode` is true; ignored in
18
+ * dry-run (and must never be invoked there — GATE 2).
19
+ */
20
+ readonly writer?: ProposalIssueWriter;
21
+ }
22
+ /** What a single `--file` create produced (or the error that aborted it). */
23
+ export interface CreatedProposal {
24
+ readonly title: string;
25
+ readonly url: string;
26
+ }
27
+ export interface RunProposeResult {
28
+ /** The Markdown report (always produced, in both modes). */
29
+ readonly report: string;
30
+ /** Issues opened in `--file` mode (empty in dry-run). */
31
+ readonly created: readonly CreatedProposal[];
32
+ }
33
+ /**
34
+ * Run the Plan membrane. Returns the report + any created proposals.
35
+ *
36
+ * Read side is pure filesystem; the only write path is the injected writer,
37
+ * gated behind `fileMode` (GATE 2). A writer failure surfaces as a thrown error
38
+ * to the caller (the CLI command), which decides how to report it.
39
+ */
40
+ export declare function runPropose(opts: RunProposeOptions): Promise<RunProposeResult>;
41
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/propose/run.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;CACvC;AAED,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqCnF"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Plan-membrane orchestrator for the auditor (groundnuty/macf#503, DR-026 G1).
3
+ *
4
+ * Reads F2 reflection ledgers (reusing F4's reflections reader), loads the
5
+ * ratified protected-invariant set, runs the deterministic candidate pipeline
6
+ * (distinct-agent GATE 1 + tier-router + invariant subordination-check GATE 3),
7
+ * and then EITHER:
8
+ *
9
+ * - dry-run (DEFAULT): returns a Markdown report (opens NOTHING); or
10
+ * - `--file`: opens one ratifiable proposal issue per promoted candidate via
11
+ * the injectable create-only writer seam, then returns the report.
12
+ *
13
+ * GATE 2 (dry-run-by-default) is enforced here: the writer is invoked ONLY when
14
+ * `fileMode` is true. In the default path the writer is never touched — tests
15
+ * inject a recording writer and assert zero creates by default.
16
+ *
17
+ * The writer is OPTIONAL in the options: dry-run callers pass none. When
18
+ * `fileMode` is true a writer MUST be supplied (the command wires the real one).
19
+ */
20
+ import { readReflections } from '../monitor/reflections.js';
21
+ import { loadInvariants } from './invariants.js';
22
+ import { buildCandidates, DEFAULT_MIN_AGENTS } from './candidates.js';
23
+ import { buildReport, buildProposalIssueInput } from './report.js';
24
+ /**
25
+ * Run the Plan membrane. Returns the report + any created proposals.
26
+ *
27
+ * Read side is pure filesystem; the only write path is the injected writer,
28
+ * gated behind `fileMode` (GATE 2). A writer failure surfaces as a thrown error
29
+ * to the caller (the CLI command), which decides how to report it.
30
+ */
31
+ export async function runPropose(opts) {
32
+ const minAgents = opts.minAgents ?? DEFAULT_MIN_AGENTS;
33
+ const reflections = readReflections(opts.reflectionsDir);
34
+ const invariants = loadInvariants(opts.repoRoot);
35
+ const candidates = buildCandidates(reflections.records, invariants, minAgents);
36
+ const report = buildReport({
37
+ project: opts.project,
38
+ repo: opts.repo,
39
+ candidates,
40
+ fileMode: opts.fileMode,
41
+ invariantsLoaded: invariants.length > 0,
42
+ reflectionRecords: reflections.records.length,
43
+ reflectionsSkipped: reflections.skipped,
44
+ reflectionFiles: reflections.files,
45
+ });
46
+ // GATE 2 — the writer is touched ONLY in --file mode. The default path never
47
+ // opens anything.
48
+ if (!opts.fileMode) {
49
+ return { report, created: [] };
50
+ }
51
+ if (!opts.writer) {
52
+ throw new Error('Internal error: --file mode requires a proposal writer but none was provided.');
53
+ }
54
+ const created = [];
55
+ for (const c of candidates.promoted) {
56
+ const input = buildProposalIssueInput(opts.repo, c);
57
+ const res = await opts.writer.createProposalIssue(input);
58
+ created.push({ title: input.title, url: res.url });
59
+ }
60
+ return { report, created };
61
+ }
62
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/propose/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA0B,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAqCnE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAuB;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,kBAAkB,CAAC;IACvD,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAG,WAAW,CAAC;QACzB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU;QACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,gBAAgB,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC;QACvC,iBAAiB,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM;QAC7C,kBAAkB,EAAE,WAAW,CAAC,OAAO;QACvC,eAAe,EAAE,WAAW,CAAC,KAAK;KACnC,CAAC,CAAC;IAEH,6EAA6E;IAC7E,kBAAkB;IAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,UAAU,CAAC,QAAwC,EAAE,CAAC;QACpE,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
@@ -58,6 +58,69 @@ export declare const MACF_LGTM_HOOK_COMMAND = "$CLAUDE_PROJECT_DIR/.claude/scrip
58
58
  * `Closes #own` passes); override via MACF_SKIP_CLOSE_CHECK=1.
59
59
  */
60
60
  export declare const MACF_CLOSE_HOOK_COMMAND = "$CLAUDE_PROJECT_DIR/.claude/scripts/check-close-keyword.sh";
61
+ /**
62
+ * Auditor-never-acts hook command (groundnuty/macf#499 — DR-026 F1). Blocks
63
+ * state-mutating `gh` ops (`gh pr merge` / `gh issue close` / `gh pr close`)
64
+ * when the active identity is the auditor (`MACF_AGENT_ROLE=auditor`), while
65
+ * leaving the propose verbs (`gh issue/pr create|comment`) untouched. For every
66
+ * NON-auditor identity the hook is inert (`exit 0` before any parsing), so
67
+ * fleet-wide distribution via `macf init` / `macf update` is a no-op everywhere
68
+ * except the auditor.
69
+ *
70
+ * Why structural and not permission-based: a GitHub App's `pull_requests:write`
71
+ * grants merge+close TOGETHER with open-PR — there is no "open-a-PR-but-not-
72
+ * merge" scope to express the auditor's write-proposals-only boundary, so it
73
+ * must be enforced at tool-call time. Sister to the #140 / #244+#272 / #270 /
74
+ * #431 PreToolUse hooks; override via MACF_SKIP_AUDITOR_ACT_CHECK=1.
75
+ */
76
+ export declare const MACF_AUDITOR_HOOK_COMMAND = "$CLAUDE_PROJECT_DIR/.claude/scripts/check-auditor-never-acts.sh";
77
+ /**
78
+ * The UserPromptSubmit turn-ack receipt hook (groundnuty/macf#444 Option D,
79
+ * piece 2). When the router injects a prompt carrying the correlation marker
80
+ * `[macf-route:<run_id>:<agent>]` (macf-actions piece 1), this hook fires on
81
+ * submit and emits a `turn_processed` OTel span — making a routed ping that
82
+ * BECAME A TURN observable, so a dropped one surfaces as a missing span
83
+ * (closes the #437 send≠receipt gap). Unlike the PreToolUse `check-*` hooks
84
+ * this is NOT a blocker (it observes, never `exit 2`s) and is registered
85
+ * `async: true` so it adds no turn latency. No-op on non-routed prompts.
86
+ */
87
+ export declare const MACF_TURN_RECEIPT_HOOK_COMMAND = "$CLAUDE_PROJECT_DIR/.claude/scripts/emit-turn-receipt.sh";
88
+ /**
89
+ * Attribution-result PostToolUse hook command (groundnuty/macf#489). After a
90
+ * `gh`-write Bash op (`gh issue/pr comment`, `gh issue/pr create`,
91
+ * `gh issue/pr close --comment`), this hook reads the just-written resource
92
+ * back from GitHub and warns LOUDLY (PostToolUse `exit 2`) if it was authored
93
+ * by the operator's USER account rather than the bot — the silent-fallback
94
+ * Instance-12 attribution trap. It is the result-invariant backstop to the
95
+ * #140 PreToolUse `check-gh-token.sh`: that one catches the missing-bot-token
96
+ * shape BEFORE the call; this one catches a slipped write AFTER the fact.
97
+ *
98
+ * PostToolUse CANNOT block (the tool already ran), so this is registered on
99
+ * the `PostToolUse` event (matcher `Bash`), NOT `PreToolUse`. Fail-open:
100
+ * every uncertain branch in the script exits 0; only a CONFIRMED
101
+ * user-authored write fires `exit 2`. Override: MACF_SKIP_ATTRIBUTION_CHECK=1.
102
+ */
103
+ export declare const MACF_ATTRIBUTION_HOOK_COMMAND = "$CLAUDE_PROJECT_DIR/.claude/scripts/check-gh-attribution.sh";
104
+ /**
105
+ * Reflection-harvest PreCompact hook command (groundnuty/macf#500 — DR-026 F2).
106
+ * At compaction (auto OR manual `/compact`), this hook harvests the agent's
107
+ * *staged* reflection (`.claude/.macf/reflections/pending.json`, maintained
108
+ * incrementally per `reflection-staging.md`), wraps it in the versioned
109
+ * reflection-schema envelope (`@groundnuty/macf-core` `ReflectionRecordSchema`),
110
+ * appends it as one line to a local per-session JSONL ledger, and clears the
111
+ * stage. F4's Monitor reads the ledger back.
112
+ *
113
+ * It runs on the `PreCompact` event (matcher-less, like SessionStart / Stop /
114
+ * UserPromptSubmit). Per DR-023 §UC-3 it is observational + NON-BLOCKING: the
115
+ * script ALWAYS `exit 0` (even on internal error) so it can never delay/block
116
+ * compaction. Fast + local; no network. Override: MACF_SKIP_REFLECTION_HARVEST=1.
117
+ *
118
+ * Distinct from the plugin's existing PreCompact `checkpoint_to_memory`
119
+ * mcp_tool entry (DR-023 §UC-3 session-checkpoint): that ships via the plugin
120
+ * `hooks.json` mcp_tool path; THIS is a bash command-type hook installed into
121
+ * settings.json — both can coexist on the PreCompact event.
122
+ */
123
+ export declare const MACF_REFLECTION_HOOK_COMMAND = "$CLAUDE_PROJECT_DIR/.claude/scripts/harvest-reflection.sh";
61
124
  /**
62
125
  * Permission patterns pre-approving the `macf-agent` plugin skills.
63
126
  * Without these, every first invocation of a skill (e.g. `/macf-status`
@@ -296,16 +359,34 @@ export declare function installPluginSkillPermissions(workspaceDir: string): voi
296
359
  * - `check-close-keyword.sh` (groundnuty/macf#431 — blocks `gh pr
297
360
  * create`/`edit` that would auto-close another agent's issue via a
298
361
  * close-keyword adjacent to its ref)
362
+ * - `check-auditor-never-acts.sh` (groundnuty/macf#499 — DR-026 F1; when
363
+ * `MACF_AGENT_ROLE=auditor`, blocks state-mutating `gh pr merge` /
364
+ * `gh issue close` / `gh pr close`; inert for every non-auditor identity)
365
+ *
366
+ * Plus, on the PostToolUse event:
367
+ * - `check-gh-attribution.sh` (groundnuty/macf#489 — after a `gh`-write
368
+ * op, reads the resource back from GitHub and warns (`exit 2`) if it
369
+ * was authored by the operator's user account instead of the bot;
370
+ * the result-invariant backstop to the #140 PreToolUse token check)
371
+ *
372
+ * And, on the UserPromptSubmit event:
373
+ * - `emit-turn-receipt.sh` (groundnuty/macf#444 — async turn-ack span)
374
+ *
375
+ * And, on the PreCompact event:
376
+ * - `harvest-reflection.sh` (groundnuty/macf#500 — DR-026 F2; at compaction,
377
+ * harvests the agent's staged reflection into a local JSONL ledger. Matcher-
378
+ * less + NON-BLOCKING; operator-authored PreCompact hooks are preserved)
299
379
  *
300
380
  * Creates the `.claude/` directory and the file if either is missing.
301
381
  * Idempotent: repeated calls don't duplicate entries.
302
382
  *
303
- * All hooks share `matcher: "Bash"` because Claude Code's matcher field
304
- * gates which tool fires the hook; the wrapped-command detection (gh vs
305
- * git-push for token, gh issue/pr comment for routing, gh pr merge for
306
- * LGTM) happens INSIDE each script. Distinct entries per script keep
307
- * them independently upgradeable + diagnosable in `gh issue list` style
308
- * settings audits.
383
+ * The PreToolUse + PostToolUse hooks share `matcher: "Bash"` because Claude
384
+ * Code's matcher field gates which tool fires the hook; the wrapped-command
385
+ * detection (gh vs git-push for token, gh issue/pr comment for routing,
386
+ * gh pr merge for LGTM, close-keyword for auto-close, the auditor-role
387
+ * acting-verb gate, gh-write for attribution) happens INSIDE each script.
388
+ * Distinct entries per script keep them independently upgradeable +
389
+ * diagnosable in `gh issue list` style settings audits.
309
390
  */
310
391
  export declare function installGhTokenHook(workspaceDir: string): void;
311
392
  //# sourceMappingURL=settings-writer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings-writer.d.ts","sourceRoot":"","sources":["../../src/cli/settings-writer.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,0DAA0D,CAAC;AAEzF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,iEAAiE,CAAC;AAExG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,2DAA2D,CAAC;AAE/F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,+DAA+D,CAAC;AA+DpG;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAMrD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAGxD,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAS3E;AAmBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAM3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAM1E;AAaD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CA+CpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EA0CtD,CAAC;AAWF;;;;;;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