@cleocode/cleo 2026.5.132 → 2026.5.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
@@ -27495,6 +27495,70 @@ function iterationCapFor(node, runtimeDefault) {
27495
27495
  if (typeof cap === "number" && Number.isFinite(cap) && cap >= 0) return cap;
27496
27496
  return runtimeDefault;
27497
27497
  }
27498
+ function validateDecompositionTaskTree(nodeId, taskTree2) {
27499
+ if (!Array.isArray(taskTree2)) {
27500
+ return `ensures.schema[task_tree] on ${nodeId}: task_tree must be a non-empty array, got ${typeof taskTree2}`;
27501
+ }
27502
+ if (taskTree2.length === 0) {
27503
+ return `ensures.schema[task_tree] on ${nodeId}: task_tree is an empty array \u2014 decomposition produced no tasks`;
27504
+ }
27505
+ const knownIds = /* @__PURE__ */ new Set();
27506
+ for (const entry of taskTree2) {
27507
+ if (typeof entry.id === "string") {
27508
+ knownIds.add(entry.id);
27509
+ }
27510
+ }
27511
+ for (let i = 0; i < taskTree2.length; i++) {
27512
+ const entry = taskTree2[i];
27513
+ if (typeof entry !== "object" || entry === null) {
27514
+ return `ensures.schema[task_tree] on ${nodeId}: entry[${i}] must be an object, got ${entry === null ? "null" : typeof entry}`;
27515
+ }
27516
+ if (typeof entry.title !== "string" || entry.title.trim().length === 0) {
27517
+ return `ensures.schema[task_tree] on ${nodeId}: entry[${i}].title must be a non-empty string`;
27518
+ }
27519
+ if (!Array.isArray(entry.acceptance) || entry.acceptance.length === 0) {
27520
+ return `ensures.schema[task_tree] on ${nodeId}: entry[${i}] ("${entry.title}") must have a non-empty acceptance array`;
27521
+ }
27522
+ const hasValidAc = entry.acceptance.some(
27523
+ (ac) => typeof ac === "string" && ac.trim().length > 0
27524
+ );
27525
+ if (!hasValidAc) {
27526
+ return `ensures.schema[task_tree] on ${nodeId}: entry[${i}] ("${entry.title}") acceptance array contains no non-empty strings`;
27527
+ }
27528
+ if (Array.isArray(entry.depends) && knownIds.size > 0) {
27529
+ for (const depId of entry.depends) {
27530
+ if (typeof depId === "string" && /^T\d{3,}$/.test(depId) && !knownIds.has(depId)) {
27531
+ }
27532
+ }
27533
+ }
27534
+ }
27535
+ return null;
27536
+ }
27537
+ function validateIvtrEvidenceOutput(nodeId, evidence) {
27538
+ if (evidence === null || evidence === void 0) {
27539
+ return `ensures.schema[evidence] on ${nodeId}: evidence must be present (non-null, non-undefined)`;
27540
+ }
27541
+ if (typeof evidence === "string") {
27542
+ if (evidence.trim().length === 0) {
27543
+ return `ensures.schema[evidence] on ${nodeId}: evidence string must not be empty`;
27544
+ }
27545
+ return null;
27546
+ }
27547
+ if (Array.isArray(evidence)) {
27548
+ if (evidence.length === 0) {
27549
+ return `ensures.schema[evidence] on ${nodeId}: evidence array must not be empty`;
27550
+ }
27551
+ return null;
27552
+ }
27553
+ if (typeof evidence === "object") {
27554
+ const keys = Object.keys(evidence);
27555
+ if (keys.length === 0) {
27556
+ return `ensures.schema[evidence] on ${nodeId}: evidence object must have at least one key (got {})`;
27557
+ }
27558
+ return null;
27559
+ }
27560
+ return `ensures.schema[evidence] on ${nodeId}: evidence must be a string, array, or object (got ${typeof evidence})`;
27561
+ }
27498
27562
  async function runFromNode(args) {
27499
27563
  const {
27500
27564
  db,
@@ -27593,6 +27657,39 @@ async function runFromNode(args) {
27593
27657
  }
27594
27658
  }
27595
27659
  }
27660
+ if (node.ensures?.schema) {
27661
+ let schemaViolation = null;
27662
+ if (node.ensures.schema === "task_tree") {
27663
+ schemaViolation = validateDecompositionTaskTree(node.id, context["task_tree"]);
27664
+ } else if (node.ensures.schema === "evidence") {
27665
+ schemaViolation = validateIvtrEvidenceOutput(node.id, context["evidence"]);
27666
+ }
27667
+ if (schemaViolation !== null) {
27668
+ auditContractViolation(
27669
+ args.projectRoot,
27670
+ run.runId,
27671
+ node.id,
27672
+ "ensures",
27673
+ node.ensures.schema,
27674
+ playbook.name
27675
+ );
27676
+ const handled = handleContractErrorHandler(
27677
+ playbook,
27678
+ "contract_violation",
27679
+ schemaViolation
27680
+ );
27681
+ if (handled === "abort") {
27682
+ failedNodeId = node.id;
27683
+ lastError = schemaViolation;
27684
+ } else {
27685
+ context["__ensuresSchemaViolation"] = schemaViolation;
27686
+ if (handled === "hitl_escalate") {
27687
+ exceededNodeId = node.id;
27688
+ }
27689
+ }
27690
+ }
27691
+ }
27692
+ if (failedNodeId !== void 0) break;
27596
27693
  const nextId = resolveNextNodeId(node.id, edgeIndex);
27597
27694
  if (nextId !== null) {
27598
27695
  const edge = resolveEdge(node.id, nextId, playbook.edges);
@@ -27908,6 +28005,8 @@ __export(src_exports, {
27908
28005
  resumePlaybook: () => resumePlaybook,
27909
28006
  updatePlaybookApproval: () => updatePlaybookApproval,
27910
28007
  updatePlaybookRun: () => updatePlaybookRun,
28008
+ validateDecompositionTaskTree: () => validateDecompositionTaskTree,
28009
+ validateIvtrEvidenceOutput: () => validateIvtrEvidenceOutput,
27911
28010
  validatePlaybookCompliance: () => validatePlaybookCompliance
27912
28011
  });
27913
28012
  var PLAYBOOKS_PACKAGE_VERSION;
@@ -27974,8 +28073,8 @@ async function loadPlaybookByName(name) {
27974
28073
  return null;
27975
28074
  }
27976
28075
  try {
27977
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core/internal");
27978
- const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot57();
28076
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28077
+ const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot58();
27979
28078
  const resolved = resolvePlaybook(name, {
27980
28079
  projectRoot,
27981
28080
  globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
@@ -28019,8 +28118,8 @@ async function acquireDb() {
28019
28118
  async function buildDefaultDispatcher() {
28020
28119
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
28021
28120
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await import("@cleocode/runtime/gateway");
28022
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core/internal");
28023
- const projectRoot = getProjectRoot57();
28121
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28122
+ const projectRoot = getProjectRoot58();
28024
28123
  return {
28025
28124
  async dispatch(input2) {
28026
28125
  try {
@@ -28210,8 +28309,8 @@ var init_playbook2 = __esm({
28210
28309
  projectRoot = __playbookRuntimeOverrides.projectRoot;
28211
28310
  } else {
28212
28311
  try {
28213
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core/internal");
28214
- projectRoot = getProjectRoot57();
28312
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28313
+ projectRoot = getProjectRoot58();
28215
28314
  } catch {
28216
28315
  projectRoot = void 0;
28217
28316
  }
@@ -28275,14 +28374,14 @@ var init_playbook2 = __esm({
28275
28374
  const dispatcher = await buildDefaultDispatcher();
28276
28375
  let result;
28277
28376
  try {
28278
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core/internal");
28377
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28279
28378
  const opts = {
28280
28379
  db,
28281
28380
  playbook: parsed.definition,
28282
28381
  playbookHash: parsed.sourceHash,
28283
28382
  initialContext,
28284
28383
  dispatcher,
28285
- projectRoot: getProjectRoot57()
28384
+ projectRoot: getProjectRoot58()
28286
28385
  };
28287
28386
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
28288
28387
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -28523,7 +28622,7 @@ async function orchestrateAnalyzeOp(params) {
28523
28622
  return orchestrateAnalyze(params.epicId, getProjectRoot11(), params.mode);
28524
28623
  }
28525
28624
  async function orchestrateClassifyOp(params) {
28526
- return orchestrateClassify(params.request, params.context, getProjectRoot11());
28625
+ return orchestrateClassify(params.request, params.context, getProjectRoot11(), params.taskId);
28527
28626
  }
28528
28627
  function orchestrateFanoutStatusOp(params) {
28529
28628
  const entry = fanoutManifestStore.get(params.manifestEntryId);
@@ -28672,7 +28771,69 @@ async function orchestrateApproveOp(params) {
28672
28771
  async function orchestrateRejectOp(params) {
28673
28772
  return Promise.resolve({ success: true, data: params });
28674
28773
  }
28675
- async function orchestrateClassify(request, context, projectRoot) {
28774
+ async function orchestrateClassify(request, context, projectRoot, taskId) {
28775
+ if (taskId) {
28776
+ try {
28777
+ const { getDb: getDb3 } = await import("@cleocode/core/internal");
28778
+ const { tasks } = await import("@cleocode/core/store/tasks-schema");
28779
+ const { eq: eq2 } = await import("drizzle-orm");
28780
+ const { classifyTask: classifyTask2 } = await import("@cleocode/core");
28781
+ const db = await getDb3(projectRoot);
28782
+ const row = await db.select().from(tasks).where(eq2(tasks.id, taskId)).get();
28783
+ if (!row) {
28784
+ return {
28785
+ success: false,
28786
+ error: {
28787
+ code: "E_NOT_FOUND",
28788
+ message: `Task ${taskId} not found`
28789
+ }
28790
+ };
28791
+ }
28792
+ const task = {
28793
+ id: row.id,
28794
+ title: row.title,
28795
+ description: row.description ?? "",
28796
+ status: row.status,
28797
+ priority: row.priority ?? "medium",
28798
+ type: row.type ?? void 0,
28799
+ kind: row.kind ?? void 0,
28800
+ size: row.size ?? void 0,
28801
+ labels: (() => {
28802
+ try {
28803
+ const parsed = JSON.parse(row.labelsJson ?? "[]");
28804
+ return Array.isArray(parsed) ? parsed : [];
28805
+ } catch {
28806
+ return [];
28807
+ }
28808
+ })(),
28809
+ createdAt: row.createdAt
28810
+ };
28811
+ const result = classifyTask2(task);
28812
+ return {
28813
+ success: true,
28814
+ data: {
28815
+ team: result.agentId,
28816
+ lead: result.role === "lead" ? result.agentId : null,
28817
+ protocol: result.role,
28818
+ stage: null,
28819
+ confidence: result.confidence,
28820
+ reasoning: result.warning ? `${result.reason} | warning: ${result.warning}` : result.reason
28821
+ }
28822
+ };
28823
+ } catch (error) {
28824
+ getLogger8("domain:orchestrate").error(
28825
+ { operation: "classify", taskId, err: error },
28826
+ error instanceof Error ? error.message : String(error)
28827
+ );
28828
+ return {
28829
+ success: false,
28830
+ error: {
28831
+ code: "E_CLASSIFY_FAILED",
28832
+ message: error instanceof Error ? error.message : String(error)
28833
+ }
28834
+ };
28835
+ }
28836
+ }
28676
28837
  try {
28677
28838
  const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
28678
28839
  const { readFileSync: readFileSync22, readdirSync: readdirSync3, existsSync: existsSync21 } = await import("node:fs");
@@ -28734,6 +28895,9 @@ async function orchestrateClassify(request, context, projectRoot) {
28734
28895
  }
28735
28896
  matches.sort((a, b) => b.score - a.score);
28736
28897
  const best = matches[0];
28898
+ const allHintWords = best.consultWhen.toLowerCase().split(/\s+/).filter(Boolean);
28899
+ const normalised = allHintWords.length > 0 ? Math.min(best.score / allHintWords.length, 1) : 0;
28900
+ const confidence = best.score > 0 ? Math.max(normalised, 0.5) : 0.1;
28737
28901
  return {
28738
28902
  success: true,
28739
28903
  data: {
@@ -28741,7 +28905,7 @@ async function orchestrateClassify(request, context, projectRoot) {
28741
28905
  lead: null,
28742
28906
  protocol: "base-subagent",
28743
28907
  stage: best.stages[0] ?? null,
28744
- confidence: best.score > 0 ? 0.5 : 0.1,
28908
+ confidence,
28745
28909
  reasoning: best.score > 0 ? `Matched team '${best.team}' via consult-when hint: "${best.consultWhen}"` : `No strong match found; defaulting to first registered team '${best.team}'`
28746
28910
  }
28747
28911
  };
@@ -34920,11 +35084,11 @@ var init_security = __esm({
34920
35084
  });
34921
35085
 
34922
35086
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
34923
- function createSanitizer(getProjectRoot57) {
35087
+ function createSanitizer(getProjectRoot58) {
34924
35088
  return async (req, next) => {
34925
35089
  if (req.params) {
34926
35090
  try {
34927
- const root = getProjectRoot57 ? getProjectRoot57() : void 0;
35091
+ const root = getProjectRoot58 ? getProjectRoot58() : void 0;
34928
35092
  req.params = sanitizeParams(req.params, root, {
34929
35093
  domain: req.domain,
34930
35094
  operation: req.operation
@@ -40725,9 +40889,9 @@ var init_backup = __esm({
40725
40889
  async run({ args }) {
40726
40890
  const scope = args.scope;
40727
40891
  const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
40728
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core");
40892
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
40729
40893
  const includesProject = scope === "project" || scope === "all";
40730
- const projectRoot = includesProject ? getProjectRoot57() : void 0;
40894
+ const projectRoot = includesProject ? getProjectRoot58() : void 0;
40731
40895
  let passphrase;
40732
40896
  if (args.encrypt === true) {
40733
40897
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -40803,12 +40967,12 @@ var init_backup = __esm({
40803
40967
  },
40804
40968
  async run({ args }) {
40805
40969
  const bundlePath = args.bundle;
40806
- const { getProjectRoot: getProjectRoot57, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
40970
+ const { getProjectRoot: getProjectRoot58, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
40807
40971
  const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
40808
40972
  const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
40809
40973
  const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
40810
40974
  const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
40811
- const projectRoot = getProjectRoot57();
40975
+ const projectRoot = getProjectRoot58();
40812
40976
  if (args.force !== true) {
40813
40977
  const existing = checkForExistingData(projectRoot, getCleoHome6());
40814
40978
  if (existing.length > 0) {
@@ -43107,6 +43271,108 @@ var init_claim = __esm({
43107
43271
  }
43108
43272
  });
43109
43273
 
43274
+ // packages/cleo/src/cli/commands/classify.ts
43275
+ var classify_exports = {};
43276
+ __export(classify_exports, {
43277
+ classifyCommand: () => classifyCommand
43278
+ });
43279
+ import { classifyReadiness, classifyTask, getProjectRoot as getProjectRoot31 } from "@cleocode/core";
43280
+ var classifyCommand;
43281
+ var init_classify = __esm({
43282
+ "packages/cleo/src/cli/commands/classify.ts"() {
43283
+ "use strict";
43284
+ init_define_cli_command();
43285
+ init_renderers();
43286
+ classifyCommand = defineCommand({
43287
+ meta: {
43288
+ name: "classify",
43289
+ description: "Classify a task: readiness verdict (proceed|grill) + persona routing (agent, confidence)"
43290
+ },
43291
+ args: {
43292
+ taskId: {
43293
+ type: "positional",
43294
+ description: "Task ID to classify (e.g. T1234)",
43295
+ required: true
43296
+ }
43297
+ },
43298
+ async run({ args }) {
43299
+ const taskId = args.taskId;
43300
+ const projectRoot = getProjectRoot31();
43301
+ const { getDb: getDb3 } = await import("@cleocode/core/store/sqlite.js");
43302
+ const { tasks } = await import("@cleocode/core/store/tasks-schema");
43303
+ const { eq: eq2 } = await import("drizzle-orm");
43304
+ const db = await getDb3(projectRoot);
43305
+ const row = await db.select().from(tasks).where(eq2(tasks.id, taskId)).get();
43306
+ if (!row) {
43307
+ cliOutput(
43308
+ {
43309
+ success: false,
43310
+ error: { code: "E_NOT_FOUND", message: `Task ${taskId} not found` }
43311
+ },
43312
+ { command: "classify", operation: "classify.show" }
43313
+ );
43314
+ return;
43315
+ }
43316
+ const labels = (() => {
43317
+ try {
43318
+ const parsed = JSON.parse(row.labelsJson ?? "[]");
43319
+ return Array.isArray(parsed) ? parsed : [];
43320
+ } catch {
43321
+ return [];
43322
+ }
43323
+ })();
43324
+ const acceptance = (() => {
43325
+ try {
43326
+ const parsed = JSON.parse(row.acceptanceJson ?? "[]");
43327
+ return Array.isArray(parsed) ? parsed : [];
43328
+ } catch {
43329
+ return [];
43330
+ }
43331
+ })();
43332
+ const task = {
43333
+ id: row.id,
43334
+ title: row.title,
43335
+ description: row.description ?? "",
43336
+ status: row.status,
43337
+ priority: row.priority ?? "medium",
43338
+ type: row.type ?? void 0,
43339
+ kind: row.kind ?? void 0,
43340
+ size: row.size ?? void 0,
43341
+ pipelineStage: row.pipelineStage ?? void 0,
43342
+ blockedBy: row.blockedBy ?? void 0,
43343
+ phase: row.phase ?? void 0,
43344
+ scope: row.scope ?? void 0,
43345
+ labels,
43346
+ acceptance,
43347
+ createdAt: row.createdAt
43348
+ };
43349
+ const readiness = classifyReadiness(task);
43350
+ const routing = classifyTask(task);
43351
+ cliOutput(
43352
+ {
43353
+ taskId: row.id,
43354
+ title: row.title,
43355
+ readiness: {
43356
+ verdict: readiness.verdict,
43357
+ reason: readiness.reason,
43358
+ triggers: readiness.triggers
43359
+ },
43360
+ routing: {
43361
+ agentId: routing.agentId,
43362
+ role: routing.role,
43363
+ confidence: routing.confidence,
43364
+ reason: routing.reason,
43365
+ usedFallback: routing.usedFallback,
43366
+ warning: routing.warning
43367
+ }
43368
+ },
43369
+ { command: "classify", operation: "classify.show" }
43370
+ );
43371
+ }
43372
+ });
43373
+ }
43374
+ });
43375
+
43110
43376
  // packages/cleo/src/cli/commands/code.ts
43111
43377
  var code_exports = {};
43112
43378
  __export(code_exports, {
@@ -43939,7 +44205,7 @@ var init_conduit3 = __esm({
43939
44205
  });
43940
44206
 
43941
44207
  // packages/cleo/src/cli/commands/config/drift-check.ts
43942
- import { getProjectRoot as getProjectRoot31 } from "@cleocode/core";
44208
+ import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
43943
44209
  import { checkDrift } from "@cleocode/core/config/registry";
43944
44210
  function parseDriftScope(raw) {
43945
44211
  const value = raw ?? "project";
@@ -43984,7 +44250,7 @@ var init_drift_check = __esm({
43984
44250
  }
43985
44251
  let driftResult;
43986
44252
  try {
43987
- const projectRoot = getProjectRoot31();
44253
+ const projectRoot = getProjectRoot32();
43988
44254
  driftResult = await checkDrift(scope, projectRoot);
43989
44255
  } catch (err) {
43990
44256
  const message = err instanceof Error ? err.message : String(err);
@@ -44012,7 +44278,7 @@ var init_drift_check = __esm({
44012
44278
  });
44013
44279
 
44014
44280
  // packages/cleo/src/cli/commands/config/get.ts
44015
- import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
44281
+ import { getProjectRoot as getProjectRoot33 } from "@cleocode/core";
44016
44282
  import { getConfigValue } from "@cleocode/core/config/registry";
44017
44283
  function parseResolveScope(raw) {
44018
44284
  const value = raw ?? "merged";
@@ -44070,7 +44336,7 @@ var init_get = __esm({
44070
44336
  }
44071
44337
  let value;
44072
44338
  try {
44073
- const projectRoot = getProjectRoot32();
44339
+ const projectRoot = getProjectRoot33();
44074
44340
  value = await getConfigValue(key, { scope, projectRoot });
44075
44341
  } catch (err) {
44076
44342
  const message = err instanceof Error ? err.message : String(err);
@@ -44099,7 +44365,7 @@ var init_get = __esm({
44099
44365
  });
44100
44366
 
44101
44367
  // packages/cleo/src/cli/commands/config/set.ts
44102
- import { getProjectRoot as getProjectRoot33, parseConfigValue, setConfigValue } from "@cleocode/core";
44368
+ import { getProjectRoot as getProjectRoot34, parseConfigValue, setConfigValue } from "@cleocode/core";
44103
44369
  import { validateConfig as validateConfig2 } from "@cleocode/core/config/registry";
44104
44370
  function parseWriteScope(raw) {
44105
44371
  const value = raw ?? "project";
@@ -44209,7 +44475,7 @@ var init_set = __esm({
44209
44475
  let written;
44210
44476
  let validate;
44211
44477
  try {
44212
- const projectRoot = getProjectRoot33();
44478
+ const projectRoot = getProjectRoot34();
44213
44479
  written = await setConfigValue(key, coerced, projectRoot, {
44214
44480
  global: scope === "global"
44215
44481
  });
@@ -44241,7 +44507,7 @@ var init_set = __esm({
44241
44507
  });
44242
44508
 
44243
44509
  // packages/cleo/src/cli/commands/config/show.ts
44244
- import { getProjectRoot as getProjectRoot34 } from "@cleocode/core";
44510
+ import { getProjectRoot as getProjectRoot35 } from "@cleocode/core";
44245
44511
  import {
44246
44512
  resolveCleoConfig
44247
44513
  } from "@cleocode/core/config/registry";
@@ -44287,7 +44553,7 @@ var init_show = __esm({
44287
44553
  return;
44288
44554
  }
44289
44555
  try {
44290
- const projectRoot = getProjectRoot34();
44556
+ const projectRoot = getProjectRoot35();
44291
44557
  const config = await resolveCleoConfig({ scope, projectRoot });
44292
44558
  const result = { scope, config };
44293
44559
  cliOutput(result, {
@@ -44307,7 +44573,7 @@ var init_show = __esm({
44307
44573
  });
44308
44574
 
44309
44575
  // packages/cleo/src/cli/commands/config/validate.ts
44310
- import { getProjectRoot as getProjectRoot35 } from "@cleocode/core";
44576
+ import { getProjectRoot as getProjectRoot36 } from "@cleocode/core";
44311
44577
  import { validateConfig as validateConfig3 } from "@cleocode/core/config/registry";
44312
44578
  function parseValidateScope(raw) {
44313
44579
  const value = raw ?? "project";
@@ -44352,7 +44618,7 @@ var init_validate2 = __esm({
44352
44618
  }
44353
44619
  let validate;
44354
44620
  try {
44355
- const projectRoot = getProjectRoot35();
44621
+ const projectRoot = getProjectRoot36();
44356
44622
  validate = await validateConfig3(scope, projectRoot);
44357
44623
  } catch (err) {
44358
44624
  const message = err instanceof Error ? err.message : String(err);
@@ -45169,22 +45435,40 @@ var init_daemon2 = __esm({
45169
45435
  description: "Register the CLEO daemon as a user-level system service (systemd / launchd)"
45170
45436
  },
45171
45437
  args: {
45438
+ saga: {
45439
+ type: "string",
45440
+ description: "Scope the daemon to tasks within a Saga (sets CLEO_SENTIENT_SAGA in service env)",
45441
+ required: false
45442
+ },
45443
+ epic: {
45444
+ type: "string",
45445
+ description: "Scope the daemon to tasks directly under an Epic (sets CLEO_SENTIENT_EPIC in service env)",
45446
+ required: false
45447
+ },
45172
45448
  json: {
45173
45449
  type: "boolean",
45174
45450
  description: "Output result as JSON"
45175
45451
  }
45176
45452
  },
45177
- async run({ args: _args }) {
45453
+ async run({ args }) {
45178
45454
  try {
45179
45455
  const scriptPath = resolveDaemonInstallerScript();
45180
45456
  const { installDaemonService } = await import(scriptPath);
45181
- await installDaemonService();
45457
+ const scopeSagaId = typeof args.saga === "string" && args.saga.length > 0 ? args.saga : void 0;
45458
+ const scopeEpicId = typeof args.epic === "string" && args.epic.length > 0 ? args.epic : void 0;
45459
+ await installDaemonService({ scopeSagaId, scopeEpicId });
45460
+ const scopeNote = scopeEpicId !== void 0 ? ` (scoped to epic ${scopeEpicId})` : scopeSagaId !== void 0 ? ` (scoped to saga ${scopeSagaId})` : "";
45182
45461
  cliOutput(
45183
- { platform: process.platform, message: "Daemon service installation complete." },
45462
+ {
45463
+ platform: process.platform,
45464
+ scopeSagaId,
45465
+ scopeEpicId,
45466
+ message: `Daemon service installation complete${scopeNote}.`
45467
+ },
45184
45468
  {
45185
45469
  command: "daemon",
45186
45470
  operation: "daemon.install",
45187
- message: "CLEO: Daemon service installation complete."
45471
+ message: `CLEO: Daemon service installation complete${scopeNote}.`
45188
45472
  }
45189
45473
  );
45190
45474
  } catch (err) {
@@ -46875,7 +47159,7 @@ import { dirname as dirname7, join as join19, normalize, resolve as resolve4 } f
46875
47159
  import { fileURLToPath as fileURLToPath4 } from "node:url";
46876
47160
  import {
46877
47161
  createAttachmentStore as createAttachmentStore4,
46878
- getProjectRoot as getProjectRoot36,
47162
+ getProjectRoot as getProjectRoot37,
46879
47163
  searchAllProjectDocs as searchAllProjectDocs2
46880
47164
  } from "@cleocode/core/internal";
46881
47165
  function getViewerAssetsDir() {
@@ -46935,7 +47219,7 @@ async function serveStatic(res, assetsDir, relPath) {
46935
47219
  }
46936
47220
  }
46937
47221
  function buildViewerHandler(opts = {}) {
46938
- const projectRoot = opts.projectRoot ?? getProjectRoot36();
47222
+ const projectRoot = opts.projectRoot ?? getProjectRoot37();
46939
47223
  const assetsDir = getViewerAssetsDir();
46940
47224
  const store = createAttachmentStore4();
46941
47225
  return async (req, res) => {
@@ -47569,7 +47853,7 @@ import {
47569
47853
  DEFAULT_SIMILARITY_THRESHOLD,
47570
47854
  detectStrayCleoDb as detectStrayCleoDb2,
47571
47855
  getAgentOutputsAbsolute,
47572
- getProjectRoot as getProjectRoot37,
47856
+ getProjectRoot as getProjectRoot38,
47573
47857
  readJson,
47574
47858
  resolveWorktreeFilePath,
47575
47859
  resolveWorktreeRouting as resolveWorktreeRouting4
@@ -47841,7 +48125,7 @@ var init_docs3 = __esm({
47841
48125
  resolvedFile = resolveWorktreeFilePath(String(fileArg), routing);
47842
48126
  }
47843
48127
  if (args.slug && args.type) {
47844
- const projectRoot = await getProjectRoot37();
48128
+ const projectRoot = await getProjectRoot38();
47845
48129
  let warnThreshold = DEFAULT_SIMILARITY_THRESHOLD;
47846
48130
  let mode = DEFAULT_SIMILARITY_MODE;
47847
48131
  try {
@@ -48221,7 +48505,7 @@ var init_docs3 = __esm({
48221
48505
  const taskId = String(args.task);
48222
48506
  const includeAttachments = args["include-attachments"] !== false;
48223
48507
  const includeMemoryRefs = args["include-memory-refs"] === true;
48224
- const projectRoot = getProjectRoot37();
48508
+ const projectRoot = getProjectRoot38();
48225
48509
  try {
48226
48510
  const result = await dispatchDocsRaw("query", "llm-output", {
48227
48511
  mode: "task-export",
@@ -48292,7 +48576,7 @@ var init_docs3 = __esm({
48292
48576
  },
48293
48577
  async run({ args }) {
48294
48578
  const forId = String(args.for);
48295
- const projectRoot = getProjectRoot37();
48579
+ const projectRoot = getProjectRoot38();
48296
48580
  try {
48297
48581
  const result = await dispatchDocsRaw("query", "llm-output", {
48298
48582
  for: forId,
@@ -48369,7 +48653,7 @@ var init_docs3 = __esm({
48369
48653
  },
48370
48654
  async run({ args }) {
48371
48655
  const forId = String(args.for);
48372
- const projectRoot = getProjectRoot37();
48656
+ const projectRoot = getProjectRoot38();
48373
48657
  try {
48374
48658
  const result = await dispatchDocsRaw("query", "llm-output", {
48375
48659
  for: forId,
@@ -48595,7 +48879,7 @@ var init_docs3 = __esm({
48595
48879
  }
48596
48880
  },
48597
48881
  async run({ args }) {
48598
- const projectRoot = getProjectRoot37();
48882
+ const projectRoot = getProjectRoot38();
48599
48883
  const rawStrategy = args.strategy ?? "three-way";
48600
48884
  const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
48601
48885
  try {
@@ -49365,7 +49649,7 @@ var init_docs3 = __esm({
49365
49649
  }
49366
49650
  },
49367
49651
  async run({ args }) {
49368
- const projectRoot = getProjectRoot37();
49652
+ const projectRoot = getProjectRoot38();
49369
49653
  const dirArg = String(args.dir);
49370
49654
  const scanRoot = isAbsolute2(dirArg) ? dirArg : resolve5(projectRoot, dirArg);
49371
49655
  const dryRun = args["dry-run"] === true;
@@ -49427,7 +49711,7 @@ var init_docs3 = __esm({
49427
49711
  }
49428
49712
  },
49429
49713
  async run({ args }) {
49430
- const projectRoot = getProjectRoot37();
49714
+ const projectRoot = getProjectRoot38();
49431
49715
  const { registry, configError } = loadCliRegistry(projectRoot);
49432
49716
  const kinds = registry.list().map(toWireKind);
49433
49717
  const extensionsCount = kinds.filter((k) => k.isExtension).length;
@@ -49482,7 +49766,7 @@ var init_docs3 = __esm({
49482
49766
  deprecated: "docs list-types",
49483
49767
  replacement: "docs schema"
49484
49768
  });
49485
- const projectRoot = getProjectRoot37();
49769
+ const projectRoot = getProjectRoot38();
49486
49770
  const { registry, configError } = loadCliRegistry(projectRoot);
49487
49771
  const kinds = registry.list().map(toWireKind);
49488
49772
  const extensionsCount = kinds.filter((k) => k.isExtension).length;
@@ -49576,7 +49860,7 @@ var doctor_db_substrate_exports = {};
49576
49860
  __export(doctor_db_substrate_exports, {
49577
49861
  doctorDbSubstrateCommand: () => doctorDbSubstrateCommand
49578
49862
  });
49579
- import { getProjectRoot as getProjectRoot38, pushWarning as pushWarning4 } from "@cleocode/core";
49863
+ import { getProjectRoot as getProjectRoot39, pushWarning as pushWarning4 } from "@cleocode/core";
49580
49864
  import { surveyDbSubstrate, surveyFleetDbSubstrate } from "@cleocode/core/doctor/db-substrate.js";
49581
49865
  function pushSubstrateWarnings(result) {
49582
49866
  for (const warning of result.warnings) {
@@ -49709,7 +49993,7 @@ var init_doctor_db_substrate = __esm({
49709
49993
  const result = isFleet ? surveyFleetDbSubstrate(
49710
49994
  typeof args["fleet-root"] === "string" && args["fleet-root"].length > 0 ? args["fleet-root"] : DEFAULT_FLEET_ROOT,
49711
49995
  options
49712
- ) : surveyDbSubstrate(getProjectRoot38(), options);
49996
+ ) : surveyDbSubstrate(getProjectRoot39(), options);
49713
49997
  pushSubstrateWarnings(result);
49714
49998
  pushPerDbWarnings(result);
49715
49999
  cliOutput(result, {
@@ -49729,7 +50013,7 @@ var doctor_legacy_backups_exports = {};
49729
50013
  __export(doctor_legacy_backups_exports, {
49730
50014
  doctorLegacyBackupsCommand: () => doctorLegacyBackupsCommand
49731
50015
  });
49732
- import { getProjectRoot as getProjectRoot39 } from "@cleocode/core";
50016
+ import { getProjectRoot as getProjectRoot40 } from "@cleocode/core";
49733
50017
  import { pruneLegacyBackups, scanLegacyBackups } from "@cleocode/core/doctor/legacy-backups.js";
49734
50018
  function parsePositiveInt(raw, fallback) {
49735
50019
  if (raw === void 0 || raw === null) return fallback;
@@ -49773,7 +50057,7 @@ var init_doctor_legacy_backups = __esm({
49773
50057
  async run({ args }) {
49774
50058
  const softRetentionDays = parsePositiveInt(args["soft-retention-days"], 30);
49775
50059
  const hardRetentionDays = parsePositiveInt(args["hard-retention-days"], 90);
49776
- const projectRoot = getProjectRoot39();
50060
+ const projectRoot = getProjectRoot40();
49777
50061
  let result;
49778
50062
  if (args.prune === true) {
49779
50063
  const dryRun = args["dry-run"] !== false;
@@ -50340,7 +50624,7 @@ __export(migrate_agents_v2_exports, {
50340
50624
  import { createHash as createHash2 } from "node:crypto";
50341
50625
  import { appendFileSync as appendFileSync2, existsSync as existsSync14, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync13 } from "node:fs";
50342
50626
  import { join as join23 } from "node:path";
50343
- import { getProjectRoot as getProjectRoot40, installAgentFromCant } from "@cleocode/core/internal";
50627
+ import { getProjectRoot as getProjectRoot41, installAgentFromCant } from "@cleocode/core/internal";
50344
50628
  import { openCleoDb as openCleoDb2 } from "@cleocode/core/store/open-cleo-db";
50345
50629
  function sha256Hex(bytes) {
50346
50630
  return createHash2("sha256").update(bytes).digest("hex");
@@ -50527,7 +50811,7 @@ var init_migrate_agents_v2 = __esm({
50527
50811
  }
50528
50812
  },
50529
50813
  async run({ args }) {
50530
- const projectRoot = getProjectRoot40();
50814
+ const projectRoot = getProjectRoot41();
50531
50815
  const verbose = args.quiet !== true;
50532
50816
  if (verbose) {
50533
50817
  humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
@@ -50571,7 +50855,7 @@ __export(doctor_exports, {
50571
50855
  });
50572
50856
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
50573
50857
  import { join as join24 } from "node:path";
50574
- import { getProjectRoot as getProjectRoot41, pushWarning as pushWarning5 } from "@cleocode/core";
50858
+ import { getProjectRoot as getProjectRoot42, pushWarning as pushWarning5 } from "@cleocode/core";
50575
50859
  import { renderInvariantAuditLines } from "@cleocode/core/doctor/invariant-audit-render.js";
50576
50860
  import {
50577
50861
  quarantineRogueCleoDir,
@@ -50910,7 +51194,7 @@ var init_doctor = __esm({
50910
51194
  const { join: pathJoin } = await import("node:path");
50911
51195
  const { existsSync: existsSync21 } = await import("node:fs");
50912
51196
  const { detectAndHealCoreWorktreeLeak } = await import("@cleocode/worktree");
50913
- const projectRoot = getProjectRoot41();
51197
+ const projectRoot = getProjectRoot42();
50914
51198
  let gitRoot = projectRoot;
50915
51199
  try {
50916
51200
  gitRoot = execFile2("git", ["rev-parse", "--show-toplevel"], {
@@ -50962,7 +51246,7 @@ var init_doctor = __esm({
50962
51246
  }
50963
51247
  if (args.brain) {
50964
51248
  const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
50965
- const projectRoot = getProjectRoot41();
51249
+ const projectRoot = getProjectRoot42();
50966
51250
  const dashboard = await computeBrainHealthDashboard(projectRoot);
50967
51251
  cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
50968
51252
  if (dashboard.hasP0Failure) {
@@ -50971,7 +51255,7 @@ var init_doctor = __esm({
50971
51255
  return;
50972
51256
  }
50973
51257
  if (args["scan-test-fixtures-in-prod"]) {
50974
- const projectRoot = getProjectRoot41();
51258
+ const projectRoot = getProjectRoot42();
50975
51259
  const matches = await scanTestFixturesInProd(projectRoot);
50976
51260
  const dryRun = args["dry-run"] !== false && args.quarantine !== true;
50977
51261
  const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
@@ -51059,7 +51343,7 @@ var init_doctor = __esm({
51059
51343
  progress.complete("Comprehensive diagnostics complete");
51060
51344
  } else if (args["scan-rogue-cleo-dirs"]) {
51061
51345
  progress.step(0, "Scanning for rogue .cleo/ directories");
51062
- const projectRoot = getProjectRoot41();
51346
+ const projectRoot = getProjectRoot42();
51063
51347
  const reports = scanRogueCleoDirs(projectRoot);
51064
51348
  progress.complete(
51065
51349
  `Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
@@ -51068,7 +51352,7 @@ var init_doctor = __esm({
51068
51352
  } else if (args["quarantine-rogue-cleo-dirs"]) {
51069
51353
  const isDryRun = args["dry-run"] === true;
51070
51354
  progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
51071
- const projectRoot = getProjectRoot41();
51355
+ const projectRoot = getProjectRoot42();
51072
51356
  const reports = scanRogueCleoDirs(projectRoot);
51073
51357
  if (reports.length === 0) {
51074
51358
  progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
@@ -51122,7 +51406,7 @@ var init_doctor = __esm({
51122
51406
  const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
51123
51407
  const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
51124
51408
  const cleoHome = getCleoHome6();
51125
- const projectRoot = getProjectRoot41();
51409
+ const projectRoot = getProjectRoot42();
51126
51410
  const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
51127
51411
  const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
51128
51412
  const isDryRun = args["dry-run"] === true;
@@ -51155,7 +51439,7 @@ var init_doctor = __esm({
51155
51439
  } else if (args["audit-worktree-orphans"]) {
51156
51440
  progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
51157
51441
  const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
51158
- const projectRoot = getProjectRoot41();
51442
+ const projectRoot = getProjectRoot42();
51159
51443
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
51160
51444
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
51161
51445
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -51212,7 +51496,7 @@ var init_doctor = __esm({
51212
51496
  `${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
51213
51497
  );
51214
51498
  const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
51215
- const projectRoot = getProjectRoot41();
51499
+ const projectRoot = getProjectRoot42();
51216
51500
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
51217
51501
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
51218
51502
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -51291,7 +51575,7 @@ var init_doctor = __esm({
51291
51575
  `${isDryRun ? "[DRY RUN] " : ""}Migrating .cleo/worktree-include \u2192 .worktreeinclude`
51292
51576
  );
51293
51577
  const { migrateWorktreeIncludeFile } = await import("@cleocode/core");
51294
- const projectRoot = getProjectRoot41();
51578
+ const projectRoot = getProjectRoot42();
51295
51579
  const result = await migrateWorktreeIncludeFile(projectRoot, { dryRun: isDryRun });
51296
51580
  progress.complete(`Migration ${result.action}`);
51297
51581
  cliOutput(result, { command: "doctor", operation: "doctor.migrate-worktree-include" });
@@ -51310,7 +51594,7 @@ var init_doctor = __esm({
51310
51594
  const stepLabel = isFocusedAlias ? "Auditing Saga hierarchy for ADR-073 invariants" : "Walking central INVARIANTS_REGISTRY";
51311
51595
  progress.step(0, stepLabel);
51312
51596
  const { auditInvariantRegistry } = await import("@cleocode/core/doctor/invariant-audit.js");
51313
- const projectRoot = getProjectRoot41();
51597
+ const projectRoot = getProjectRoot42();
51314
51598
  const result = await auditInvariantRegistry(projectRoot, { adrFilter });
51315
51599
  const operation = isFocusedAlias ? "doctor.audit-sagas" : "doctor.audit-invariants";
51316
51600
  const summary = `Invariant audit complete \u2014 ${result.totalCount} entries walked, ${result.errorCount} error / ${result.warningCount} warning / ${result.infoCount} info violation(s), ${result.notApplicableCount} not-applicable, ${result.documentedCount} documented`;
@@ -51332,7 +51616,7 @@ var init_doctor = __esm({
51332
51616
  { command: "doctor", operation: "admin.health" }
51333
51617
  );
51334
51618
  try {
51335
- const projectRoot = getProjectRoot41();
51619
+ const projectRoot = getProjectRoot42();
51336
51620
  const conflicts = readMigrationConflicts(projectRoot);
51337
51621
  if (conflicts.length > 0) {
51338
51622
  progress.complete(
@@ -51363,7 +51647,7 @@ var init_doctor = __esm({
51363
51647
  progress.complete("Health check complete");
51364
51648
  }
51365
51649
  try {
51366
- const projectRoot = getProjectRoot41();
51650
+ const projectRoot = getProjectRoot42();
51367
51651
  const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
51368
51652
  const sagaAudit = await auditSagaHierarchy(projectRoot);
51369
51653
  if (sagaAudit.sagas.length === 0) {
@@ -52536,7 +52820,7 @@ var go_exports = {};
52536
52820
  __export(go_exports, {
52537
52821
  goCommand: () => goCommand
52538
52822
  });
52539
- import { getProjectRoot as getProjectRoot42, go } from "@cleocode/core";
52823
+ import { getProjectRoot as getProjectRoot43, go } from "@cleocode/core";
52540
52824
  var goCommand;
52541
52825
  var init_go = __esm({
52542
52826
  "packages/cleo/src/cli/commands/go.ts"() {
@@ -52561,7 +52845,7 @@ var init_go = __esm({
52561
52845
  }
52562
52846
  },
52563
52847
  async run({ args }) {
52564
- const projectRoot = getProjectRoot42();
52848
+ const projectRoot = getProjectRoot43();
52565
52849
  const result = await go.cleoGo({
52566
52850
  sagaId: typeof args.saga === "string" && args.saga.length > 0 ? args.saga : void 0,
52567
52851
  headless: args.headless === true,
@@ -52578,7 +52862,7 @@ var goal_exports = {};
52578
52862
  __export(goal_exports, {
52579
52863
  goalCommand: () => goalCommand
52580
52864
  });
52581
- import { getProjectRoot as getProjectRoot43, goal } from "@cleocode/core";
52865
+ import { getProjectRoot as getProjectRoot44, goal } from "@cleocode/core";
52582
52866
  function resolveGoalKind(task) {
52583
52867
  if (typeof task === "string" && task.length > 0) {
52584
52868
  if (!isValidGoalTargetTaskId(task)) {
@@ -52625,7 +52909,7 @@ var init_goal2 = __esm({
52625
52909
  }
52626
52910
  const record = await goal.createGoal(
52627
52911
  { goalKind: kindResult.kind, intent, turnBudget: resolveTurnBudget(args.turns) },
52628
- getProjectRoot43()
52912
+ getProjectRoot44()
52629
52913
  );
52630
52914
  cliOutput(record, { command: "goal set", operation: "goal.set" });
52631
52915
  }
@@ -52636,7 +52920,7 @@ var init_goal2 = __esm({
52636
52920
  description: "Show the current agent's active goal (per-agent scoped)."
52637
52921
  },
52638
52922
  async run() {
52639
- const record = await goal.getActiveGoal(getProjectRoot43());
52923
+ const record = await goal.getActiveGoal(getProjectRoot44());
52640
52924
  cliOutput(record ?? { active: null }, { command: "goal status", operation: "goal.status" });
52641
52925
  }
52642
52926
  });
@@ -52658,7 +52942,7 @@ var init_goal2 = __esm({
52658
52942
  });
52659
52943
  return;
52660
52944
  }
52661
- const cwd = getProjectRoot43();
52945
+ const cwd = getProjectRoot44();
52662
52946
  const parent = await goal.getActiveGoal(cwd);
52663
52947
  if (!parent) {
52664
52948
  cliError(
@@ -52706,7 +52990,7 @@ var init_goal2 = __esm({
52706
52990
  });
52707
52991
  return;
52708
52992
  }
52709
- const cwd = getProjectRoot43();
52993
+ const cwd = getProjectRoot44();
52710
52994
  const result = await goal.advanceGoalWithPersist(goalId, { cwd });
52711
52995
  if (!result) {
52712
52996
  cliError(`Goal '${goalId}' not found.`, 4 /* NOT_FOUND */, { name: "E_NOT_FOUND" });
@@ -52731,7 +53015,7 @@ var init_goal2 = __esm({
52731
53015
  });
52732
53016
  return;
52733
53017
  }
52734
- const cwd = getProjectRoot43();
53018
+ const cwd = getProjectRoot44();
52735
53019
  const active = await goal.getActiveGoal(cwd);
52736
53020
  if (!active) {
52737
53021
  cliError(
@@ -53720,7 +54004,7 @@ var hygiene_exports = {};
53720
54004
  __export(hygiene_exports, {
53721
54005
  hygieneCommand: () => hygieneCommand
53722
54006
  });
53723
- import { getProjectRoot as getProjectRoot44 } from "@cleocode/core";
54007
+ import { getProjectRoot as getProjectRoot45 } from "@cleocode/core";
53724
54008
  import { runSpawnReadinessHygieneCli } from "@cleocode/core/hygiene/validate-spawn-readiness.js";
53725
54009
  var hygieneCommand;
53726
54010
  var init_hygiene = __esm({
@@ -53749,7 +54033,7 @@ var init_hygiene = __esm({
53749
54033
  }
53750
54034
  },
53751
54035
  async run({ args }) {
53752
- const projectRoot = args["project-root"] || getProjectRoot44() || process.cwd();
54036
+ const projectRoot = args["project-root"] || getProjectRoot45() || process.cwd();
53753
54037
  const worktreePath = args["worktree-path"];
53754
54038
  await runSpawnReadinessHygieneCli(projectRoot, worktreePath);
53755
54039
  }
@@ -54911,7 +55195,7 @@ var llm_cost_exports = {};
54911
55195
  __export(llm_cost_exports, {
54912
55196
  costCommand: () => costCommand
54913
55197
  });
54914
- import { getProjectRoot as getProjectRoot45 } from "@cleocode/core/internal";
55198
+ import { getProjectRoot as getProjectRoot46 } from "@cleocode/core/internal";
54915
55199
  import { computeCost } from "@cleocode/core/llm/usage-pricing";
54916
55200
  function resolveSessionId(raw) {
54917
55201
  if (raw === "current") {
@@ -54984,7 +55268,7 @@ var init_llm_cost = __esm({
54984
55268
  process.exit(6);
54985
55269
  }
54986
55270
  const sessionId = resolveSessionId(rawSessionId);
54987
- const projectRoot = getProjectRoot45(process.cwd());
55271
+ const projectRoot = getProjectRoot46(process.cwd());
54988
55272
  let breakdown;
54989
55273
  try {
54990
55274
  breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
@@ -56531,7 +56815,7 @@ var memory_exports = {};
56531
56815
  __export(memory_exports, {
56532
56816
  memoryCommand: () => memoryCommand
56533
56817
  });
56534
- import { getProjectRoot as getProjectRoot46 } from "@cleocode/core";
56818
+ import { getProjectRoot as getProjectRoot47 } from "@cleocode/core";
56535
56819
  import {
56536
56820
  getBrainDb as getBrainDb2,
56537
56821
  getDreamStatus,
@@ -57464,7 +57748,7 @@ var init_memory3 = __esm({
57464
57748
  },
57465
57749
  args: {},
57466
57750
  async run() {
57467
- const root = getProjectRoot46();
57751
+ const root = getProjectRoot47();
57468
57752
  try {
57469
57753
  const result = await runConsolidation(root);
57470
57754
  cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
@@ -57488,7 +57772,7 @@ var init_memory3 = __esm({
57488
57772
  }
57489
57773
  },
57490
57774
  async run({ args }) {
57491
- const root = getProjectRoot46();
57775
+ const root = getProjectRoot47();
57492
57776
  if (args.status) {
57493
57777
  try {
57494
57778
  const status = await getDreamStatus(root);
@@ -57525,7 +57809,7 @@ var init_memory3 = __esm({
57525
57809
  }
57526
57810
  },
57527
57811
  async run({ args }) {
57528
- const root = getProjectRoot46();
57812
+ const root = getProjectRoot47();
57529
57813
  try {
57530
57814
  const { runObserver, runReflector } = await import("@cleocode/core/memory");
57531
57815
  const observerResult = await runObserver(root, args.session, {
@@ -57565,7 +57849,7 @@ var init_memory3 = __esm({
57565
57849
  }
57566
57850
  },
57567
57851
  async run({ args }) {
57568
- const root = getProjectRoot46();
57852
+ const root = getProjectRoot47();
57569
57853
  try {
57570
57854
  await getBrainDb2(root);
57571
57855
  const { totalDuplicateRows, groups } = await scanDuplicateEntries();
@@ -57611,7 +57895,7 @@ var init_memory3 = __esm({
57611
57895
  async run({ args }) {
57612
57896
  const sourceDir = args.from;
57613
57897
  const isDryRun = !!args["dry-run"];
57614
- const projectRoot = getProjectRoot46();
57898
+ const projectRoot = getProjectRoot47();
57615
57899
  try {
57616
57900
  const result = await importMemoryFiles({
57617
57901
  sourceDir,
@@ -57762,7 +58046,7 @@ var init_memory3 = __esm({
57762
58046
  },
57763
58047
  args: {},
57764
58048
  async run() {
57765
- const root = getProjectRoot46();
58049
+ const root = getProjectRoot47();
57766
58050
  try {
57767
58051
  await getBrainDb2(root);
57768
58052
  const result = await getTierStats(root);
@@ -57805,7 +58089,7 @@ var init_memory3 = __esm({
57805
58089
  }
57806
58090
  },
57807
58091
  async run({ args }) {
57808
- const root = getProjectRoot46();
58092
+ const root = getProjectRoot47();
57809
58093
  const targetTier = args.to;
57810
58094
  const reason = args.reason;
57811
58095
  const validTiers = ["medium", "long"];
@@ -57871,7 +58155,7 @@ var init_memory3 = __esm({
57871
58155
  }
57872
58156
  },
57873
58157
  async run({ args }) {
57874
- const root = getProjectRoot46();
58158
+ const root = getProjectRoot47();
57875
58159
  const targetTier = args.to;
57876
58160
  const reason = args.reason;
57877
58161
  const validTiers = ["short", "medium"];
@@ -58334,7 +58618,7 @@ var migrate_claude_mem_exports = {};
58334
58618
  __export(migrate_claude_mem_exports, {
58335
58619
  migrateClaudeMemCommand: () => migrateClaudeMemCommand
58336
58620
  });
58337
- import { getProjectRoot as getProjectRoot47, migrateClaudeMem } from "@cleocode/core/internal";
58621
+ import { getProjectRoot as getProjectRoot48, migrateClaudeMem } from "@cleocode/core/internal";
58338
58622
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
58339
58623
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
58340
58624
  var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
@@ -58397,7 +58681,7 @@ var init_migrate_claude_mem = __esm({
58397
58681
  }
58398
58682
  },
58399
58683
  async run({ args }) {
58400
- const root = getProjectRoot47();
58684
+ const root = getProjectRoot48();
58401
58685
  try {
58402
58686
  const result = await migrateClaudeMem(root, {
58403
58687
  sourcePath: args.source,
@@ -58446,7 +58730,7 @@ var init_migrate_claude_mem = __esm({
58446
58730
  }
58447
58731
  },
58448
58732
  async run({ args }) {
58449
- const projectRoot = getProjectRoot47();
58733
+ const projectRoot = getProjectRoot48();
58450
58734
  try {
58451
58735
  const db = await getDb2(projectRoot);
58452
58736
  const rcasdFlag = Boolean(args.rcasd);
@@ -58564,7 +58848,7 @@ __export(nexus_exports, {
58564
58848
  import { appendFile as appendFile2, mkdir as mkdir4 } from "node:fs/promises";
58565
58849
  import { homedir as homedir5 } from "node:os";
58566
58850
  import path4 from "node:path";
58567
- import { getProjectRoot as getProjectRoot48 } from "@cleocode/core";
58851
+ import { getProjectRoot as getProjectRoot49 } from "@cleocode/core";
58568
58852
  import { getSymbolImpact } from "@cleocode/core/nexus";
58569
58853
  import { runNexusAnalysis } from "@cleocode/core/nexus/analyze-orchestrator.js";
58570
58854
  import { exportNexusGraph } from "@cleocode/core/nexus/export.js";
@@ -58679,7 +58963,7 @@ var init_nexus3 = __esm({
58679
58963
  async run({ args }) {
58680
58964
  applyJsonFlag2(args.json);
58681
58965
  const projectIdOverride = args["project-id"];
58682
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
58966
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
58683
58967
  const startTime = Date.now();
58684
58968
  try {
58685
58969
  const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
@@ -59194,7 +59478,7 @@ var init_nexus3 = __esm({
59194
59478
  applyJsonFlag2(args.json);
59195
59479
  const startTime = Date.now();
59196
59480
  const projectIdOverride = args["project-id"];
59197
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
59481
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
59198
59482
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
59199
59483
  const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
59200
59484
  const durationMs = Date.now() - startTime;
@@ -59238,7 +59522,7 @@ var init_nexus3 = __esm({
59238
59522
  applyJsonFlag2(args.json);
59239
59523
  const startTime = Date.now();
59240
59524
  const projectIdOverride = args["project-id"];
59241
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
59525
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
59242
59526
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
59243
59527
  const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
59244
59528
  const durationMs = Date.now() - startTime;
@@ -59281,7 +59565,7 @@ var init_nexus3 = __esm({
59281
59565
  void appendDeprecationTelemetry("nexus.context", "cleo graph context");
59282
59566
  const startTime = Date.now();
59283
59567
  const projectIdOverride = args["project-id"];
59284
- const repoPath = getProjectRoot48();
59568
+ const repoPath = getProjectRoot49();
59285
59569
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
59286
59570
  const limit = parseInt(args.limit, 10);
59287
59571
  const symbolName = args.symbol;
@@ -59344,7 +59628,7 @@ var init_nexus3 = __esm({
59344
59628
  const startTime = Date.now();
59345
59629
  const whyFlag = !!args.why;
59346
59630
  const projectIdOverride = args["project-id"];
59347
- const repoPath = getProjectRoot48();
59631
+ const repoPath = getProjectRoot49();
59348
59632
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
59349
59633
  const maxDepth = Math.min(parseInt(args.depth, 10), 5);
59350
59634
  const symbolName = args.symbol;
@@ -59416,7 +59700,7 @@ var init_nexus3 = __esm({
59416
59700
  const projectIdOverride = args["project-id"];
59417
59701
  const isIncremental = !!args.incremental;
59418
59702
  const ctx = getFormatContext();
59419
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
59703
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
59420
59704
  humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
59421
59705
  if (!isIncremental) humanInfo("[nexus] Clearing existing index for project...");
59422
59706
  try {
@@ -59519,7 +59803,7 @@ var init_nexus3 = __esm({
59519
59803
  async run({ args }) {
59520
59804
  applyJsonFlag2(args.json);
59521
59805
  const startTime = Date.now();
59522
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
59806
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
59523
59807
  const name = args.name;
59524
59808
  const response = await dispatchRaw("mutate", "nexus", "projects.register", {
59525
59809
  path: repoPath,
@@ -59877,7 +60161,7 @@ var init_nexus3 = __esm({
59877
60161
  applyJsonFlag2(args.json);
59878
60162
  const startTime = Date.now();
59879
60163
  const projectIdOverride = args["project-id"];
59880
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
60164
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
59881
60165
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
59882
60166
  const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
59883
60167
  repoPath,
@@ -59983,7 +60267,7 @@ var init_nexus3 = __esm({
59983
60267
  async run({ args }) {
59984
60268
  applyJsonFlag2(args.json);
59985
60269
  const startTime = Date.now();
59986
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
60270
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
59987
60271
  const projectIdOverride = args["project-id"];
59988
60272
  const beforeRef = args.before ?? "HEAD~1";
59989
60273
  const afterRef = args.after ?? "HEAD";
@@ -60101,7 +60385,7 @@ var init_nexus3 = __esm({
60101
60385
  applyJsonFlag2(args.json);
60102
60386
  const startTime = Date.now();
60103
60387
  const projectIdOverride = args["project-id"];
60104
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
60388
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60105
60389
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60106
60390
  const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
60107
60391
  const durationMs = Date.now() - startTime;
@@ -60157,7 +60441,7 @@ var init_nexus3 = __esm({
60157
60441
  const startTime = Date.now();
60158
60442
  const routeSymbol = args.routeSymbol;
60159
60443
  const projectIdOverride = args["project-id"];
60160
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
60444
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60161
60445
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60162
60446
  const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
60163
60447
  const durationMs = Date.now() - startTime;
@@ -60547,7 +60831,7 @@ var init_nexus3 = __esm({
60547
60831
  async run({ args }) {
60548
60832
  applyJsonFlag2(args.json);
60549
60833
  const startTime = Date.now();
60550
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
60834
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60551
60835
  const projectIdOverride = args["project-id"];
60552
60836
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60553
60837
  const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
@@ -60651,7 +60935,7 @@ var init_nexus3 = __esm({
60651
60935
  async run({ args }) {
60652
60936
  applyJsonFlag2(args.json);
60653
60937
  const startTime = Date.now();
60654
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot48();
60938
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60655
60939
  const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
60656
60940
  const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
60657
60941
  projectId,
@@ -60732,7 +61016,7 @@ var init_nexus3 = __esm({
60732
61016
  const isIncremental = !!args.incremental;
60733
61017
  try {
60734
61018
  const result = await runNexusWiki({
60735
- projectRoot: getProjectRoot48(),
61019
+ projectRoot: getProjectRoot49(),
60736
61020
  outputDir,
60737
61021
  communityFilter,
60738
61022
  incremental: isIncremental
@@ -61082,7 +61366,7 @@ __export(orchestrate_exports, {
61082
61366
  });
61083
61367
  import { execFileSync as execFileSync3 } from "node:child_process";
61084
61368
  import { orchestration } from "@cleocode/core";
61085
- import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot49 } from "@cleocode/core/internal";
61369
+ import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot50 } from "@cleocode/core/internal";
61086
61370
  function formatRollupTable(rollup) {
61087
61371
  const waves = "waves" in rollup ? rollup.waves : [rollup];
61088
61372
  const lines = [];
@@ -61117,7 +61401,7 @@ function formatRollupTable(rollup) {
61117
61401
  }
61118
61402
  return lines.join("\n");
61119
61403
  }
61120
- var rollupCommand, startCommand5, statusCommand12, dashboardCommand, analyzeCommand4, readyCommand, reportCommand, nextCommand2, wavesCommand2, planCommand, spawnCommand2, validateCommand6, contextCommand5, ivtrCommand, parallelCommand, tesseraListCommand, tesseraInstantiateCommand, tesseraCommand, unblockCommand, bootstrapCommand, classifyCommand, fanoutStatusCommand, handoffCommand, spawnExecuteCommand, fanoutCommand, pruneCommand, worktreeCompleteCommand, conduitStatusCommand, conduitPeekCommand, conduitStartCommand, conduitStopCommand, approveCommand, rejectCommand, pendingCommand, conduitSendCommand, orchestrateCommand;
61404
+ var rollupCommand, startCommand5, statusCommand12, dashboardCommand, analyzeCommand4, readyCommand, reportCommand, nextCommand2, wavesCommand2, planCommand, spawnCommand2, validateCommand6, contextCommand5, ivtrCommand, parallelCommand, tesseraListCommand, tesseraInstantiateCommand, tesseraCommand, unblockCommand, bootstrapCommand, classifyCommand2, fanoutStatusCommand, handoffCommand, spawnExecuteCommand, fanoutCommand, pruneCommand, worktreeCompleteCommand, conduitStatusCommand, conduitPeekCommand, conduitStartCommand, conduitStopCommand, approveCommand, rejectCommand, pendingCommand, conduitSendCommand, orchestrateCommand;
61121
61405
  var init_orchestrate3 = __esm({
61122
61406
  "packages/cleo/src/cli/commands/orchestrate.ts"() {
61123
61407
  "use strict";
@@ -61225,7 +61509,7 @@ var init_orchestrate3 = __esm({
61225
61509
  },
61226
61510
  async run({ args }) {
61227
61511
  const rateWindowHours = args.window !== void 0 ? Number.parseFloat(String(args.window)) : void 0;
61228
- const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot49(), {
61512
+ const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot50(), {
61229
61513
  ...rateWindowHours !== void 0 && Number.isFinite(rateWindowHours) && rateWindowHours > 0 ? { rateWindowHours } : {}
61230
61514
  });
61231
61515
  cliOutput(metrics, {
@@ -61706,7 +61990,7 @@ var init_orchestrate3 = __esm({
61706
61990
  );
61707
61991
  }
61708
61992
  });
61709
- classifyCommand = defineCommand({
61993
+ classifyCommand2 = defineCommand({
61710
61994
  meta: {
61711
61995
  name: "classify",
61712
61996
  description: "Classify a request using CANT prompt-based team routing"
@@ -62045,7 +62329,7 @@ var init_orchestrate3 = __esm({
62045
62329
  tessera: tesseraCommand,
62046
62330
  unblock: unblockCommand,
62047
62331
  bootstrap: bootstrapCommand,
62048
- classify: classifyCommand,
62332
+ classify: classifyCommand2,
62049
62333
  "fanout-status": fanoutStatusCommand,
62050
62334
  handoff: handoffCommand,
62051
62335
  "spawn-execute": spawnExecuteCommand,
@@ -63430,7 +63714,7 @@ var refresh_memory_exports = {};
63430
63714
  __export(refresh_memory_exports, {
63431
63715
  refreshMemoryCommand: () => refreshMemoryCommand
63432
63716
  });
63433
- import { getProjectRoot as getProjectRoot50 } from "@cleocode/core";
63717
+ import { getProjectRoot as getProjectRoot51 } from "@cleocode/core";
63434
63718
  var refreshMemoryCommand;
63435
63719
  var init_refresh_memory = __esm({
63436
63720
  "packages/cleo/src/cli/commands/refresh-memory.ts"() {
@@ -63443,7 +63727,7 @@ var init_refresh_memory = __esm({
63443
63727
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
63444
63728
  },
63445
63729
  async run() {
63446
- const projectDir = getProjectRoot50();
63730
+ const projectDir = getProjectRoot51();
63447
63731
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
63448
63732
  const result = await writeMemoryBridge(projectDir);
63449
63733
  if (result.written) {
@@ -64970,7 +65254,7 @@ import fs3 from "node:fs";
64970
65254
  import path5 from "node:path";
64971
65255
  import {
64972
65256
  CleoError as CleoError8,
64973
- getProjectRoot as getProjectRoot51,
65257
+ getProjectRoot as getProjectRoot52,
64974
65258
  getTaskAccessor as getTaskAccessor3,
64975
65259
  parseConflictReport,
64976
65260
  setAtPath
@@ -64991,7 +65275,7 @@ var init_restore = __esm({
64991
65275
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
64992
65276
  },
64993
65277
  async run() {
64994
- const projectRoot = getProjectRoot51();
65278
+ const projectRoot = getProjectRoot52();
64995
65279
  const reportPath = path5.join(projectRoot, CLEO_DIR_NAME3, RESTORE_CONFLICTS_MD);
64996
65280
  if (!fs3.existsSync(reportPath)) {
64997
65281
  humanLine("No pending restore conflicts. Nothing to finalize.");
@@ -65913,8 +66197,8 @@ var init_saga = __esm({
65913
66197
  }
65914
66198
  },
65915
66199
  async run({ args }) {
65916
- const { sagas: sagas2, getProjectRoot: getProjectRoot57 } = await import("@cleocode/core");
65917
- const projectRoot = getProjectRoot57();
66200
+ const { sagas: sagas2, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
66201
+ const projectRoot = getProjectRoot58();
65918
66202
  const sagaId = typeof args.sagaId === "string" && args.sagaId.length > 0 ? args.sagaId : void 0;
65919
66203
  const result = await sagas2.sagaNext(projectRoot, { sagaId });
65920
66204
  cliOutput(result.success ? result.data : result, { command: "saga", operation: "saga.next" });
@@ -67656,7 +67940,7 @@ var sequence_exports = {};
67656
67940
  __export(sequence_exports, {
67657
67941
  sequenceCommand: () => sequenceCommand
67658
67942
  });
67659
- import { getProjectRoot as getProjectRoot52 } from "@cleocode/core/internal";
67943
+ import { getProjectRoot as getProjectRoot53 } from "@cleocode/core/internal";
67660
67944
  var showCommand13, checkCommand7, repairCommand2, sequenceCommand;
67661
67945
  var init_sequence = __esm({
67662
67946
  "packages/cleo/src/cli/commands/sequence.ts"() {
@@ -67692,7 +67976,7 @@ var init_sequence = __esm({
67692
67976
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
67693
67977
  async run() {
67694
67978
  const { repairSequence } = await import("@cleocode/core/internal");
67695
- const projectRoot = getProjectRoot52();
67979
+ const projectRoot = getProjectRoot53();
67696
67980
  const repair = await repairSequence(projectRoot);
67697
67981
  const result = {
67698
67982
  repaired: repair.repaired,
@@ -68147,8 +68431,8 @@ var init_session4 = __esm({
68147
68431
  "audit-scope": { type: "string", description: "Audit log scope (global|local)" }
68148
68432
  },
68149
68433
  async run({ args }) {
68150
- const { detectSessionDrift, getProjectRoot: getProjectRoot57 } = await import("@cleocode/core");
68151
- const projectRoot = await getProjectRoot57();
68434
+ const { detectSessionDrift, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
68435
+ const projectRoot = await getProjectRoot58();
68152
68436
  const scope = args["audit-scope"] === "local" ? "local" : "global";
68153
68437
  const report = await detectSessionDrift({ projectRoot, auditScope: scope });
68154
68438
  cliOutput(report, { command: "session drift", operation: "session.drift" });
@@ -70845,13 +71129,13 @@ var init_telemetry2 = __esm({
70845
71129
  // packages/cleo/src/cli/commands/templates/lib.ts
70846
71130
  import { readFileSync as readFileSync15 } from "node:fs";
70847
71131
  import { isAbsolute as isAbsolute3, resolve as resolve8 } from "node:path";
70848
- import { getProjectRoot as getProjectRoot53 } from "@cleocode/core";
71132
+ import { getProjectRoot as getProjectRoot54 } from "@cleocode/core";
70849
71133
  import { resolveSourcePathAbsolute } from "@cleocode/core/templates/registry";
70850
71134
  function resolveProjectRoot6(raw) {
70851
71135
  if (typeof raw === "string" && raw.length > 0) {
70852
71136
  return isAbsolute3(raw) ? raw : resolve8(process.cwd(), raw);
70853
71137
  }
70854
- return getProjectRoot53();
71138
+ return getProjectRoot54();
70855
71139
  }
70856
71140
  function readTemplateSource(entry) {
70857
71141
  const sourceAbsolute = resolveSourcePathAbsolute(entry);
@@ -71635,7 +71919,7 @@ __export(token_exports, {
71635
71919
  tokenCommand: () => tokenCommand
71636
71920
  });
71637
71921
  import { readFileSync as readFileSync19 } from "node:fs";
71638
- import { getProjectRoot as getProjectRoot54, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
71922
+ import { getProjectRoot as getProjectRoot55, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
71639
71923
  function readPayload(args, textKey, fileKey) {
71640
71924
  const text = args[textKey];
71641
71925
  const file = args[fileKey];
@@ -71799,7 +72083,7 @@ var init_token = __esm({
71799
72083
  domain: args.domain,
71800
72084
  operation: args.operation
71801
72085
  };
71802
- const result = args.record ? await recordTokenExchange2(getProjectRoot54(), input2) : await measureTokenExchange(input2);
72086
+ const result = args.record ? await recordTokenExchange2(getProjectRoot55(), input2) : await measureTokenExchange(input2);
71803
72087
  cliOutput(result, {
71804
72088
  command: "token",
71805
72089
  operation: args.record ? "admin.token.record" : "token.estimate"
@@ -71835,7 +72119,7 @@ __export(transcript_exports, {
71835
72119
  });
71836
72120
  import { homedir as homedir6 } from "node:os";
71837
72121
  import { join as join34 } from "node:path";
71838
- import { getProjectRoot as getProjectRoot55 } from "@cleocode/core";
72122
+ import { getProjectRoot as getProjectRoot56 } from "@cleocode/core";
71839
72123
  import {
71840
72124
  parseDurationMs,
71841
72125
  pruneTranscripts,
@@ -71865,7 +72149,7 @@ var init_transcript = __esm({
71865
72149
  async run({ args }) {
71866
72150
  if (args.pending) {
71867
72151
  try {
71868
- const projectRoot = getProjectRoot55();
72152
+ const projectRoot = getProjectRoot56();
71869
72153
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
71870
72154
  const pending = await scanPendingTranscripts(projectRoot);
71871
72155
  cliOutput(
@@ -71962,7 +72246,7 @@ var init_transcript = __esm({
71962
72246
  async run({ args }) {
71963
72247
  const tier = args.tier ?? "warm";
71964
72248
  const dryRun = args["dry-run"] ?? false;
71965
- const projectRoot = getProjectRoot55();
72249
+ const projectRoot = getProjectRoot56();
71966
72250
  try {
71967
72251
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
71968
72252
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -72074,7 +72358,7 @@ var init_transcript = __esm({
72074
72358
  const dryRun = args["dry-run"] ?? false;
72075
72359
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
72076
72360
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
72077
- const projectRoot = getProjectRoot55();
72361
+ const projectRoot = getProjectRoot56();
72078
72362
  try {
72079
72363
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
72080
72364
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -73548,9 +73832,9 @@ var init_workgraph2 = __esm({
73548
73832
  },
73549
73833
  async run({ args }) {
73550
73834
  const { generatePlanningDoc } = await import("@cleocode/core/workgraph");
73551
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core");
73835
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
73552
73836
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
73553
- const projectRoot = getProjectRoot57();
73837
+ const projectRoot = getProjectRoot58();
73554
73838
  const audience = String(args.audience) === "agent" ? "agent" : "maintainer";
73555
73839
  const result = await generatePlanningDoc(projectRoot, {
73556
73840
  sagaId: String(args.sagaId),
@@ -73567,9 +73851,9 @@ var init_workgraph2 = __esm({
73567
73851
  async run() {
73568
73852
  const { validateWorkGraphStructure } = await import("@cleocode/core/workgraph");
73569
73853
  const { taskList: taskList2 } = await import("@cleocode/core/internal");
73570
- const { getProjectRoot: getProjectRoot57 } = await import("@cleocode/core");
73854
+ const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
73571
73855
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
73572
- const projectRoot = getProjectRoot57();
73856
+ const projectRoot = getProjectRoot58();
73573
73857
  const listResult = await taskList2(projectRoot, { limit: 5e3 });
73574
73858
  const tasks = listResult.success ? listResult.data?.tasks ?? [] : [];
73575
73859
  const nodes = tasks.map((t) => ({
@@ -73588,9 +73872,9 @@ var init_workgraph2 = __esm({
73588
73872
  description: "One-shot saga-to-saga workgraph dashboard (tracking checklist)"
73589
73873
  },
73590
73874
  async run() {
73591
- const { sagas: sagas2, getProjectRoot: getProjectRoot57 } = await import("@cleocode/core");
73875
+ const { sagas: sagas2, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
73592
73876
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
73593
- const projectRoot = getProjectRoot57();
73877
+ const projectRoot = getProjectRoot58();
73594
73878
  const listResult = await sagas2.sagaList(projectRoot);
73595
73879
  if (!listResult.success) {
73596
73880
  cliOutput2(listResult, { command: "workgraph", operation: "workgraph.status" });
@@ -73656,7 +73940,7 @@ __export(worktree_exports, {
73656
73940
  worktreeCommand: () => worktreeCommand
73657
73941
  });
73658
73942
  import readline4 from "node:readline";
73659
- import { getProjectRoot as getProjectRoot56, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
73943
+ import { getProjectRoot as getProjectRoot57, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
73660
73944
  async function promptYesNo2(question) {
73661
73945
  return new Promise((resolve11) => {
73662
73946
  const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
@@ -73761,7 +74045,7 @@ var init_worktree3 = __esm({
73761
74045
  const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
73762
74046
  const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
73763
74047
  const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
73764
- const projectRoot = getProjectRoot56();
74048
+ const projectRoot = getProjectRoot57();
73765
74049
  const listResult = await listWorktrees2({
73766
74050
  projectRoot,
73767
74051
  ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
@@ -74177,6 +74461,12 @@ var COMMAND_MANIFEST = [
74177
74461
  description: "Claim a task by assigning it to an agent",
74178
74462
  load: async () => (await Promise.resolve().then(() => (init_claim(), claim_exports))).claimCommand
74179
74463
  },
74464
+ {
74465
+ exportName: "classifyCommand",
74466
+ name: "classify",
74467
+ description: "Classify a task: readiness verdict (proceed|grill) + persona routing (agent, confidence)",
74468
+ load: async () => (await Promise.resolve().then(() => (init_classify(), classify_exports))).classifyCommand
74469
+ },
74180
74470
  {
74181
74471
  exportName: "unclaimCommand",
74182
74472
  name: "unclaim",
@@ -75359,7 +75649,7 @@ async function runStartupMaintenance() {
75359
75649
  detectAndRemoveStrayProjectNexus,
75360
75650
  getGlobalSalt,
75361
75651
  getLogger: getLogger20,
75362
- getProjectRoot: getProjectRoot57,
75652
+ getProjectRoot: getProjectRoot58,
75363
75653
  isCleanupMarkerSet,
75364
75654
  migrateSignaldockToConduit,
75365
75655
  needsSignaldockToConduitMigration,
@@ -75368,7 +75658,7 @@ async function runStartupMaintenance() {
75368
75658
  } = await import("@cleocode/core/internal");
75369
75659
  let projectRootForCleanup = "";
75370
75660
  try {
75371
- projectRootForCleanup = getProjectRoot57();
75661
+ projectRootForCleanup = getProjectRoot58();
75372
75662
  } catch {
75373
75663
  }
75374
75664
  if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
@@ -75388,7 +75678,7 @@ async function runStartupMaintenance() {
75388
75678
  const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
75389
75679
  if (!isInitInvocation) {
75390
75680
  try {
75391
- const _projectRootForMigration = getProjectRoot57();
75681
+ const _projectRootForMigration = getProjectRoot58();
75392
75682
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
75393
75683
  const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
75394
75684
  if (migrationResult.status === "failed") {