@cleocode/cleo 2026.4.132 → 2026.4.133

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/cli/index.js CHANGED
@@ -29626,8 +29626,31 @@ var init_sentient = __esm({
29626
29626
  }
29627
29627
  /**
29628
29628
  * Enable or disable Tier-2 proposal generation.
29629
+ *
29630
+ * When `enabled=true`, enforces the M7 gate (T-COUNCIL-RECONCILIATION-2026-04-24):
29631
+ * `cleo memory doctor --assert-clean` must pass before Tier-2 is activated.
29632
+ * Returns `E_M7_GATE_FAILED` if the brain corpus is not clean.
29633
+ *
29634
+ * @task T1148 W8-7
29629
29635
  */
29630
29636
  async setTier2Enabled(projectRoot, enabled) {
29637
+ if (enabled) {
29638
+ try {
29639
+ const { scanBrainNoise } = await import("@cleocode/core/memory/brain-doctor.js");
29640
+ const doctorResult = await scanBrainNoise(projectRoot);
29641
+ if (!doctorResult.isClean) {
29642
+ return {
29643
+ success: false,
29644
+ error: {
29645
+ code: "E_M7_GATE_FAILED",
29646
+ message: `M7 gate blocked: brain corpus has ${doctorResult.findings.length} noise pattern(s) across ${doctorResult.totalScanned} entries. Run \`cleo memory doctor\` for details, then \`cleo memory sweep --approve\` to clean before enabling Sentient v1.`,
29647
+ details: { findings: doctorResult.findings, totalScanned: doctorResult.totalScanned }
29648
+ }
29649
+ };
29650
+ }
29651
+ } catch {
29652
+ }
29653
+ }
29631
29654
  const { patchSentientState: patchSentientState2 } = await import("@cleocode/core/sentient/state.js");
29632
29655
  const { SENTIENT_STATE_FILE: SENTIENT_STATE_FILE2 } = await import("@cleocode/core/sentient/daemon.js");
29633
29656
  const statePath = join6(projectRoot, SENTIENT_STATE_FILE2);
@@ -47332,6 +47355,51 @@ var tierCommand = defineCommand({
47332
47355
  demote: tierDemoteCommand
47333
47356
  }
47334
47357
  });
47358
+ var sweepCommand = defineCommand({
47359
+ meta: {
47360
+ name: "sweep",
47361
+ description: "T1147 W7 BRAIN noise sweep. --dry-run: detect noise candidates. --approve <runId>: apply to live tables. --status: list runs. --rollback <runId>: discard staged run."
47362
+ },
47363
+ args: {
47364
+ "dry-run": {
47365
+ type: "boolean",
47366
+ description: "Detect noise candidates without staging DB writes."
47367
+ },
47368
+ approve: {
47369
+ type: "string",
47370
+ description: "Run ID to approve and apply to live tables."
47371
+ },
47372
+ status: {
47373
+ type: "boolean",
47374
+ description: "List recent noise-sweep-2440 runs."
47375
+ },
47376
+ rollback: {
47377
+ type: "string",
47378
+ description: "Run ID to roll back without applying changes."
47379
+ },
47380
+ json: {
47381
+ type: "boolean",
47382
+ description: "Output as JSON"
47383
+ }
47384
+ },
47385
+ async run({
47386
+ args
47387
+ }) {
47388
+ const gateway = args.approve || args.rollback ? "mutate" : "query";
47389
+ await dispatchFromCli(
47390
+ gateway,
47391
+ "memory",
47392
+ "sweep",
47393
+ {
47394
+ "dry-run": args["dry-run"],
47395
+ approve: args.approve,
47396
+ status: args.status,
47397
+ rollback: args.rollback
47398
+ },
47399
+ { command: "memory-sweep", operation: "memory.sweep" }
47400
+ );
47401
+ }
47402
+ });
47335
47403
  var memoryCommand = defineCommand({
47336
47404
  meta: { name: "memory", description: "BRAIN memory operations (patterns, learnings)" },
47337
47405
  subCommands: {
@@ -47375,7 +47443,9 @@ var memoryCommand = defineCommand({
47375
47443
  digest: digestCommand,
47376
47444
  recent: recentCommand,
47377
47445
  diary: diaryCommand,
47378
- watch: watchCommand2
47446
+ watch: watchCommand2,
47447
+ // T1147 W7 — BRAIN noise sweep
47448
+ sweep: sweepCommand
47379
47449
  },
47380
47450
  async run({ cmd, rawArgs }) {
47381
47451
  const firstArg = rawArgs?.find((a) => !a.startsWith("-"));