@cleocode/cleo 2026.4.133 → 2026.4.139

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
@@ -587,7 +587,7 @@ function createSuccessResult() {
587
587
  function isErrorResult(result) {
588
588
  return !result.success;
589
589
  }
590
- var ThinAgentViolationError, LifecycleScopeDeniedError;
590
+ var ThinAgentViolationError, LifecycleScopeDeniedError, ClassifierUnregisteredAgentError;
591
591
  var init_errors = __esm({
592
592
  "packages/contracts/src/errors.ts"() {
593
593
  "use strict";
@@ -635,6 +635,26 @@ var init_errors = __esm({
635
635
  /** Numeric exit code aligned with {@link ExitCode.TASK_NOT_IN_SCOPE} (34). */
636
636
  exitCode = 34 /* TASK_NOT_IN_SCOPE */;
637
637
  };
638
+ ClassifierUnregisteredAgentError = class extends Error {
639
+ /**
640
+ * @param emittedAgentId - The agent ID the classifier tried to emit.
641
+ * @param registeredIds - The set of valid, registry-backed agent IDs.
642
+ */
643
+ constructor(emittedAgentId, registeredIds) {
644
+ super(
645
+ `E_CLASSIFIER_UNREGISTERED_AGENT: classifier emitted '${emittedAgentId}' which is not in the registered agent vocabulary. Valid agent IDs: [${registeredIds.join(", ")}]. Add this agent to the registry or remove it from the classifier rules.`
646
+ );
647
+ this.emittedAgentId = emittedAgentId;
648
+ this.registeredIds = registeredIds;
649
+ this.name = "ClassifierUnregisteredAgentError";
650
+ }
651
+ emittedAgentId;
652
+ registeredIds;
653
+ /** Stable LAFS error code string for envelope emission. */
654
+ code = "E_CLASSIFIER_UNREGISTERED_AGENT";
655
+ /** Numeric exit code aligned with {@link ExitCode.SPAWN_VALIDATION_FAILED} (63). */
656
+ exitCode = 63 /* SPAWN_VALIDATION_FAILED */;
657
+ };
638
658
  }
639
659
  });
640
660
 
@@ -1263,6 +1283,7 @@ __export(src_exports, {
1263
1283
  AGENT_TYPES: () => AGENT_TYPES,
1264
1284
  BRAIN_OBSERVATION_TYPES: () => BRAIN_OBSERVATION_TYPES,
1265
1285
  BRANCH_LOCK_ERROR_CODES: () => BRANCH_LOCK_ERROR_CODES,
1286
+ ClassifierUnregisteredAgentError: () => ClassifierUnregisteredAgentError,
1266
1287
  ExitCode: () => ExitCode,
1267
1288
  GATE_STATUSES: () => GATE_STATUSES,
1268
1289
  LIFECYCLE_PIPELINE_STATUSES: () => LIFECYCLE_PIPELINE_STATUSES,
@@ -7414,6 +7435,40 @@ var init_registry = __esm({
7414
7435
  ]
7415
7436
  },
7416
7437
  // ---------------------------------------------------------------------------
7438
+ // T1386 — nexus.sigil — peer-card identity (PSYCHE Wave 8 follow-up)
7439
+ // ---------------------------------------------------------------------------
7440
+ // Query: list every sigil currently stored in nexus.db
7441
+ {
7442
+ gateway: "query",
7443
+ domain: "nexus",
7444
+ operation: "sigil.list",
7445
+ description: "nexus.sigil.list (query) \u2014 list every sigil currently stored in nexus.db, optionally filtered by role",
7446
+ tier: 1,
7447
+ idempotent: true,
7448
+ sessionRequired: false,
7449
+ requiredParams: [],
7450
+ params: [
7451
+ {
7452
+ name: "role",
7453
+ type: "string",
7454
+ required: false,
7455
+ description: 'Filter by role (e.g. "orchestrator", "lead", "worker", "specialist", "subagent")'
7456
+ }
7457
+ ]
7458
+ },
7459
+ // Mutate: populate sigils from canonical CANT agents
7460
+ {
7461
+ gateway: "mutate",
7462
+ domain: "nexus",
7463
+ operation: "sigil.sync",
7464
+ description: "nexus.sigil.sync (mutate) \u2014 populate the sigils table with one row per canonical CANT agent (cleo-subagent + 5 seed roles + 2 meta agents). Idempotent.",
7465
+ tier: 1,
7466
+ idempotent: true,
7467
+ sessionRequired: false,
7468
+ requiredParams: [],
7469
+ params: []
7470
+ },
7471
+ // ---------------------------------------------------------------------------
7417
7472
  // sticky — Ephemeral notes for quick capture (T5282)
7418
7473
  // ---------------------------------------------------------------------------
7419
7474
  // Query operations
@@ -9257,6 +9312,38 @@ var init_memory_engine = __esm({
9257
9312
  });
9258
9313
 
9259
9314
  // packages/cleo/src/dispatch/engines/session-engine.ts
9315
+ var session_engine_exports = {};
9316
+ __export(session_engine_exports, {
9317
+ sessionArchive: () => sessionArchive,
9318
+ sessionBriefing: () => sessionBriefing,
9319
+ sessionChainShow: () => sessionChainShow,
9320
+ sessionCleanup: () => sessionCleanup,
9321
+ sessionComputeDebrief: () => sessionComputeDebrief,
9322
+ sessionComputeHandoff: () => sessionComputeHandoff,
9323
+ sessionContextDrift: () => sessionContextDrift,
9324
+ sessionContextInject: () => sessionContextInject,
9325
+ sessionDebriefShow: () => sessionDebriefShow,
9326
+ sessionDecisionLog: () => sessionDecisionLog,
9327
+ sessionEnd: () => sessionEnd,
9328
+ sessionFind: () => sessionFind,
9329
+ sessionGc: () => sessionGc,
9330
+ sessionHandoff: () => sessionHandoff,
9331
+ sessionHistory: () => sessionHistory,
9332
+ sessionList: () => sessionList,
9333
+ sessionRecordAssumption: () => sessionRecordAssumption,
9334
+ sessionRecordDecision: () => sessionRecordDecision,
9335
+ sessionResume: () => sessionResume,
9336
+ sessionShow: () => sessionShow,
9337
+ sessionStart: () => sessionStart,
9338
+ sessionStats: () => sessionStats,
9339
+ sessionStatus: () => sessionStatus,
9340
+ sessionSuspend: () => sessionSuspend,
9341
+ sessionSwitch: () => sessionSwitch,
9342
+ taskCurrentGet: () => taskCurrentGet,
9343
+ taskStart: () => taskStart,
9344
+ taskStop: () => taskStop,
9345
+ taskWorkHistory: () => taskWorkHistory
9346
+ });
9260
9347
  import {
9261
9348
  archiveSessions,
9262
9349
  cleanupSessions,
@@ -10972,6 +11059,13 @@ async function orchestratePlan(input) {
10972
11059
  if (resolved) {
10973
11060
  persona = resolved.agentId;
10974
11061
  orchLevel = resolved.orchLevel;
11062
+ if (resolved.resolverWarning) {
11063
+ warnings.push({
11064
+ taskId: task.id,
11065
+ code: "agent_fallback_universal_base",
11066
+ message: resolved.resolverWarning
11067
+ });
11068
+ }
10975
11069
  } else {
10976
11070
  persona = "cleo-subagent";
10977
11071
  const fallback = resolveAgentGraceful(db, "cleo-subagent", preferTier);
@@ -13515,6 +13609,16 @@ async function taskComplete(projectRoot, taskId, notes) {
13515
13609
  try {
13516
13610
  const accessor = await getAccessor6(projectRoot);
13517
13611
  const result = await coreCompleteTask({ taskId, notes }, projectRoot, accessor);
13612
+ try {
13613
+ const agentId = process.env["CLEO_AGENT_ID"] ?? "cleo";
13614
+ let sessionId = typeof process.env["CLEO_SESSION_ID"] === "string" && process.env["CLEO_SESSION_ID"].length > 0 ? process.env["CLEO_SESSION_ID"] : null;
13615
+ const activeSession = await getActiveSession2(projectRoot);
13616
+ if (activeSession?.id) {
13617
+ sessionId = activeSession.id;
13618
+ }
13619
+ await accessor.updateTaskFields(taskId, { modifiedBy: agentId, sessionId });
13620
+ } catch {
13621
+ }
13518
13622
  return {
13519
13623
  success: true,
13520
13624
  data: {
@@ -13644,6 +13748,20 @@ async function taskCompleteStrict(projectRoot, taskId, notes) {
13644
13748
  }
13645
13749
  }
13646
13750
  }
13751
+ if (lifecycleMode === "strict") {
13752
+ const accessor = await getAccessor6(projectRoot);
13753
+ const task = await accessor.loadSingleTask(taskId);
13754
+ if (task && task.type !== "epic" && !task.verification) {
13755
+ return engineError(
13756
+ "E_EVIDENCE_MISSING",
13757
+ `Task ${taskId} has no verification record (verification_json IS NULL). Run 'cleo verify' with programmatic evidence before completing. See ADR-051.`,
13758
+ {
13759
+ details: { taskId, verificationStatus: "null" },
13760
+ fix: `Initialize and populate verification gates: 'cleo verify ${taskId} --gate implemented --evidence "commit:<sha>;files:<list>"' and other required gates, then retry 'cleo complete ${taskId}'.`
13761
+ }
13762
+ );
13763
+ }
13764
+ }
13647
13765
  return taskComplete(projectRoot, taskId, notes);
13648
13766
  } catch (err) {
13649
13767
  return cleoErrorToEngineError(err, "E_INTERNAL", "Failed to complete task (strict mode)");
@@ -19058,12 +19176,12 @@ var init_memory2 = __esm({
19058
19176
  const { getBrainNativeDb: _getDoctorNativeDb } = await import("@cleocode/core/store/memory-sqlite.js");
19059
19177
  const doctorNativeDb = _getDoctorNativeDb();
19060
19178
  if (doctorNativeDb) {
19061
- const tableExists = doctorNativeDb.prepare(
19062
- `SELECT name FROM sqlite_master WHERE type='table' AND name='brain_v2_candidate'`
19179
+ const stagingTableRow = doctorNativeDb.prepare(
19180
+ `SELECT name FROM sqlite_master WHERE type='table' AND name IN ('brain_observations_staging', 'brain_v2_candidate') ORDER BY CASE name WHEN 'brain_observations_staging' THEN 0 ELSE 1 END LIMIT 1`
19063
19181
  ).get();
19064
- if (tableExists) {
19182
+ if (stagingTableRow?.name) {
19065
19183
  const countRow = doctorNativeDb.prepare(
19066
- `SELECT COUNT(*) AS cnt FROM brain_v2_candidate WHERE validation_status = 'pending'`
19184
+ `SELECT COUNT(*) AS cnt FROM ${stagingTableRow.name} WHERE validation_status = 'pending'`
19067
19185
  ).get();
19068
19186
  pendingCandidates = countRow?.cnt ?? 0;
19069
19187
  }
@@ -19086,7 +19204,7 @@ var init_memory2 = __esm({
19086
19204
  "memory",
19087
19205
  operation,
19088
19206
  "E_SWEEP_PENDING",
19089
- `Staged sweep has ${pendingCandidates} pending brain_v2_candidate rows. Run \`cleo memory sweep --status\` to review, then \`cleo memory sweep --approve <runId>\` to apply.`,
19207
+ `Staged sweep has ${pendingCandidates} pending brain_observations_staging rows. Run \`cleo memory sweep --status\` to review, then \`cleo memory sweep --approve <runId>\` to apply.`,
19090
19208
  startTime
19091
19209
  );
19092
19210
  }
@@ -20357,6 +20475,7 @@ import {
20357
20475
  getUserProfileTrait,
20358
20476
  importSnapshot as importSnapshot2,
20359
20477
  importUserProfile,
20478
+ listSigils,
20360
20479
  listUserProfile,
20361
20480
  nexusDeps,
20362
20481
  nexusGetProject,
@@ -20377,6 +20496,7 @@ import {
20377
20496
  searchAcrossProjects,
20378
20497
  setPermission,
20379
20498
  supersedeTrait,
20499
+ syncCanonicalSigils,
20380
20500
  upsertUserProfileTrait,
20381
20501
  validateSyntax,
20382
20502
  writeSnapshot as writeSnapshot2
@@ -20895,6 +21015,23 @@ async function nexusProfileSupersede(oldKey, newKey) {
20895
21015
  return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
20896
21016
  }
20897
21017
  }
21018
+ async function nexusSigilList(role) {
21019
+ try {
21020
+ const nexusDb = await getNexusDb();
21021
+ const sigils = await listSigils(nexusDb, role ? { role } : void 0);
21022
+ return engineSuccess({ sigils, count: sigils.length });
21023
+ } catch (error) {
21024
+ return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
21025
+ }
21026
+ }
21027
+ async function nexusSigilSync() {
21028
+ try {
21029
+ const result = await syncCanonicalSigils();
21030
+ return engineSuccess(result);
21031
+ } catch (error) {
21032
+ return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
21033
+ }
21034
+ }
20898
21035
  var init_nexus_engine = __esm({
20899
21036
  "packages/cleo/src/dispatch/engines/nexus-engine.ts"() {
20900
21037
  "use strict";
@@ -21645,6 +21782,11 @@ var init_nexus2 = __esm({
21645
21782
  const result = await nexusProfileGet(traitKey);
21646
21783
  return wrapResult(result, "query", "nexus", operation, startTime);
21647
21784
  }
21785
+ case "sigil.list": {
21786
+ const role = params?.role;
21787
+ const result = await nexusSigilList(role);
21788
+ return wrapResult(result, "query", "nexus", operation, startTime);
21789
+ }
21648
21790
  default:
21649
21791
  return unsupportedOp("query", "nexus", operation, startTime);
21650
21792
  }
@@ -21867,6 +22009,10 @@ var init_nexus2 = __esm({
21867
22009
  const result = await nexusProfileSupersede(oldKey, newKey);
21868
22010
  return wrapResult(result, "mutate", "nexus", operation, startTime);
21869
22011
  }
22012
+ case "sigil.sync": {
22013
+ const result = await nexusSigilSync();
22014
+ return wrapResult(result, "mutate", "nexus", operation, startTime);
22015
+ }
21870
22016
  default:
21871
22017
  return unsupportedOp("mutate", "nexus", operation, startTime);
21872
22018
  }
@@ -21919,7 +22065,9 @@ var init_nexus2 = __esm({
21919
22065
  "task-symbols",
21920
22066
  // T1080 — user-profile query verbs
21921
22067
  "profile.view",
21922
- "profile.get"
22068
+ "profile.get",
22069
+ // T1386 — sigil list (peer-card identity)
22070
+ "sigil.list"
21923
22071
  ],
21924
22072
  mutate: [
21925
22073
  "share.snapshot.export",
@@ -21940,7 +22088,9 @@ var init_nexus2 = __esm({
21940
22088
  "profile.export",
21941
22089
  "profile.reinforce",
21942
22090
  "profile.upsert",
21943
- "profile.supersede"
22091
+ "profile.supersede",
22092
+ // T1386 — sigil sync (canonical CANT agent peer cards)
22093
+ "sigil.sync"
21944
22094
  ]
21945
22095
  };
21946
22096
  }
@@ -26745,8 +26895,8 @@ async function acquireDb() {
26745
26895
  async function buildDefaultDispatcher() {
26746
26896
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
26747
26897
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
26748
- const { getProjectRoot: getProjectRoot29 } = await import("@cleocode/core/internal");
26749
- const projectRoot = getProjectRoot29();
26898
+ const { getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
26899
+ const projectRoot = getProjectRoot31();
26750
26900
  return {
26751
26901
  async dispatch(input) {
26752
26902
  try {
@@ -27099,14 +27249,14 @@ var init_playbook = __esm({
27099
27249
  const dispatcher = await buildDefaultDispatcher();
27100
27250
  let result;
27101
27251
  try {
27102
- const { getProjectRoot: getProjectRoot29 } = await import("@cleocode/core/internal");
27252
+ const { getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
27103
27253
  const opts = {
27104
27254
  db,
27105
27255
  playbook: parsed.definition,
27106
27256
  playbookHash: parsed.sourceHash,
27107
27257
  initialContext,
27108
27258
  dispatcher,
27109
- projectRoot: getProjectRoot29()
27259
+ projectRoot: getProjectRoot31()
27110
27260
  };
27111
27261
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
27112
27262
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -32628,11 +32778,11 @@ var init_security = __esm({
32628
32778
  });
32629
32779
 
32630
32780
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
32631
- function createSanitizer(getProjectRoot29) {
32781
+ function createSanitizer(getProjectRoot31) {
32632
32782
  return async (req, next) => {
32633
32783
  if (req.params) {
32634
32784
  try {
32635
- const root = getProjectRoot29 ? getProjectRoot29() : void 0;
32785
+ const root = getProjectRoot31 ? getProjectRoot31() : void 0;
32636
32786
  req.params = sanitizeParams(req.params, root, {
32637
32787
  domain: req.domain,
32638
32788
  operation: req.operation
@@ -33004,7 +33154,7 @@ import {
33004
33154
  ensureGlobalSignaldockDb as ensureGlobalSignaldockDb2,
33005
33155
  getGlobalSalt,
33006
33156
  getLogger as getLogger18,
33007
- getProjectRoot as getProjectRoot28,
33157
+ getProjectRoot as getProjectRoot30,
33008
33158
  migrateSignaldockToConduit,
33009
33159
  needsSignaldockToConduitMigration,
33010
33160
  validateGlobalSalt
@@ -33607,6 +33757,42 @@ function createCustomShowUsage(version, subCommands2, aliasMap2) {
33607
33757
  };
33608
33758
  }
33609
33759
 
33760
+ // packages/cleo/src/cli/lib/did-you-mean.ts
33761
+ function levenshteinDistance(input, candidate) {
33762
+ const inputLen = input.length;
33763
+ const candidateLen = candidate.length;
33764
+ const matrix = Array.from({ length: inputLen + 1 }, (_, i) => [i]);
33765
+ for (let j = 1; j <= candidateLen; j++) {
33766
+ matrix[0][j] = j;
33767
+ }
33768
+ for (let i = 1; i <= inputLen; i++) {
33769
+ for (let j = 1; j <= candidateLen; j++) {
33770
+ const cost = input[i - 1] === candidate[j - 1] ? 0 : 1;
33771
+ matrix[i][j] = Math.min(
33772
+ matrix[i - 1][j] + 1,
33773
+ // deletion
33774
+ matrix[i][j - 1] + 1,
33775
+ // insertion
33776
+ matrix[i - 1][j - 1] + cost
33777
+ // substitution
33778
+ );
33779
+ }
33780
+ }
33781
+ return matrix[inputLen][candidateLen];
33782
+ }
33783
+ function didYouMean(input, candidates, maxDistance = 2) {
33784
+ const suggestions = candidates.map((candidate) => ({
33785
+ command: candidate,
33786
+ distance: levenshteinDistance(input, candidate)
33787
+ })).filter((item) => item.distance <= maxDistance).sort((a, b) => {
33788
+ if (a.distance !== b.distance) {
33789
+ return a.distance - b.distance;
33790
+ }
33791
+ return a.command.localeCompare(b.command);
33792
+ }).map((item) => item.command);
33793
+ return suggestions;
33794
+ }
33795
+
33610
33796
  // packages/cleo/src/cli/middleware/output-format.ts
33611
33797
  import { resolveOutputFormat } from "@cleocode/lafs";
33612
33798
  function resolveFormat(opts, defaults) {
@@ -33757,7 +33943,49 @@ var adapterCommand = defineCommand({
33757
33943
  });
33758
33944
 
33759
33945
  // packages/cleo/src/cli/commands/add.ts
33946
+ import { getProjectRoot as getProjectRoot18 } from "@cleocode/core";
33760
33947
  init_cli();
33948
+
33949
+ // packages/cleo/src/cli/infer-files-via-gitnexus.ts
33950
+ import { execFileSync as execFileSync3 } from "node:child_process";
33951
+ function inferFilesViaGitNexus(title, description) {
33952
+ const queryText = description ? `${title} ${description}` : title;
33953
+ try {
33954
+ const output = execFileSync3("gitnexus", ["query", "--json", "--limit", "5", queryText], {
33955
+ encoding: "utf-8",
33956
+ stdio: ["pipe", "pipe", "pipe"]
33957
+ // suppress stderr
33958
+ });
33959
+ const result = JSON.parse(output);
33960
+ const files = /* @__PURE__ */ new Set();
33961
+ if (Array.isArray(result)) {
33962
+ for (const process2 of result) {
33963
+ if (Array.isArray(process2.symbols)) {
33964
+ for (const symbol of process2.symbols) {
33965
+ if (symbol.location && typeof symbol.location === "string") {
33966
+ const match = symbol.location.match(/^([^:]+):/);
33967
+ if (match?.[1]) {
33968
+ files.add(match[1]);
33969
+ }
33970
+ }
33971
+ }
33972
+ }
33973
+ if (Array.isArray(process2.files)) {
33974
+ for (const file of process2.files) {
33975
+ if (typeof file === "string") {
33976
+ files.add(file);
33977
+ }
33978
+ }
33979
+ }
33980
+ }
33981
+ }
33982
+ return Array.from(files);
33983
+ } catch {
33984
+ return [];
33985
+ }
33986
+ }
33987
+
33988
+ // packages/cleo/src/cli/commands/add.ts
33761
33989
  init_renderers();
33762
33990
  var addCommand = defineCommand({
33763
33991
  meta: {
@@ -33816,6 +34044,10 @@ var addCommand = defineCommand({
33816
34044
  type: "string",
33817
34045
  description: "Comma-separated file paths"
33818
34046
  },
34047
+ "files-infer": {
34048
+ type: "boolean",
34049
+ description: "Infer touched files from task title and description using GitNexus"
34050
+ },
33819
34051
  acceptance: {
33820
34052
  type: "string",
33821
34053
  description: 'Pipe-separated acceptance criteria (e.g. "AC1|AC2|AC3")'
@@ -33900,7 +34132,18 @@ var addCommand = defineCommand({
33900
34132
  params["description"] = args.desc;
33901
34133
  }
33902
34134
  if (args.labels) params["labels"] = args.labels.split(",").map((s) => s.trim());
33903
- if (args.files) params["files"] = args.files.split(",").map((s) => s.trim());
34135
+ if (args["files-infer"] && !args.files) {
34136
+ const inferredFiles = inferFilesViaGitNexus(args.title, args.description ?? args.desc);
34137
+ if (inferredFiles.length > 0) {
34138
+ params["files"] = inferredFiles;
34139
+ } else {
34140
+ process.stderr.write(
34141
+ "\u26A0 No files inferred by GitNexus. Use --files to specify files explicitly, or leave empty for atomicity check at spawn time.\n"
34142
+ );
34143
+ }
34144
+ } else if (args.files) {
34145
+ params["files"] = args.files.split(",").map((s) => s.trim());
34146
+ }
33904
34147
  if (args.acceptance) {
33905
34148
  const raw = args.acceptance;
33906
34149
  if (raw.trimStart().startsWith("[")) {
@@ -33924,6 +34167,21 @@ var addCommand = defineCommand({
33924
34167
  if (args.kind !== void 0) params["kind"] = args.kind;
33925
34168
  if (args.scope !== void 0) params["scope"] = args.scope;
33926
34169
  if (args.severity !== void 0) params["severity"] = args.severity;
34170
+ if (!params["parent"] && params["type"] !== "epic") {
34171
+ try {
34172
+ const projectRoot = getProjectRoot18();
34173
+ const { taskCurrentGet: taskCurrentGet2 } = await Promise.resolve().then(() => (init_session_engine(), session_engine_exports));
34174
+ const currentResult = await taskCurrentGet2(projectRoot);
34175
+ if (currentResult.success && currentResult.data?.currentTask) {
34176
+ params["parent"] = currentResult.data.currentTask;
34177
+ process.stderr.write(
34178
+ `[cleo add] inferred --parent from current task: ${currentResult.data.currentTask}
34179
+ `
34180
+ );
34181
+ }
34182
+ } catch {
34183
+ }
34184
+ }
33927
34185
  const response = await dispatchRaw("mutate", "tasks", "add", params);
33928
34186
  if (!response.success) {
33929
34187
  handleRawError(response, { command: "add", operation: "tasks.add" });
@@ -36248,11 +36506,11 @@ var installCommand = defineCommand({
36248
36506
  if (stat2.isFile() && ext === ".cant") {
36249
36507
  cantPath = resolvedPath;
36250
36508
  } else if (stat2.isFile() && ext === ".cantz") {
36251
- const { execFileSync: execFileSync6 } = await import("node:child_process");
36509
+ const { execFileSync: execFileSync7 } = await import("node:child_process");
36252
36510
  tempDir = join23(tmpdir(), `cleo-agent-install-${Date.now()}`);
36253
36511
  mkdirSync5(tempDir, { recursive: true });
36254
36512
  try {
36255
- execFileSync6("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
36513
+ execFileSync7("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
36256
36514
  encoding: "utf-8",
36257
36515
  timeout: 3e4
36258
36516
  });
@@ -36453,7 +36711,7 @@ var packCommand = defineCommand({
36453
36711
  try {
36454
36712
  const { existsSync: existsSync12, statSync } = await import("node:fs");
36455
36713
  const { resolve: resolve5, basename: basename2, dirname: dirname11 } = await import("node:path");
36456
- const { execFileSync: execFileSync6 } = await import("node:child_process");
36714
+ const { execFileSync: execFileSync7 } = await import("node:child_process");
36457
36715
  const resolvedDir = resolve5(args.dir);
36458
36716
  if (!existsSync12(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
36459
36717
  cliOutput(
@@ -36490,7 +36748,7 @@ var packCommand = defineCommand({
36490
36748
  const archivePath = resolve5(archiveName);
36491
36749
  const parentDir = dirname11(resolvedDir);
36492
36750
  try {
36493
- execFileSync6("zip", ["-r", archivePath, agentName], {
36751
+ execFileSync7("zip", ["-r", archivePath, agentName], {
36494
36752
  cwd: parentDir,
36495
36753
  encoding: "utf-8",
36496
36754
  timeout: 3e4
@@ -37493,8 +37751,113 @@ var archiveStatsCommand = defineCommand({
37493
37751
  }
37494
37752
  });
37495
37753
 
37754
+ // packages/cleo/src/cli/commands/audit.ts
37755
+ import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
37756
+ var reconstructCommand = defineCommand({
37757
+ meta: {
37758
+ name: "reconstruct",
37759
+ description: "Reconstruct git-backed lineage (commits + release tags) for a task"
37760
+ },
37761
+ args: {
37762
+ taskId: {
37763
+ type: "positional",
37764
+ description: "Task ID to reconstruct (e.g. T991)",
37765
+ required: true
37766
+ },
37767
+ json: {
37768
+ type: "boolean",
37769
+ description: "Emit raw JSON output instead of formatted summary",
37770
+ default: false
37771
+ },
37772
+ "repo-root": {
37773
+ type: "string",
37774
+ description: "Path to the git repository root (defaults to current project root)"
37775
+ }
37776
+ },
37777
+ async run({ args }) {
37778
+ const taskId = args["taskId"];
37779
+ if (!taskId || !/^T\d+$/i.test(taskId)) {
37780
+ process.stderr.write(
37781
+ `Error: taskId must match /^T\\d+$/ (e.g. T991). Got: ${JSON.stringify(taskId)}
37782
+ `
37783
+ );
37784
+ process.exit(1);
37785
+ }
37786
+ let repoRoot;
37787
+ if (args["repo-root"]) {
37788
+ repoRoot = args["repo-root"];
37789
+ } else {
37790
+ try {
37791
+ repoRoot = getProjectRoot19(process.cwd()) ?? process.cwd();
37792
+ } catch {
37793
+ repoRoot = process.cwd();
37794
+ }
37795
+ }
37796
+ const result = await reconstructLineage(taskId, repoRoot);
37797
+ if (args["json"]) {
37798
+ process.stdout.write(`${JSON.stringify(result, null, 2)}
37799
+ `);
37800
+ return;
37801
+ }
37802
+ const lines = [
37803
+ `Lineage for ${result.taskId}`,
37804
+ `${"=".repeat(40)}`,
37805
+ "",
37806
+ `Direct commits: ${result.directCommits.length}`
37807
+ ];
37808
+ for (const c of result.directCommits) {
37809
+ lines.push(` ${c.sha.slice(0, 10)} ${c.subject}`);
37810
+ }
37811
+ lines.push("");
37812
+ if (result.childIdRange) {
37813
+ lines.push(
37814
+ `Inferred children: ${result.inferredChildren.join(", ")} (${result.childIdRange.min} \u2192 ${result.childIdRange.max})`
37815
+ );
37816
+ } else {
37817
+ lines.push("Inferred children: none");
37818
+ }
37819
+ const childEntries = Object.entries(result.childCommits);
37820
+ if (childEntries.length > 0) {
37821
+ lines.push("");
37822
+ lines.push("Child commits:");
37823
+ for (const [childId, commits] of childEntries) {
37824
+ lines.push(` ${childId}: ${commits.length} commit(s)`);
37825
+ for (const c of commits) {
37826
+ lines.push(` ${c.sha.slice(0, 10)} ${c.subject}`);
37827
+ }
37828
+ }
37829
+ }
37830
+ lines.push("");
37831
+ if (result.releaseTags.length > 0) {
37832
+ lines.push(`Release tags (${result.releaseTags.length}):`);
37833
+ for (const t of result.releaseTags) {
37834
+ lines.push(` ${t.tag} ${t.commitSha.slice(0, 10)} ${t.subject}`);
37835
+ }
37836
+ } else {
37837
+ lines.push("Release tags: none found");
37838
+ }
37839
+ lines.push("");
37840
+ lines.push(`First seen: ${result.firstSeenAt ?? "n/a"}`);
37841
+ lines.push(`Last seen: ${result.lastSeenAt ?? "n/a"}`);
37842
+ process.stdout.write(`${lines.join("\n")}
37843
+ `);
37844
+ }
37845
+ });
37846
+ var auditCommand = defineCommand({
37847
+ meta: {
37848
+ name: "audit",
37849
+ description: "Git-backed audit tooling (lineage reconstruction, integrity checks)"
37850
+ },
37851
+ subCommands: {
37852
+ reconstruct: reconstructCommand
37853
+ },
37854
+ async run({ args: _args }) {
37855
+ await showUsage(auditCommand);
37856
+ }
37857
+ });
37858
+
37496
37859
  // packages/cleo/src/cli/commands/backfill.ts
37497
- import { backfillTasks, getProjectRoot as getProjectRoot18, populateEmbeddings } from "@cleocode/core/internal";
37860
+ import { backfillTasks, getProjectRoot as getProjectRoot20, populateEmbeddings } from "@cleocode/core/internal";
37498
37861
  init_renderers();
37499
37862
  var backfillCommand = defineCommand({
37500
37863
  meta: {
@@ -37523,7 +37886,7 @@ var backfillCommand = defineCommand({
37523
37886
  }
37524
37887
  },
37525
37888
  async run({ args }) {
37526
- const root = getProjectRoot18();
37889
+ const root = getProjectRoot20();
37527
37890
  if (args.embeddings) {
37528
37891
  try {
37529
37892
  let lastLine = "";
@@ -38012,9 +38375,9 @@ var exportCommand = defineCommand({
38012
38375
  },
38013
38376
  async run({ args }) {
38014
38377
  const scope = args.scope;
38015
- const { packBundle, getProjectRoot: getProjectRoot29 } = await import("@cleocode/core/internal");
38378
+ const { packBundle, getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
38016
38379
  const includesProject = scope === "project" || scope === "all";
38017
- const projectRoot = includesProject ? getProjectRoot29() : void 0;
38380
+ const projectRoot = includesProject ? getProjectRoot31() : void 0;
38018
38381
  let passphrase;
38019
38382
  if (args.encrypt === true) {
38020
38383
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -38342,7 +38705,7 @@ import {
38342
38705
  exportBrainAsJson,
38343
38706
  getMemoryQualityReport,
38344
38707
  getPlasticityStats,
38345
- getProjectRoot as getProjectRoot19,
38708
+ getProjectRoot as getProjectRoot21,
38346
38709
  purgeBrainNoise,
38347
38710
  runBrainMaintenance
38348
38711
  } from "@cleocode/core/internal";
@@ -38375,7 +38738,7 @@ var maintenanceCommand = defineCommand({
38375
38738
  json: { type: "boolean", description: "Output results as JSON" }
38376
38739
  },
38377
38740
  async run({ args }) {
38378
- const root = getProjectRoot19();
38741
+ const root = getProjectRoot21();
38379
38742
  const isJson = !!args.json;
38380
38743
  if (!isJson) {
38381
38744
  console.log("Running brain maintenance...");
@@ -38455,7 +38818,7 @@ var backfillCommand2 = defineCommand({
38455
38818
  json: { type: "boolean", description: "Output results as JSON" }
38456
38819
  },
38457
38820
  async run({ args }) {
38458
- const root = getProjectRoot19();
38821
+ const root = getProjectRoot21();
38459
38822
  const isJson = !!args.json;
38460
38823
  if (!isJson) {
38461
38824
  console.log("Running brain graph back-fill...");
@@ -38510,7 +38873,7 @@ var purgeCommand = defineCommand({
38510
38873
  json: { type: "boolean", description: "Output results as JSON" }
38511
38874
  },
38512
38875
  async run({ args }) {
38513
- const root = getProjectRoot19();
38876
+ const root = getProjectRoot21();
38514
38877
  const isJson = !!args.json;
38515
38878
  if (!isJson) {
38516
38879
  console.log("Running brain noise purge...");
@@ -38568,7 +38931,7 @@ var plasticityStatsCommand = defineCommand({
38568
38931
  json: { type: "boolean", description: "Output results as JSON" }
38569
38932
  },
38570
38933
  async run({ args }) {
38571
- const root = getProjectRoot19();
38934
+ const root = getProjectRoot21();
38572
38935
  const isJson = !!args.json;
38573
38936
  const limit = Number.parseInt(args.limit, 10) || 20;
38574
38937
  try {
@@ -38641,7 +39004,7 @@ var qualityCommand = defineCommand({
38641
39004
  json: { type: "boolean", description: "Output results as JSON" }
38642
39005
  },
38643
39006
  async run({ args }) {
38644
- const root = getProjectRoot19();
39007
+ const root = getProjectRoot21();
38645
39008
  const isJson = !!args.json;
38646
39009
  try {
38647
39010
  const report = await getMemoryQualityReport(root);
@@ -38718,7 +39081,7 @@ var exportCommand2 = defineCommand({
38718
39081
  }
38719
39082
  },
38720
39083
  async run({ args }) {
38721
- const root = getProjectRoot19();
39084
+ const root = getProjectRoot21();
38722
39085
  const format = args.format ?? "gexf";
38723
39086
  if (format !== "gexf" && format !== "json") {
38724
39087
  console.error(`Invalid format: ${format}. Use 'gexf' or 'json'.`);
@@ -40026,7 +40389,7 @@ var trendCommand = defineCommand({
40026
40389
  );
40027
40390
  }
40028
40391
  });
40029
- var auditCommand = defineCommand({
40392
+ var auditCommand2 = defineCommand({
40030
40393
  meta: {
40031
40394
  name: "audit",
40032
40395
  description: "Check compliance for a specific task and its subtasks"
@@ -40178,7 +40541,7 @@ var complianceCommand = defineCommand({
40178
40541
  summary: summaryCommand,
40179
40542
  violations: violationsCommand,
40180
40543
  trend: trendCommand,
40181
- audit: auditCommand,
40544
+ audit: auditCommand2,
40182
40545
  sync: syncCommand2,
40183
40546
  skills: skillsCommand,
40184
40547
  value: valueCommand,
@@ -41911,7 +42274,7 @@ import {
41911
42274
  exportDocument,
41912
42275
  formatError as formatError5,
41913
42276
  getAgentOutputsAbsolute,
41914
- getProjectRoot as getProjectRoot20,
42277
+ getProjectRoot as getProjectRoot22,
41915
42278
  listDocVersions,
41916
42279
  mergeDocs,
41917
42280
  publishDocs,
@@ -42200,7 +42563,7 @@ var exportCommand4 = defineCommand({
42200
42563
  const taskId = String(args.task);
42201
42564
  const includeAttachments = args["include-attachments"] !== false;
42202
42565
  const includeMemoryRefs = args["include-memory-refs"] === true;
42203
- const projectRoot = getProjectRoot20();
42566
+ const projectRoot = getProjectRoot22();
42204
42567
  try {
42205
42568
  const result = await exportDocument({
42206
42569
  taskId,
@@ -42264,7 +42627,7 @@ var searchCommand = defineCommand({
42264
42627
  }
42265
42628
  },
42266
42629
  async run({ args }) {
42267
- const projectRoot = getProjectRoot20();
42630
+ const projectRoot = getProjectRoot22();
42268
42631
  try {
42269
42632
  const result = await searchDocs(String(args.query), {
42270
42633
  ownerId: args.owner ?? void 0,
@@ -42316,7 +42679,7 @@ var mergeCommand = defineCommand({
42316
42679
  }
42317
42680
  },
42318
42681
  async run({ args }) {
42319
- const projectRoot = getProjectRoot20();
42682
+ const projectRoot = getProjectRoot22();
42320
42683
  const rawStrategy = args.strategy ?? "three-way";
42321
42684
  const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
42322
42685
  try {
@@ -42367,7 +42730,7 @@ var graphCommand = defineCommand({
42367
42730
  }
42368
42731
  },
42369
42732
  async run({ args }) {
42370
- const projectRoot = getProjectRoot20();
42733
+ const projectRoot = getProjectRoot22();
42371
42734
  const fmt = args.format ?? "mermaid";
42372
42735
  try {
42373
42736
  const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
@@ -42438,7 +42801,7 @@ var rankCommand = defineCommand({
42438
42801
  }
42439
42802
  },
42440
42803
  async run({ args }) {
42441
- const projectRoot = getProjectRoot20();
42804
+ const projectRoot = getProjectRoot22();
42442
42805
  try {
42443
42806
  const result = await rankDocs({
42444
42807
  ownerId: String(args.for),
@@ -42477,7 +42840,7 @@ var versionsCommand = defineCommand({
42477
42840
  }
42478
42841
  },
42479
42842
  async run({ args }) {
42480
- const projectRoot = getProjectRoot20();
42843
+ const projectRoot = getProjectRoot22();
42481
42844
  try {
42482
42845
  const result = await listDocVersions({
42483
42846
  ownerId: String(args.for),
@@ -42521,7 +42884,7 @@ var publishCommand2 = defineCommand({
42521
42884
  }
42522
42885
  },
42523
42886
  async run({ args }) {
42524
- const projectRoot = getProjectRoot20();
42887
+ const projectRoot = getProjectRoot22();
42525
42888
  try {
42526
42889
  const result = await publishDocs({
42527
42890
  ownerId: String(args.for),
@@ -43468,10 +43831,10 @@ var gcCommand = defineCommand({
43468
43831
 
43469
43832
  // packages/cleo/src/cli/commands/generate-changelog.ts
43470
43833
  init_src();
43471
- import { execFileSync as execFileSync3 } from "node:child_process";
43834
+ import { execFileSync as execFileSync4 } from "node:child_process";
43472
43835
  import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync3 } from "node:fs";
43473
43836
  import { dirname as dirname9, join as join16 } from "node:path";
43474
- import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as getProjectRoot21 } from "@cleocode/core";
43837
+ import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as getProjectRoot23 } from "@cleocode/core";
43475
43838
  init_renderers();
43476
43839
  function getChangelogSource(cwd) {
43477
43840
  const configPath = getConfigPath2(cwd);
@@ -43503,9 +43866,9 @@ function getDefaultOutputPath(platform) {
43503
43866
  }
43504
43867
  }
43505
43868
  function getGitHubRepoSlug(cwd) {
43506
- const projectRoot = getProjectRoot21(cwd);
43869
+ const projectRoot = getProjectRoot23(cwd);
43507
43870
  try {
43508
- const remoteUrl = execFileSync3("git", ["remote", "get-url", "origin"], {
43871
+ const remoteUrl = execFileSync4("git", ["remote", "get-url", "origin"], {
43509
43872
  cwd: projectRoot,
43510
43873
  encoding: "utf-8",
43511
43874
  stdio: ["pipe", "pipe", "pipe"]
@@ -43629,7 +43992,7 @@ var generateChangelogCommand = defineCommand({
43629
43992
  const targetPlatform = args.platform;
43630
43993
  const dryRun = args["dry-run"] === true;
43631
43994
  const sourceFile = getChangelogSource();
43632
- const sourcePath = join16(getProjectRoot21(), sourceFile);
43995
+ const sourcePath = join16(getProjectRoot23(), sourceFile);
43633
43996
  if (!existsSync10(sourcePath)) {
43634
43997
  throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
43635
43998
  }
@@ -43642,7 +44005,7 @@ var generateChangelogCommand = defineCommand({
43642
44005
  const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
43643
44006
  const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
43644
44007
  if (!dryRun) {
43645
- const fullPath = join16(getProjectRoot21(), outputPath);
44008
+ const fullPath = join16(getProjectRoot23(), outputPath);
43646
44009
  mkdirSync3(dirname9(fullPath), { recursive: true });
43647
44010
  writeFileSync3(fullPath, content, "utf-8");
43648
44011
  }
@@ -43663,7 +44026,7 @@ var generateChangelogCommand = defineCommand({
43663
44026
  limit
43664
44027
  );
43665
44028
  if (!dryRun) {
43666
- const fullPath = join16(getProjectRoot21(), platformConfig.path);
44029
+ const fullPath = join16(getProjectRoot23(), platformConfig.path);
43667
44030
  mkdirSync3(dirname9(fullPath), { recursive: true });
43668
44031
  writeFileSync3(fullPath, content, "utf-8");
43669
44032
  }
@@ -44253,7 +44616,7 @@ var intelligenceCommand = defineCommand({
44253
44616
  });
44254
44617
 
44255
44618
  // packages/cleo/src/cli/commands/issue.ts
44256
- import { execFileSync as execFileSync4 } from "node:child_process";
44619
+ import { execFileSync as execFileSync5 } from "node:child_process";
44257
44620
  import { addIssue, BUILD_CONFIG } from "@cleocode/core/internal";
44258
44621
  init_cli();
44259
44622
  init_renderers();
@@ -44277,7 +44640,7 @@ async function handleIssueType(issueType, opts) {
44277
44640
  if (opts["open"] && typeof result.url === "string" && result.url.startsWith("https://")) {
44278
44641
  const issueNumber = result.url.match(/(\d+)$/)?.[1] ?? "unknown";
44279
44642
  try {
44280
- execFileSync4("gh", ["issue", "view", issueNumber, "--repo", CLEO_REPO, "--web"], {
44643
+ execFileSync5("gh", ["issue", "view", issueNumber, "--repo", CLEO_REPO, "--web"], {
44281
44644
  stdio: ["pipe", "pipe", "pipe"]
44282
44645
  });
44283
44646
  } catch {
@@ -45079,7 +45442,7 @@ import { join as join17 } from "node:path";
45079
45442
  import {
45080
45443
  getBrainDb as getBrainDb2,
45081
45444
  getBrainNativeDb as getBrainNativeDb3,
45082
- getProjectRoot as getProjectRoot22,
45445
+ getProjectRoot as getProjectRoot24,
45083
45446
  runConsolidation,
45084
45447
  triggerManualDream
45085
45448
  } from "@cleocode/core/internal";
@@ -45988,7 +46351,7 @@ var consolidateCommand = defineCommand({
45988
46351
  }
45989
46352
  },
45990
46353
  async run({ args }) {
45991
- const root = getProjectRoot22();
46354
+ const root = getProjectRoot24();
45992
46355
  const isJson = !!args.json;
45993
46356
  if (!isJson) {
45994
46357
  console.log("Running memory consolidation (including tier promotion)...");
@@ -46053,7 +46416,7 @@ var dreamCommand = defineCommand({
46053
46416
  }
46054
46417
  },
46055
46418
  async run({ args }) {
46056
- const root = getProjectRoot22();
46419
+ const root = getProjectRoot24();
46057
46420
  const isJson = !!args.json;
46058
46421
  if (!isJson) {
46059
46422
  console.log("Triggering dream cycle (full consolidation including STDP plasticity)...");
@@ -46131,7 +46494,7 @@ var reflectCommand = defineCommand({
46131
46494
  }
46132
46495
  },
46133
46496
  async run({ args }) {
46134
- const root = getProjectRoot22();
46497
+ const root = getProjectRoot24();
46135
46498
  const isJson = !!args.json;
46136
46499
  if (!isJson) {
46137
46500
  console.log("Running Observer + Reflector pipeline...");
@@ -46216,7 +46579,7 @@ var dedupScanCommand = defineCommand({
46216
46579
  }
46217
46580
  },
46218
46581
  async run({ args }) {
46219
- const root = getProjectRoot22();
46582
+ const root = getProjectRoot24();
46220
46583
  const isJson = !!args.json;
46221
46584
  if (!isJson) {
46222
46585
  console.log("Scanning brain.db for duplicate entries...");
@@ -46376,7 +46739,7 @@ var importCommand3 = defineCommand({
46376
46739
  const sourceDir = args.from ?? join17(homedir4(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
46377
46740
  const isDryRun = !!args["dry-run"];
46378
46741
  const isJson = !!args.json;
46379
- const projectRoot = getProjectRoot22();
46742
+ const projectRoot = getProjectRoot24();
46380
46743
  const stateFile = join17(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
46381
46744
  if (!existsSync11(sourceDir)) {
46382
46745
  const msg = `Source directory not found: ${sourceDir}`;
@@ -46629,7 +46992,7 @@ var tierStatsCommand = defineCommand({
46629
46992
  }
46630
46993
  },
46631
46994
  async run({ args }) {
46632
- const root = getProjectRoot22();
46995
+ const root = getProjectRoot24();
46633
46996
  const isJson = !!args.json;
46634
46997
  try {
46635
46998
  await getBrainDb2(root);
@@ -46773,7 +47136,7 @@ var tierPromoteCommand = defineCommand({
46773
47136
  }
46774
47137
  },
46775
47138
  async run({ args }) {
46776
- const root = getProjectRoot22();
47139
+ const root = getProjectRoot24();
46777
47140
  const isJson = !!args.json;
46778
47141
  const targetTier = args.to;
46779
47142
  const reason = args.reason;
@@ -46919,7 +47282,7 @@ var tierDemoteCommand = defineCommand({
46919
47282
  }
46920
47283
  },
46921
47284
  async run({ args }) {
46922
- const root = getProjectRoot22();
47285
+ const root = getProjectRoot24();
46923
47286
  const isJson = !!args.json;
46924
47287
  const targetTier = args.to;
46925
47288
  const reason = args.reason;
@@ -47455,7 +47818,7 @@ var memoryCommand = defineCommand({
47455
47818
  });
47456
47819
 
47457
47820
  // packages/cleo/src/cli/commands/migrate-claude-mem.ts
47458
- import { getProjectRoot as getProjectRoot23, migrateClaudeMem } from "@cleocode/core/internal";
47821
+ import { getProjectRoot as getProjectRoot25, migrateClaudeMem } from "@cleocode/core/internal";
47459
47822
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
47460
47823
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
47461
47824
  init_cli();
@@ -47512,7 +47875,7 @@ var claudeMemCommand = defineCommand({
47512
47875
  }
47513
47876
  },
47514
47877
  async run({ args }) {
47515
- const root = getProjectRoot23();
47878
+ const root = getProjectRoot25();
47516
47879
  try {
47517
47880
  const result = await migrateClaudeMem(root, {
47518
47881
  sourcePath: args.source,
@@ -47561,7 +47924,7 @@ var manifestIngestCommand = defineCommand({
47561
47924
  }
47562
47925
  },
47563
47926
  async run({ args }) {
47564
- const projectRoot = getProjectRoot23();
47927
+ const projectRoot = getProjectRoot25();
47565
47928
  try {
47566
47929
  const db = await getDb2(projectRoot);
47567
47930
  const rcasdFlag = Boolean(args.rcasd);
@@ -49295,7 +49658,7 @@ var analyzeCommand3 = defineCommand({
49295
49658
  );
49296
49659
  }
49297
49660
  try {
49298
- const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot29 }, { eq: eq2 }] = await Promise.all([
49661
+ const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot31 }, { eq: eq2 }] = await Promise.all([
49299
49662
  import("@cleocode/core/store/nexus-sqlite"),
49300
49663
  import("@cleocode/nexus/pipeline"),
49301
49664
  import("@cleocode/core/internal"),
@@ -49401,7 +49764,7 @@ var analyzeCommand3 = defineCommand({
49401
49764
  `
49402
49765
  );
49403
49766
  }
49404
- void getProjectRoot29;
49767
+ void getProjectRoot31;
49405
49768
  } catch (err) {
49406
49769
  const msg = err instanceof Error ? err.message : String(err);
49407
49770
  if (jsonOutput) {
@@ -52171,6 +52534,52 @@ ${result.count} cold symbol(s) found (threshold: ${thresholdDays} days).
52171
52534
  }
52172
52535
  }
52173
52536
  });
52537
+ var sigilSyncCommand = defineCommand({
52538
+ meta: {
52539
+ name: "sync",
52540
+ description: "Populate the nexus.db sigils table with one row per canonical CANT agent (cleo-subagent + 5 seed roles + 2 meta agents). Idempotent."
52541
+ },
52542
+ args: {
52543
+ json: {
52544
+ type: "boolean",
52545
+ description: "Output as JSON (LAFS envelope format)"
52546
+ }
52547
+ },
52548
+ async run() {
52549
+ await dispatchFromCli("mutate", "nexus", "sigil.sync", {}, { command: "nexus" });
52550
+ }
52551
+ });
52552
+ var sigilListCommand = defineCommand({
52553
+ meta: {
52554
+ name: "list",
52555
+ description: "List every sigil currently stored in nexus.db, optionally filtered by role."
52556
+ },
52557
+ args: {
52558
+ role: {
52559
+ type: "string",
52560
+ description: 'Filter by role (e.g. "orchestrator", "lead", "worker", "specialist", "subagent")'
52561
+ }
52562
+ },
52563
+ async run({ args }) {
52564
+ await dispatchFromCli(
52565
+ "query",
52566
+ "nexus",
52567
+ "sigil.list",
52568
+ { role: args.role },
52569
+ { command: "nexus" }
52570
+ );
52571
+ }
52572
+ });
52573
+ var sigilCommand = defineCommand({
52574
+ meta: {
52575
+ name: "sigil",
52576
+ description: "Sigil (peer-card) operations \u2014 sync from canonical CANT agents, list current rows"
52577
+ },
52578
+ subCommands: {
52579
+ sync: sigilSyncCommand,
52580
+ list: sigilListCommand
52581
+ }
52582
+ });
52174
52583
  var topEntriesCommand = defineCommand({
52175
52584
  meta: {
52176
52585
  name: "top-entries",
@@ -52264,7 +52673,9 @@ var nexusCommand = defineCommand({
52264
52673
  "hot-nodes": hotNodesCommand,
52265
52674
  "cold-symbols": coldSymbolsCommand,
52266
52675
  // T1013 / T1006 — top-weighted symbols by nexus_relations.weight
52267
- "top-entries": topEntriesCommand
52676
+ "top-entries": topEntriesCommand,
52677
+ // T1386 — sigil sync + list (canonical CANT agent peer cards)
52678
+ sigil: sigilCommand
52268
52679
  },
52269
52680
  async run({ cmd, rawArgs }) {
52270
52681
  const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
@@ -53906,14 +54317,14 @@ var reasonCommand = defineCommand({
53906
54317
  });
53907
54318
 
53908
54319
  // packages/cleo/src/cli/commands/refresh-memory.ts
53909
- import { getProjectRoot as getProjectRoot24 } from "@cleocode/core";
54320
+ import { getProjectRoot as getProjectRoot26 } from "@cleocode/core";
53910
54321
  var refreshMemoryCommand = defineCommand({
53911
54322
  meta: {
53912
54323
  name: "refresh-memory",
53913
54324
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
53914
54325
  },
53915
54326
  async run() {
53916
- const projectDir = getProjectRoot24();
54327
+ const projectDir = getProjectRoot26();
53917
54328
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
53918
54329
  const result = await writeMemoryBridge(projectDir);
53919
54330
  if (result.written) {
@@ -55018,7 +55429,7 @@ init_src();
55018
55429
  import fs3 from "node:fs";
55019
55430
  import path4 from "node:path";
55020
55431
  import { CleoError as CleoError8, formatError as formatError10, getAccessor as getAccessor9 } from "@cleocode/core";
55021
- import { getProjectRoot as getProjectRoot25 } from "@cleocode/core/internal";
55432
+ import { getProjectRoot as getProjectRoot27 } from "@cleocode/core/internal";
55022
55433
  init_cli();
55023
55434
  init_paths();
55024
55435
  init_renderers();
@@ -55132,7 +55543,7 @@ var finalizeCommand = defineCommand({
55132
55543
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
55133
55544
  },
55134
55545
  async run() {
55135
- const projectRoot = getProjectRoot25();
55546
+ const projectRoot = getProjectRoot27();
55136
55547
  const reportPath = path4.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
55137
55548
  if (!fs3.existsSync(reportPath)) {
55138
55549
  console.log("No pending restore conflicts. Nothing to finalize.");
@@ -56843,7 +57254,7 @@ var sentientCommand = defineCommand({
56843
57254
  });
56844
57255
 
56845
57256
  // packages/cleo/src/cli/commands/sequence.ts
56846
- import { getProjectRoot as getProjectRoot26 } from "@cleocode/core/internal";
57257
+ import { getProjectRoot as getProjectRoot28 } from "@cleocode/core/internal";
56847
57258
  init_cli();
56848
57259
  init_renderers();
56849
57260
  var showCommand12 = defineCommand({
@@ -56874,7 +57285,7 @@ var repairCommand = defineCommand({
56874
57285
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
56875
57286
  async run() {
56876
57287
  const { systemSequenceRepair: systemSequenceRepair2 } = await Promise.resolve().then(() => (init_system_engine(), system_engine_exports));
56877
- const projectRoot = getProjectRoot26();
57288
+ const projectRoot = getProjectRoot28();
56878
57289
  const result = await systemSequenceRepair2(projectRoot);
56879
57290
  cliOutput(result, { command: "sequence", operation: "admin.sequence.repair" });
56880
57291
  }
@@ -58701,7 +59112,7 @@ var tokenCommand = defineCommand({
58701
59112
  // packages/cleo/src/cli/commands/transcript.ts
58702
59113
  import { homedir as homedir5 } from "node:os";
58703
59114
  import { join as join20 } from "node:path";
58704
- import { getProjectRoot as getProjectRoot27 } from "@cleocode/core";
59115
+ import { getProjectRoot as getProjectRoot29 } from "@cleocode/core";
58705
59116
  import {
58706
59117
  parseDurationMs,
58707
59118
  pruneTranscripts,
@@ -58729,7 +59140,7 @@ var scanCommand = defineCommand({
58729
59140
  async run({ args }) {
58730
59141
  if (args.pending) {
58731
59142
  try {
58732
- const projectRoot = getProjectRoot27();
59143
+ const projectRoot = getProjectRoot29();
58733
59144
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
58734
59145
  const pending = await scanPendingTranscripts(projectRoot);
58735
59146
  const envelope = { success: true, data: { count: pending.length, pending } };
@@ -58862,7 +59273,7 @@ var extractCommand = defineCommand({
58862
59273
  async run({ args }) {
58863
59274
  const tier = args.tier ?? "warm";
58864
59275
  const dryRun = args["dry-run"] ?? false;
58865
- const projectRoot = getProjectRoot27();
59276
+ const projectRoot = getProjectRoot29();
58866
59277
  try {
58867
59278
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
58868
59279
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -58993,7 +59404,7 @@ var migrateCommand2 = defineCommand({
58993
59404
  const dryRun = args["dry-run"] ?? false;
58994
59405
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
58995
59406
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
58996
- const projectRoot = getProjectRoot27();
59407
+ const projectRoot = getProjectRoot29();
58997
59408
  try {
58998
59409
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
58999
59410
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -59567,7 +59978,7 @@ var verifyCommand2 = defineCommand({
59567
59978
 
59568
59979
  // packages/cleo/src/cli/commands/web.ts
59569
59980
  init_src();
59570
- import { execFileSync as execFileSync5, spawn } from "node:child_process";
59981
+ import { execFileSync as execFileSync6, spawn } from "node:child_process";
59571
59982
  import { mkdir as mkdir4, open, readFile as readFile5, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
59572
59983
  import { join as join21 } from "node:path";
59573
59984
  import { CleoError as CleoError12, formatError as formatError14, getCleoHome as getCleoHome3 } from "@cleocode/core";
@@ -59634,7 +60045,7 @@ async function startWebServer(port, host) {
59634
60045
  await stat(webIndexPath);
59635
60046
  } catch {
59636
60047
  try {
59637
- execFileSync5("pnpm", ["--filter", "@cleocode/studio", "run", "build"], {
60048
+ execFileSync6("pnpm", ["--filter", "@cleocode/studio", "run", "build"], {
59638
60049
  cwd: projectRoot,
59639
60050
  stdio: "ignore"
59640
60051
  });
@@ -59928,6 +60339,7 @@ subCommands["admin"] = adminCommand;
59928
60339
  subCommands["adr"] = adrCommand;
59929
60340
  subCommands["agent"] = agentCommand;
59930
60341
  subCommands["analyze"] = analyzeCommand;
60342
+ subCommands["audit"] = auditCommand;
59931
60343
  subCommands["archive"] = archiveCommand;
59932
60344
  subCommands["archive-stats"] = archiveStatsCommand;
59933
60345
  subCommands["backfill"] = backfillCommand;
@@ -60061,12 +60473,12 @@ subCommands["pipeline"] = phaseCommand;
60061
60473
  } catch {
60062
60474
  }
60063
60475
  try {
60064
- detectAndRemoveStrayProjectNexus(getProjectRoot28());
60476
+ detectAndRemoveStrayProjectNexus(getProjectRoot30());
60065
60477
  } catch {
60066
60478
  }
60067
60479
  const _startupLog = getLogger18("cli-startup");
60068
60480
  try {
60069
- const _projectRootForMigration = getProjectRoot28();
60481
+ const _projectRootForMigration = getProjectRoot30();
60070
60482
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
60071
60483
  const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
60072
60484
  if (migrationResult.status === "failed") {
@@ -60086,7 +60498,7 @@ subCommands["pipeline"] = phaseCommand;
60086
60498
  }
60087
60499
  }
60088
60500
  try {
60089
- ensureConduitDb(getProjectRoot28());
60501
+ ensureConduitDb(getProjectRoot30());
60090
60502
  } catch {
60091
60503
  }
60092
60504
  try {
@@ -60124,6 +60536,26 @@ var main = defineCommand({
60124
60536
  });
60125
60537
  var aliasMap = buildAliasMap(subCommands);
60126
60538
  var customShowUsage = createCustomShowUsage(CLI_VERSION, subCommands, aliasMap);
60539
+ {
60540
+ const rawArgs = process.argv.slice(2);
60541
+ const firstArg = rawArgs[0];
60542
+ if (firstArg && !firstArg.startsWith("-") && firstArg !== "--help" && firstArg !== "-h" && firstArg !== "--version" && firstArg !== "-V") {
60543
+ const availableCommands = Object.keys(subCommands);
60544
+ if (!availableCommands.includes(firstArg)) {
60545
+ const suggestions = didYouMean(firstArg, availableCommands, 3);
60546
+ process.stderr.write(`Unknown command ${firstArg}
60547
+ `);
60548
+ if (suggestions.length > 0) {
60549
+ process.stderr.write("\nDid you mean one of:\n");
60550
+ for (const suggestion of suggestions) {
60551
+ process.stderr.write(` cleo ${suggestion}
60552
+ `);
60553
+ }
60554
+ }
60555
+ process.exit(127);
60556
+ }
60557
+ }
60558
+ }
60127
60559
  runMain(main, { showUsage: customShowUsage });
60128
60560
  /*! Bundled license information:
60129
60561