snipara-companion 3.2.6 → 3.2.8

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/README.md CHANGED
@@ -133,9 +133,10 @@ verification hints.
133
133
  Session Snapshot V0 includes latest activity, risk reasons, touched files, a
134
134
  next action, and advisory Intent Detection V0. Intent Detection V0 reports the
135
135
  inferred intent, confidence, reason-code signals, local evidence counts, and a
136
- suggested workflow mode hint for the human or agent to consider. It is
137
- observational and keeps `hardRoutingAllowed=false` until explicit routing policy
138
- and receipts exist.
136
+ suggested workflow mode. `workflow run --mode auto` uses that same Control Plane
137
+ principle to choose lite, standard, full, or orchestrate. Lite runs with zero
138
+ mandatory hosted context calls; recall/context/code-impact are on-demand
139
+ escalations, not an entry toll.
139
140
  `workflow timeline --export md` prints a compact redacted Markdown timeline for
140
141
  handoff or publication.
141
142
 
package/dist/index.d.ts CHANGED
@@ -3328,6 +3328,13 @@ interface SessionBootstrapQualityReport {
3328
3328
  total_tokens?: number;
3329
3329
  oldest_memory_age_days?: number;
3330
3330
  }
3331
+ interface SessionBootstrapBrief {
3332
+ entries: SessionMemoryEntry[];
3333
+ availableCount: number;
3334
+ hiddenCount: number;
3335
+ estimatedTokens: number;
3336
+ budgetTokens: number;
3337
+ }
3331
3338
  interface GeneratedWorkflowPlanDocument {
3332
3339
  mode: "full";
3333
3340
  goal: string;
@@ -3354,6 +3361,12 @@ declare function validatePlanResult(plan: unknown, options?: {
3354
3361
  query?: string;
3355
3362
  cwd?: string;
3356
3363
  }): PlanQualityReport;
3364
+ declare function buildSessionBootstrapBrief(result: SessionMemoriesResult, options: {
3365
+ includeSessionContext: boolean;
3366
+ maxTokens?: number;
3367
+ maxEntries?: number;
3368
+ now?: Date;
3369
+ }): SessionBootstrapBrief;
3357
3370
  declare function buildSessionBootstrapQuality(result: SessionMemoriesResult, options?: {
3358
3371
  expectedMaxTokens?: number;
3359
3372
  now?: Date;
@@ -4258,4 +4271,4 @@ declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions):
4258
4271
  declare function buildAdaptiveWorkRoutingRecommendation(options: AdaptiveWorkRoutingOptions): AdaptiveWorkRoutingRecommendation;
4259
4272
  declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff;
4260
4273
 
4261
- export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentReadinessAuditCommand, appendActivityEvent, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectRealityCheck, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProducerLoopReport, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapQuality, buildSessionSnapshot, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveAutoWorkflowMode, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };
4274
+ export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentReadinessAuditCommand, appendActivityEvent, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectRealityCheck, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProducerLoopReport, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapBrief, buildSessionBootstrapQuality, buildSessionSnapshot, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveAutoWorkflowMode, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };
package/dist/index.js CHANGED
@@ -101,6 +101,7 @@ __export(index_exports, {
101
101
  buildProjectIntelligenceBrief: () => buildProjectIntelligenceBrief,
102
102
  buildProjectIntelligenceRun: () => buildProjectIntelligenceRun,
103
103
  buildProjectJudgmentCard: () => buildProjectJudgmentCard,
104
+ buildSessionBootstrapBrief: () => buildSessionBootstrapBrief,
104
105
  buildSessionBootstrapQuality: () => buildSessionBootstrapQuality,
105
106
  buildSessionSnapshot: () => buildSessionSnapshot,
106
107
  buildSyncDocumentsDryRun: () => buildSyncDocumentsDryRun,
@@ -17096,6 +17097,124 @@ function isLikelyTestMemory(entry) {
17096
17097
  const text = readBootstrapEntryText(entry).toLowerCase();
17097
17098
  return type === "test" || category === "test" || /^test memory\b/.test(text);
17098
17099
  }
17100
+ function readBootstrapEntryId(entry) {
17101
+ return stringValue7(entry.id) ?? stringValue7(entry.memory_id) ?? `${stringValue7(entry.type) ?? "memory"}:${readBootstrapEntryText(entry).slice(0, 80)}`;
17102
+ }
17103
+ function isSessionCarryoverEntry(entry) {
17104
+ const category = typeof entry.category === "string" ? entry.category.toLowerCase() : "";
17105
+ const text = readBootstrapEntryText(entry).toLowerCase();
17106
+ return category.includes("team_sync_handoff") || category.includes("journal:") || category.includes("workflow-phase") || text.includes("checkpoint: workflow:final-commit") || text.includes("final commit") || text.includes("phase-commit") || text.includes("handoff");
17107
+ }
17108
+ function isLikelyStaleBootstrapEntry(entry, now) {
17109
+ const age = entryAgeDays(entry, now);
17110
+ const text = readBootstrapEntryText(entry).toLowerCase();
17111
+ return typeof age === "number" && age > STALE_BOOTSTRAP_MEMORY_DAYS || typeof entry.confidence === "number" && entry.confidence < 0.5 || text.includes("/users/alopez/devs/snipara/.env") || text.includes("rlm_remember") || text.includes("rlm_recall") || text.includes("railway") || text.includes("vercel") || text.includes("memory injection feature is complete") || text.includes("infotooltip component created") || text.includes("mcp performance optimizations (jan 2026)");
17112
+ }
17113
+ function scoreBootstrapBriefEntry(entry, source2, now) {
17114
+ let score = source2 === "daily" ? 100 : 0;
17115
+ const age = entryAgeDays(entry, now);
17116
+ const type = typeof entry.type === "string" ? entry.type.toLowerCase() : "";
17117
+ const category = typeof entry.category === "string" ? entry.category.toLowerCase() : "";
17118
+ const text = readBootstrapEntryText(entry).toLowerCase();
17119
+ if (isSessionCarryoverEntry(entry)) {
17120
+ score += 90;
17121
+ }
17122
+ if (type === "decision") {
17123
+ score += 25;
17124
+ } else if (type === "context") {
17125
+ score += 20;
17126
+ } else if (type === "learning") {
17127
+ score += 10;
17128
+ }
17129
+ if (category.includes("journal:") || category.includes("workflow-phase")) {
17130
+ score += 40;
17131
+ }
17132
+ if (category.includes("team_sync_handoff")) {
17133
+ score += 55;
17134
+ }
17135
+ if (text.includes("control plane") || text.includes("control-plane") || text.includes("lite")) {
17136
+ score += 35;
17137
+ }
17138
+ if (text.includes("published") || text.includes("deployed") || text.includes("data-dpl-id")) {
17139
+ score += 25;
17140
+ }
17141
+ if (typeof entry.confidence === "number") {
17142
+ score += Math.max(0, Math.min(25, entry.confidence * 25));
17143
+ if (entry.confidence < 0.5) {
17144
+ score -= 90;
17145
+ }
17146
+ }
17147
+ if (typeof age === "number") {
17148
+ if (age <= 1) {
17149
+ score += 65;
17150
+ } else if (age <= 7) {
17151
+ score += 45;
17152
+ } else if (age <= 30) {
17153
+ score += 20;
17154
+ } else if (age > STALE_BOOTSTRAP_MEMORY_DAYS) {
17155
+ score -= 100;
17156
+ }
17157
+ }
17158
+ if (isLikelyTestMemory(entry)) {
17159
+ score -= 120;
17160
+ }
17161
+ if (isLikelyStaleBootstrapEntry(entry, now)) {
17162
+ score -= 80;
17163
+ }
17164
+ return score;
17165
+ }
17166
+ function estimateBootstrapEntryTokens(entry) {
17167
+ return Math.max(8, Math.ceil(compactSessionEntryLine(entry).length / 4));
17168
+ }
17169
+ function buildSessionBootstrapBrief(result, options) {
17170
+ const normalized = normalizeSessionMemoriesResult(result);
17171
+ const now = options.now ?? /* @__PURE__ */ new Date();
17172
+ const maxEntries = Math.max(1, Math.min(options.maxEntries ?? 4, 5));
17173
+ const budgetTokens = normalizePositiveTokenBudget(options.maxTokens, 600, true);
17174
+ const candidates = [
17175
+ ...normalized.critical.memories.map((entry) => ({ entry, source: "critical" })),
17176
+ ...options.includeSessionContext ? normalized.daily.memories.map((entry) => ({ entry, source: "daily" })) : []
17177
+ ];
17178
+ const seen = /* @__PURE__ */ new Set();
17179
+ const ranked = candidates.map((candidate, index) => ({
17180
+ ...candidate,
17181
+ index,
17182
+ score: scoreBootstrapBriefEntry(candidate.entry, candidate.source, now)
17183
+ })).sort((a, b) => b.score - a.score || b.index - a.index);
17184
+ const hasFreshCandidate = ranked.some(
17185
+ (candidate) => candidate.score > 0 && !isLikelyStaleBootstrapEntry(candidate.entry, now) && !isLikelyTestMemory(candidate.entry)
17186
+ );
17187
+ const entries = [];
17188
+ let estimatedTokens = 0;
17189
+ for (const candidate of ranked) {
17190
+ if (hasFreshCandidate && (isLikelyStaleBootstrapEntry(candidate.entry, now) || isLikelyTestMemory(candidate.entry))) {
17191
+ continue;
17192
+ }
17193
+ const id = readBootstrapEntryId(candidate.entry);
17194
+ const textKey = readBootstrapEntryText(candidate.entry).slice(0, 140).toLowerCase();
17195
+ const key = id || textKey;
17196
+ if (seen.has(key)) {
17197
+ continue;
17198
+ }
17199
+ seen.add(key);
17200
+ const entryTokens = estimateBootstrapEntryTokens(candidate.entry);
17201
+ if (entries.length > 0 && estimatedTokens + entryTokens > budgetTokens) {
17202
+ continue;
17203
+ }
17204
+ entries.push(candidate.entry);
17205
+ estimatedTokens += entryTokens;
17206
+ if (entries.length >= maxEntries) {
17207
+ break;
17208
+ }
17209
+ }
17210
+ return {
17211
+ entries,
17212
+ availableCount: candidates.length,
17213
+ hiddenCount: Math.max(0, candidates.length - entries.length),
17214
+ estimatedTokens,
17215
+ budgetTokens
17216
+ };
17217
+ }
17099
17218
  function buildSessionBootstrapQuality(result, options = {}) {
17100
17219
  const normalized = normalizeSessionMemoriesResult(result);
17101
17220
  const now = options.now ?? /* @__PURE__ */ new Date();
@@ -18886,11 +19005,23 @@ function resolveAutoWorkflowMode(query) {
18886
19005
  )) {
18887
19006
  return "full";
18888
19007
  }
19008
+ if (/\b(why|pourquoi|decision|décision|rationale|positioning|positionnement|strategy|stratégie|cross-session|previous decision|prior decision|historical context)\b/.test(
19009
+ normalized
19010
+ )) {
19011
+ return "standard";
19012
+ }
18889
19013
  if (/\b(status|show|list|read|lookup|recall|brief|summarize|summary|what changed|question|docs?|documentation)\b/.test(
18890
19014
  normalized
18891
19015
  ) && !/\b(implement|change|fix|ship|code|refactor|test|write|create|build)\b/.test(normalized)) {
18892
19016
  return "lite";
18893
19017
  }
19018
+ if (/\b(typo|copy edit|small diff|tiny diff|one-line|one line|known file|obvious fix|quick fix|format|formatting|rename)\b/.test(
19019
+ normalized
19020
+ ) && !/\b(architecture|release|deploy|migration|schema|auth|billing|security|multi-file|many files|5\+ files|cross-session|decision|décision)\b/.test(
19021
+ normalized
19022
+ )) {
19023
+ return "lite";
19024
+ }
18894
19025
  return "standard";
18895
19026
  }
18896
19027
  function effectiveWorkflowMode(mode, query = "") {
@@ -18939,14 +19070,15 @@ function safeDecisionPendingCount() {
18939
19070
  function printManagedWorkflowDiscipline() {
18940
19071
  console.log(import_chalk6.default.bold("Coding workflow mode"));
18941
19072
  console.log(
18942
- "- LITE: small single-phase edits still start with Snipara recall/context and end with local verification."
19073
+ "- LITE: small single-phase edits have no mandatory Snipara calls; use local verification and escalate on demand."
18943
19074
  );
18944
19075
  console.log(
18945
- "- STANDARD: normal coding work uses context plus recommended code-graph follow-up; --mode auto deterministically selects lite/standard/full/orchestrate from task intent."
19076
+ "- STANDARD: normal coding work uses context or code graph when the task needs source truth or prior rationale."
18946
19077
  );
18947
19078
  console.log(
18948
19079
  "- FULL: use this managed workflow with phases/chunks for multi-file, risky, release/deploy, architectural, or compaction-prone coding work."
18949
19080
  );
19081
+ console.log("- --mode auto routes by task intent; a nudge is advisory, not a gate.");
18950
19082
  console.log(
18951
19083
  "- FULL + ORCHESTRATED: use explicit snipara-orchestrator handoff only for production gates, drift checks, htasks, or multi-agent coordination."
18952
19084
  );
@@ -20026,6 +20158,17 @@ function printRuntimeHint(query, mode) {
20026
20158
  console.log("Fresh setup: npx create-snipara --profile full-stack --advanced");
20027
20159
  console.log("Manual install: pip install 'snipara-sandbox[all]'");
20028
20160
  }
20161
+ function printLiteWorkflowRun(query, requestedMode) {
20162
+ console.log(import_chalk6.default.bold("Workflow Lite"));
20163
+ printKeyValue2("Requested mode:", requestedMode);
20164
+ printKeyValue2("Effective mode:", "lite");
20165
+ printKeyValue2("Task:", query);
20166
+ console.log("No Snipara recall, context query, or bootstrap call was run.");
20167
+ console.log(
20168
+ "Escalate with recall, context_query, code impact, or task-commit only when the task creates that need."
20169
+ );
20170
+ console.log("");
20171
+ }
20029
20172
  function runtimeHintVersionLabel(report) {
20030
20173
  if (!report.runtime.cliVersion) {
20031
20174
  return report.runtime.version ? ` (${report.runtime.version})` : "";
@@ -20720,39 +20863,65 @@ function printChunkResult(chunkId, result) {
20720
20863
  printJson2(result);
20721
20864
  }
20722
20865
  function readSessionEntryPreview(entry) {
20866
+ for (const value of [entry.summary, entry.text, entry.content, entry.title]) {
20867
+ if (typeof value !== "string") {
20868
+ continue;
20869
+ }
20870
+ const trimmed = value.trim();
20871
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
20872
+ try {
20873
+ const parsed = JSON.parse(trimmed);
20874
+ if (isRecord9(parsed)) {
20875
+ const summary = stringValue7(parsed.summary);
20876
+ const nextStep = stringValue7(parsed.nextStep);
20877
+ const task = stringValue7(parsed.task);
20878
+ const readable = [summary, nextStep ? `Next: ${nextStep}` : void 0, task].filter((item) => Boolean(item)).join(" ");
20879
+ if (readable.length > 0) {
20880
+ return toPreview(readable, 220);
20881
+ }
20882
+ }
20883
+ } catch {
20884
+ }
20885
+ }
20886
+ if (trimmed.length > 0) {
20887
+ return toPreview(trimmed, 220);
20888
+ }
20889
+ }
20723
20890
  return toPreview(entry.text ?? entry.content ?? entry.summary ?? entry.title, 220);
20724
20891
  }
20725
- function printSessionTier(label, tier) {
20726
- if (tier.memories.length === 0) {
20727
- return;
20728
- }
20729
- console.log(import_chalk6.default.bold(label));
20730
- for (const entry of tier.memories.slice(0, 5)) {
20731
- console.log(`- ${readSessionEntryPreview(entry)}`);
20732
- }
20733
- console.log("");
20892
+ function compactSessionEntryLine(entry) {
20893
+ const label = typeof entry.type === "string" && entry.type.trim().length > 0 ? entry.type.trim() : typeof entry.category === "string" && entry.category.trim().length > 0 ? entry.category.trim() : "memory";
20894
+ return `- ${label}: ${readSessionEntryPreview(entry)}`;
20734
20895
  }
20735
20896
  function printSessionBootstrap(result, options) {
20736
- const normalized = normalizeSessionMemoriesResult(result);
20737
- printKeyValue2("Durable memory:", normalized.critical.count);
20738
- printKeyValue2(
20739
- "Session context:",
20740
- options.includeSessionContext ? normalized.daily.count : "skipped by default (use --include-session-context)"
20741
- );
20742
- if (typeof normalized.total_tokens === "number") {
20743
- printKeyValue2("Tokens:", normalized.total_tokens);
20897
+ const brief = buildSessionBootstrapBrief(result, {
20898
+ includeSessionContext: options.includeSessionContext,
20899
+ maxTokens: options.maxTokens
20900
+ });
20901
+ const entries = brief.entries;
20902
+ if (entries.length === 0) {
20903
+ return null;
20744
20904
  }
20745
- if (typeof normalized.message === "string" && normalized.message.length > 0) {
20746
- printKeyValue2("Message:", normalized.message);
20905
+ console.log(import_chalk6.default.bold("Snipara Bootstrap Brief"));
20906
+ for (const entry of entries) {
20907
+ console.log(compactSessionEntryLine(entry));
20747
20908
  }
20748
20909
  console.log("");
20749
- printSessionTier("Durable Memory", normalized.critical);
20750
- if (options.includeSessionContext) {
20751
- printSessionTier("Session Context (weak carryover)", normalized.daily);
20752
- }
20753
- if (normalized.critical.count === 0 && normalized.daily.count === 0) {
20754
- printJson2(normalized);
20755
- }
20910
+ return brief;
20911
+ }
20912
+ function buildPrintedBootstrapQuality(brief, now) {
20913
+ return buildSessionBootstrapQuality(
20914
+ {
20915
+ critical: {
20916
+ memories: brief.entries,
20917
+ count: brief.entries.length,
20918
+ tokens: brief.estimatedTokens
20919
+ },
20920
+ daily: { memories: [], count: 0, tokens: 0 },
20921
+ total_tokens: brief.estimatedTokens
20922
+ },
20923
+ { expectedMaxTokens: brief.budgetTokens, now }
20924
+ );
20756
20925
  }
20757
20926
  function printSessionBootstrapQuality(report) {
20758
20927
  if (report.warnings.length === 0) {
@@ -22039,10 +22208,11 @@ async function sharedContextCommand(options) {
22039
22208
  }
22040
22209
  async function workflowRunCommand(options) {
22041
22210
  const hostedConfigured = isConfigured();
22211
+ const effectiveMode = effectiveWorkflowMode(options.mode, options.query);
22042
22212
  const localAdaptiveRoutingPolicy = readLocalAdaptiveRoutingProjectPolicy();
22043
22213
  const localAdaptiveRoutingRequested = shouldBuildAdaptiveRouting(options);
22044
- const canRunLocalAdaptiveRouting = !hostedConfigured && options.mode !== "orchestrate" && (localAdaptiveRoutingRequested || localAdaptiveRoutingPolicy !== null && localAdaptiveRoutingPolicy.mode !== "off");
22045
- if (!hostedConfigured && !canRunLocalAdaptiveRouting) {
22214
+ const canRunLocalAdaptiveRouting = !hostedConfigured && effectiveMode !== "orchestrate" && (localAdaptiveRoutingRequested || localAdaptiveRoutingPolicy !== null && localAdaptiveRoutingPolicy.mode !== "off");
22215
+ if (!hostedConfigured && !canRunLocalAdaptiveRouting && effectiveMode !== "lite") {
22046
22216
  ensureConfigured();
22047
22217
  }
22048
22218
  const client = hostedConfigured ? createClient(2e4) : null;
@@ -22068,7 +22238,6 @@ async function workflowRunCommand(options) {
22068
22238
  routingOptions,
22069
22239
  adaptiveRoutingWithCatalog
22070
22240
  ) ? enrichAdaptiveRoutingWithLocalOrchestrator(adaptiveRoutingWithCatalog, routingOptions) : adaptiveRoutingWithCatalog;
22071
- const effectiveMode = effectiveWorkflowMode(options.mode, options.query);
22072
22241
  const orchestratorRecommendation = getOrchestratorRecommendation(options.query, effectiveMode, {
22073
22242
  policyAutoRoute: options.autoRouteOrchestrator,
22074
22243
  policySource: options.orchestratorPolicySource,
@@ -22090,11 +22259,16 @@ async function workflowRunCommand(options) {
22090
22259
  effective_mode: effectiveMode,
22091
22260
  local_only: true,
22092
22261
  local_policy_path: localAdaptiveRoutingPolicy ? ADAPTIVE_ROUTING_POLICY_RELATIVE_PATH2 : null,
22262
+ retrieval_policy: effectiveMode === "lite" ? {
22263
+ mandatory_calls: [],
22264
+ escalation: "Run recall, context_query, or code impact only when the task needs them.",
22265
+ persistence: "Use task-commit only when reusable durable knowledge was learned."
22266
+ } : void 0,
22093
22267
  orchestrator_recommendation: orchestratorRecommendation,
22094
22268
  orchestrator_handoff: preparedHandoff,
22095
22269
  adaptive_routing: adaptiveRouting,
22096
22270
  local_worker: localWorkerRoutingDefaults?.worker,
22097
- warnings: [
22271
+ warnings: effectiveMode === "lite" ? [] : [
22098
22272
  "Hosted Snipara is not configured; workflow run is limited to local Adaptive Work Routing metadata."
22099
22273
  ]
22100
22274
  };
@@ -22102,10 +22276,44 @@ async function workflowRunCommand(options) {
22102
22276
  printJson2(payload2);
22103
22277
  return;
22104
22278
  }
22105
- console.log(import_chalk6.default.bold("Local Adaptive Work Routing"));
22106
- console.log(
22107
- "Hosted Snipara is not configured; no context query, hosted catalog, or planner call ran."
22108
- );
22279
+ if (effectiveMode === "lite") {
22280
+ printLiteWorkflowRun(options.query, options.mode);
22281
+ } else {
22282
+ console.log(import_chalk6.default.bold("Local Adaptive Work Routing"));
22283
+ console.log(
22284
+ "Hosted Snipara is not configured; no context query, hosted catalog, or planner call ran."
22285
+ );
22286
+ }
22287
+ if (adaptiveRouting) {
22288
+ printAdaptiveRoutingRecommendation(adaptiveRouting);
22289
+ }
22290
+ if (preparedHandoff) {
22291
+ printPreparedOrchestratorHandoff2(preparedHandoff);
22292
+ }
22293
+ return;
22294
+ }
22295
+ if (effectiveMode === "lite") {
22296
+ const payload2 = {
22297
+ mode: options.mode,
22298
+ effective_mode: effectiveMode,
22299
+ retrieval_policy: {
22300
+ mandatory_calls: [],
22301
+ escalation: "Run recall, context_query, or code impact only when the task needs them.",
22302
+ persistence: "Use task-commit only when reusable durable knowledge was learned."
22303
+ },
22304
+ orchestrator_recommendation: orchestratorRecommendation,
22305
+ orchestrator_handoff: preparedHandoff,
22306
+ adaptive_routing: adaptiveRouting,
22307
+ local_worker: localWorkerRoutingDefaults?.worker
22308
+ };
22309
+ if (options.json) {
22310
+ printJson2(payload2);
22311
+ return;
22312
+ }
22313
+ printLiteWorkflowRun(options.query, options.mode);
22314
+ if (options.runtimeHint !== false) {
22315
+ printRuntimeHint(options.query, effectiveMode);
22316
+ }
22109
22317
  if (adaptiveRouting) {
22110
22318
  printAdaptiveRoutingRecommendation(adaptiveRouting);
22111
22319
  }
@@ -22231,14 +22439,15 @@ async function workflowRunCommand(options) {
22231
22439
  return;
22232
22440
  }
22233
22441
  if (effectiveMode === "full" && payload.session_bootstrap) {
22234
- console.log(import_chalk6.default.bold("Workflow Bootstrap"));
22235
- printSessionBootstrap(payload.session_bootstrap, {
22236
- includeSessionContext: Boolean(workflowBudget?.include_session_context)
22237
- });
22238
- if (payload.session_bootstrap_quality && typeof payload.session_bootstrap_quality === "object") {
22239
- printSessionBootstrapQuality(
22240
- payload.session_bootstrap_quality
22241
- );
22442
+ const printedBootstrap = printSessionBootstrap(
22443
+ payload.session_bootstrap,
22444
+ {
22445
+ includeSessionContext: Boolean(workflowBudget?.include_session_context),
22446
+ maxTokens: (workflowBudget?.allocations.critical_memory_tokens ?? DEFAULT_FULL_WORKFLOW_CRITICAL_TOKENS) + (workflowBudget?.allocations.session_context_tokens ?? 0)
22447
+ }
22448
+ );
22449
+ if (printedBootstrap && payload.session_bootstrap_quality && typeof payload.session_bootstrap_quality === "object") {
22450
+ printSessionBootstrapQuality(buildPrintedBootstrapQuality(printedBootstrap));
22242
22451
  }
22243
22452
  if (workflowBudget?.warnings.length) {
22244
22453
  console.log(import_chalk6.default.bold("Workflow Budget Warnings"));
@@ -23181,10 +23390,13 @@ async function workflowResumeCommand(options) {
23181
23390
  }
23182
23391
  console.log(import_chalk6.default.bold("Workflow Resume"));
23183
23392
  printManagedWorkflowState(state);
23184
- printSessionBootstrap(bootstrap, {
23185
- includeSessionContext: resolvedContextTokens > 0
23393
+ const printedBootstrap = printSessionBootstrap(bootstrap, {
23394
+ includeSessionContext: resolvedContextTokens > 0,
23395
+ maxTokens: resolvedCriticalTokens + resolvedContextTokens
23186
23396
  });
23187
- printSessionBootstrapQuality(bootstrapQuality);
23397
+ if (printedBootstrap) {
23398
+ printSessionBootstrapQuality(buildPrintedBootstrapQuality(printedBootstrap));
23399
+ }
23188
23400
  printWorkflowLocalSessionSnapshot(localSessionSnapshot);
23189
23401
  printWorkflowTeamSyncResume(teamSyncResume);
23190
23402
  printWorkflowRuntimeResumePlan(runtimeResume);
@@ -23706,16 +23918,12 @@ async function sessionBootstrapCommand(options) {
23706
23918
  });
23707
23919
  return;
23708
23920
  }
23709
- printSessionBootstrap(result, {
23710
- includeSessionContext: resolvedContextTokens > 0
23921
+ const printedBootstrap = printSessionBootstrap(result, {
23922
+ includeSessionContext: resolvedContextTokens > 0,
23923
+ maxTokens: (options.maxCriticalTokens ?? DEFAULT_FULL_WORKFLOW_CRITICAL_TOKENS) + resolvedContextTokens
23711
23924
  });
23712
- printSessionBootstrapQuality(bootstrapQuality);
23713
- if (warmSnapshot.storedEntries > 0) {
23714
- printKeyValue2(
23715
- "Warm cache:",
23716
- `${warmSnapshot.storedEntries} bootstrap memory/context entries primed locally`
23717
- );
23718
- console.log("");
23925
+ if (printedBootstrap) {
23926
+ printSessionBootstrapQuality(buildPrintedBootstrapQuality(printedBootstrap));
23719
23927
  }
23720
23928
  }
23721
23929
  async function recallCommand(options) {
@@ -33720,6 +33928,7 @@ if (require.main === module) {
33720
33928
  buildProjectIntelligenceBrief,
33721
33929
  buildProjectIntelligenceRun,
33722
33930
  buildProjectJudgmentCard,
33931
+ buildSessionBootstrapBrief,
33723
33932
  buildSessionBootstrapQuality,
33724
33933
  buildSessionSnapshot,
33725
33934
  buildSyncDocumentsDryRun,
@@ -930,7 +930,9 @@ without an extra LLM provider key because your AI client supplies the reasoning;
930
930
  runtime-bound phases it also restores the recorded Sandbox binding and prints a reattach or
931
931
  rehydrate plan. It does not snapshot or exactly restore a live Snipara Sandbox or REPL process.
932
932
  Short-lived session context is skipped unless you pass `--include-session-context`
933
- or an explicit `--max-context-tokens`; durable memory still loads by default.
933
+ or an explicit `--max-context-tokens`. Text output is a compact bootstrap brief
934
+ and is silent when no high-signal item is available; use `--json` for the full
935
+ payload.
934
936
  `workflow run --mode full --json` also reports `workflow_budget`,
935
937
  `session_bootstrap_quality`, and `plan_quality.warnings` so agents can detect
936
938
  oversized bootstrap context or weak generated-plan file hints before editing.
@@ -1121,16 +1123,16 @@ snipara-companion workflow scaffold \
1121
1123
  ### Context vs Memory
1122
1124
 
1123
1125
  - Use `snipara-companion query`, `shared-context`, and `load-document` for source truth.
1124
- - Use `snipara-companion recall`, `session-bootstrap`, and `task-commit` for durable memory.
1126
+ - Use `snipara-companion recall`, `session-bootstrap`, and `task-commit` for durable memory when the task needs it.
1125
1127
  - Do not use memory as a substitute for document retrieval.
1126
1128
  - Do not upload specs or raw documents into memory.
1127
1129
 
1128
1130
  Semantics:
1129
1131
 
1130
1132
  - `snipara-companion query --follow-recommendation` = execute the hosted recommended structural tool instead of only printing it
1131
- - `snipara-companion workflow run --mode lite` = focused context query for small known-file work
1133
+ - `snipara-companion workflow run --mode lite` = zero mandatory hosted calls for small known-file work
1132
1134
  - `snipara-companion workflow run --mode standard` = context query plus automatic `snipara_code_*` follow-up when Snipara recommends one
1133
- - `snipara-companion workflow run --mode auto` = compatibility alias for STANDARD behavior
1135
+ - `snipara-companion workflow run --mode auto` = routes to lite, standard, full, or orchestrate from task intent
1134
1136
  - `snipara-companion workflow run --mode full` = budgeted durable bootstrap + optional session context + context query + automatic structural follow-up + hosted plan with quality diagnostics
1135
1137
  - `snipara-companion plan --write-plan-file ./plan.json` = convert hosted `snipara_plan` output into managed workflow JSON
1136
1138
  - `snipara-companion plan --start-workflow` or `workflow run --mode full --start-workflow-from-plan` = create local `.snipara/workflow/current.json` from a valid generated plan
@@ -1193,13 +1195,15 @@ Semantics:
1193
1195
  - `snipara-companion reindex` = trigger or poll hosted `snipara_reindex`; use after uploads when immediate chunk availability matters
1194
1196
  - `snipara-companion code *` = direct access to the code graph tools without routing through `snipara_context_query`
1195
1197
  - `snipara-companion recall` = direct durable memory lookup for decisions, learnings, preferences, and carryover
1196
- - `snipara-companion session-bootstrap` = durable memory first, optional weak session carryover second
1198
+ - `snipara-companion session-bootstrap` = pushed compact brief of durable memory first, optional weak session carryover second; empty brief is silent in text mode
1197
1199
  - `snipara-companion task-commit` = durable task/phase/workflow outcomes only, not a mechanical mirror of every Git commit
1198
- - `snipara-companion memory-guard check` = forced memory/context recall before retries, commits, or finalization when a command failed or a publishable package surface is touched
1200
+ - `snipara-companion memory-guard check` = deterministic guard recall/context before retries, commits, or finalization when a command failed or a publishable package surface is touched
1199
1201
  - `snipara-companion memory-guard check --intent "<action>" --destructive --strict` = contradiction check before irreversible actions; blocks until the user explicitly confirms when memory/context disagrees or the action is destructive
1200
1202
  - `snipara-companion memory-guard remember --guard-tag pre-commit --text "..."` = create a project/team memory in a guard category such as `pre-commit`, `commit`, `failure`, `pre-final`, or `workflow-policy`
1201
1203
  - `--max-daily-tokens` is still accepted as a compatibility alias for `--max-context-tokens`
1202
1204
 
1205
+ Use Outcome Loop data to calibrate these defaults: for small tasks, compare whether entry recall/context actually preceded retained commits before promoting a nudge into a gate.
1206
+
1203
1207
  ### Memory Guard Before Commit Or Destructive Actions
1204
1208
 
1205
1209
  Memory Guard is deterministic, not a user preference. It detects two global signals:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snipara-companion",
3
- "version": "3.2.6",
3
+ "version": "3.2.8",
4
4
  "description": "Local-first CLI that asks your repo what breaks before an AI coding agent edits it.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {