@a-company/paradigm 5.9.1 → 5.11.0

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.
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../paradigm-mcp/src/utils/agent-state.ts
4
+ import * as fs from "fs";
5
+ import * as path from "path";
6
+ import * as os from "os";
7
+ import * as yaml from "js-yaml";
8
+ var PROJECT_STATE_DIR = ".paradigm/agent-state";
9
+ var GLOBAL_AGENTS_DIR = path.join(os.homedir(), ".paradigm", "agents");
10
+ function loadAgentState(agentId, rootDir) {
11
+ const statePath = path.join(rootDir, PROJECT_STATE_DIR, `${agentId}.yaml`);
12
+ if (!fs.existsSync(statePath)) return null;
13
+ try {
14
+ const content = fs.readFileSync(statePath, "utf8");
15
+ return yaml.load(content);
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+ function saveAgentState(agentId, rootDir, state) {
21
+ const stateDir = path.join(rootDir, PROJECT_STATE_DIR);
22
+ if (!fs.existsSync(stateDir)) {
23
+ fs.mkdirSync(stateDir, { recursive: true });
24
+ }
25
+ const statePath = path.join(stateDir, `${agentId}.yaml`);
26
+ fs.writeFileSync(statePath, yaml.dump(state, { lineWidth: 120, noRefs: true, sortKeys: false }), "utf8");
27
+ }
28
+ function recordAgentSession(agentId, rootDir, session) {
29
+ const existing = loadAgentState(agentId, rootDir);
30
+ const projectName = path.basename(rootDir);
31
+ const state = {
32
+ id: agentId,
33
+ project: projectName,
34
+ lastSession: {
35
+ date: (/* @__PURE__ */ new Date()).toISOString(),
36
+ sessionId: session.sessionId,
37
+ summary: session.summary,
38
+ filesReviewed: session.filesReviewed,
39
+ symbolsTouched: session.symbolsTouched,
40
+ decisions: session.decisions
41
+ },
42
+ pendingWork: session.pendingWork || existing?.pendingWork || [],
43
+ recentPatterns: session.patterns || existing?.recentPatterns || [],
44
+ sessionsOnProject: (existing?.sessionsOnProject || 0) + 1,
45
+ lastPurposeUpdate: existing?.lastPurposeUpdate
46
+ };
47
+ saveAgentState(agentId, rootDir, state);
48
+ updateGlobalAgentState(agentId, projectName);
49
+ return state;
50
+ }
51
+ function addPendingWork(agentId, rootDir, items) {
52
+ const state = loadAgentState(agentId, rootDir);
53
+ if (!state) return;
54
+ state.pendingWork = [.../* @__PURE__ */ new Set([...state.pendingWork, ...items])];
55
+ saveAgentState(agentId, rootDir, state);
56
+ }
57
+ function completePendingWork(agentId, rootDir, completedItems) {
58
+ const state = loadAgentState(agentId, rootDir);
59
+ if (!state) return;
60
+ const completedSet = new Set(completedItems.map((i) => i.toLowerCase()));
61
+ state.pendingWork = state.pendingWork.filter((item) => !completedSet.has(item.toLowerCase()));
62
+ saveAgentState(agentId, rootDir, state);
63
+ }
64
+ function addProjectPattern(agentId, rootDir, pattern) {
65
+ const state = loadAgentState(agentId, rootDir);
66
+ if (!state) return;
67
+ if (!state.recentPatterns.includes(pattern)) {
68
+ state.recentPatterns.push(pattern);
69
+ if (state.recentPatterns.length > 10) {
70
+ state.recentPatterns = state.recentPatterns.slice(-10);
71
+ }
72
+ saveAgentState(agentId, rootDir, state);
73
+ }
74
+ }
75
+ function loadGlobalAgentState(agentId) {
76
+ const statePath = path.join(GLOBAL_AGENTS_DIR, agentId, "state.yaml");
77
+ if (!fs.existsSync(statePath)) return null;
78
+ try {
79
+ const content = fs.readFileSync(statePath, "utf8");
80
+ return yaml.load(content);
81
+ } catch {
82
+ return null;
83
+ }
84
+ }
85
+ function updateGlobalAgentState(agentId, projectName) {
86
+ const stateDir = path.join(GLOBAL_AGENTS_DIR, agentId);
87
+ if (!fs.existsSync(stateDir)) {
88
+ fs.mkdirSync(stateDir, { recursive: true });
89
+ }
90
+ const statePath = path.join(stateDir, "state.yaml");
91
+ const existing = loadGlobalAgentState(agentId);
92
+ const now = (/* @__PURE__ */ new Date()).toISOString();
93
+ const history = existing?.projectHistory || [];
94
+ const projectEntry = history.find((h) => h.project === projectName);
95
+ if (projectEntry) {
96
+ projectEntry.sessions += 1;
97
+ projectEntry.lastActive = now;
98
+ } else {
99
+ history.push({ project: projectName, sessions: 1, lastActive: now });
100
+ }
101
+ history.sort((a, b) => b.lastActive.localeCompare(a.lastActive));
102
+ const state = {
103
+ id: agentId,
104
+ totalSessions: (existing?.totalSessions || 0) + 1,
105
+ lastActiveProject: projectName,
106
+ lastActiveDate: now,
107
+ projectHistory: history
108
+ };
109
+ fs.writeFileSync(statePath, yaml.dump(state, { lineWidth: 120, noRefs: true, sortKeys: false }), "utf8");
110
+ }
111
+ function loadAllAgentStates(rootDir) {
112
+ const stateDir = path.join(rootDir, PROJECT_STATE_DIR);
113
+ if (!fs.existsSync(stateDir)) return [];
114
+ try {
115
+ return fs.readdirSync(stateDir).filter((f) => f.endsWith(".yaml")).map((f) => {
116
+ try {
117
+ const content = fs.readFileSync(path.join(stateDir, f), "utf8");
118
+ return yaml.load(content);
119
+ } catch {
120
+ return null;
121
+ }
122
+ }).filter(Boolean);
123
+ } catch {
124
+ return [];
125
+ }
126
+ }
127
+
128
+ export {
129
+ loadAgentState,
130
+ saveAgentState,
131
+ recordAgentSession,
132
+ addPendingWork,
133
+ completePendingWork,
134
+ addProjectPattern,
135
+ loadGlobalAgentState,
136
+ updateGlobalAgentState,
137
+ loadAllAgentStates
138
+ };
@@ -30,6 +30,29 @@ function appendSessionWorkEntry(rootDir, entry) {
30
30
  }
31
31
  const line = JSON.stringify(entry) + "\n";
32
32
  fs.appendFileSync(filePath, line, "utf8");
33
+ if (entry.type === "user-verdict" && entry.agent && entry.symbols?.length) {
34
+ import("./agent-loader-TFIANSF4.js").then(({ loadAgentProfile, saveAgentProfile }) => {
35
+ try {
36
+ const profile = loadAgentProfile(rootDir, entry.agent);
37
+ if (profile?.expertise) {
38
+ const delta = entry.verdict === "accepted" ? 0.03 : entry.verdict === "dismissed" ? -0.02 : entry.verdict === "revised" ? -0.01 : 0;
39
+ if (delta !== 0) {
40
+ for (const symbol of entry.symbols) {
41
+ const exp = profile.expertise.find((e) => e.symbol === symbol);
42
+ if (exp) {
43
+ exp.confidence = Math.max(0, Math.min(1, exp.confidence + delta));
44
+ exp.sessions = (exp.sessions || 0) + 1;
45
+ exp.lastTouch = (/* @__PURE__ */ new Date()).toISOString();
46
+ }
47
+ }
48
+ saveAgentProfile(entry.agent, profile, "global");
49
+ }
50
+ }
51
+ } catch {
52
+ }
53
+ }).catch(() => {
54
+ });
55
+ }
33
56
  } catch {
34
57
  }
35
58
  }
@@ -267,7 +267,7 @@ function mergeAgentProfileWithManifest(agentDef, profile, projectName) {
267
267
  transferablePatterns: (profile.transferable || []).filter((p) => p.successRate >= 0.7).map((p) => ({ id: p.id, description: p.description, successRate: p.successRate }))
268
268
  };
269
269
  }
270
- function buildProfileEnrichment(profile, relevantSymbols, notebookEntries, ambientContext) {
270
+ function buildProfileEnrichment(profile, relevantSymbols, notebookEntries, ambientContext, agentState) {
271
271
  const parts = [];
272
272
  if (profile.personality) {
273
273
  const p = profile.personality;
@@ -304,6 +304,32 @@ function buildProfileEnrichment(profile, relevantSymbols, notebookEntries, ambie
304
304
  parts.push("");
305
305
  }
306
306
  }
307
+ if (agentState) {
308
+ parts.push("");
309
+ parts.push("## Your Recent Work on This Project");
310
+ if (agentState.lastSession) {
311
+ const ageMs = Date.now() - new Date(agentState.lastSession.date).getTime();
312
+ const ageHours = Math.floor(ageMs / (60 * 60 * 1e3));
313
+ const ageStr = ageHours < 24 ? `${ageHours}h ago` : `${Math.floor(ageHours / 24)}d ago`;
314
+ parts.push(`Last session (${ageStr}): ${agentState.lastSession.summary}`);
315
+ }
316
+ if (agentState.sessionsOnProject) {
317
+ parts.push(`Sessions on this project: ${agentState.sessionsOnProject}`);
318
+ }
319
+ if (agentState.pendingWork?.length) {
320
+ parts.push("**Pending from last session:**");
321
+ for (const item of agentState.pendingWork.slice(0, 5)) {
322
+ parts.push(`- ${item}`);
323
+ }
324
+ }
325
+ if (agentState.recentPatterns?.length) {
326
+ parts.push("**Project patterns you've learned:**");
327
+ for (const pattern of agentState.recentPatterns.slice(0, 5)) {
328
+ parts.push(`- ${pattern}`);
329
+ }
330
+ }
331
+ parts.push("");
332
+ }
307
333
  if (profile.attention) {
308
334
  const att = profile.attention;
309
335
  const attParts = [];
@@ -4,7 +4,7 @@ import {
4
4
  loadAgentProfile,
5
5
  loadAllAgentProfiles,
6
6
  saveAgentProfile
7
- } from "./chunk-MA7G4CTI.js";
7
+ } from "./chunk-RJE5G7WO.js";
8
8
  import {
9
9
  init_journal_loader,
10
10
  journal_loader_exports
package/dist/mcp.js CHANGED
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ getPluginUpdateNotice,
4
+ schedulePluginUpdateCheck
5
+ } from "./chunk-5EWAQHFY.js";
6
+ import {
7
+ PatternMatcher,
8
+ PatternSuggester,
9
+ SentinelStorage,
10
+ StatsCalculator,
11
+ TimelineBuilder,
12
+ loadAllSeedPatterns
13
+ } from "./chunk-ZDHLG5VP.js";
2
14
  import {
3
15
  getDecisionSummary,
4
16
  loadDecisions,
5
17
  recordDecision
6
18
  } from "./chunk-EZ3GOCYC.js";
19
+ import {
20
+ loadAllAgentStates
21
+ } from "./chunk-54LTTQBH.js";
7
22
  import {
8
23
  acknowledgeMessages,
9
24
  approveFileRequest,
@@ -58,7 +73,6 @@ import {
58
73
  getReferencesFrom,
59
74
  getReferencesTo,
60
75
  getReindexToolsList,
61
- getSessionTracker,
62
76
  getSymbol,
63
77
  getSymbolCounts,
64
78
  getSymbolsByType,
@@ -66,9 +80,6 @@ import {
66
80
  handleReindexTool,
67
81
  incrementHeatmap,
68
82
  loadDiplomas,
69
- loadGlobalAntipatterns,
70
- loadGlobalDecisions,
71
- loadGlobalPreferences,
72
83
  loadNote,
73
84
  loadPath,
74
85
  loadPersona,
@@ -83,8 +94,6 @@ import {
83
94
  parsePurposeFileDetailed,
84
95
  rebuildStaticFiles,
85
96
  rebuildUniversityIndex,
86
- recordGlobalAntipattern,
87
- recordGlobalDecision,
88
97
  recordProtocol,
89
98
  removeStep,
90
99
  saveDiploma,
@@ -105,26 +114,13 @@ import {
105
114
  validateProtocol,
106
115
  validatePurposeFile,
107
116
  validateUniversityContent
108
- } from "./chunk-3UCH56D5.js";
117
+ } from "./chunk-4BLYIB7J.js";
109
118
  import "./chunk-L27I3CPZ.js";
110
119
  import {
111
120
  getWorkLogSummary,
112
121
  loadWorkLogEntries,
113
122
  recordWorkLog
114
123
  } from "./chunk-TAIJOFOE.js";
115
- import {
116
- getPluginUpdateNotice,
117
- schedulePluginUpdateCheck
118
- } from "./chunk-5EWAQHFY.js";
119
- import "./chunk-SDDCVUCV.js";
120
- import {
121
- completeTask,
122
- createTask,
123
- loadTask,
124
- loadTasks,
125
- shelveTask,
126
- updateTask
127
- } from "./chunk-CSD7IHSN.js";
128
124
  import {
129
125
  addLoreAssessment,
130
126
  deleteLoreEntry,
@@ -135,6 +131,23 @@ import {
135
131
  recordLoreEntry,
136
132
  updateLoreEntry
137
133
  } from "./chunk-5VKJBNJL.js";
134
+ import {
135
+ getSessionTracker,
136
+ loadGlobalAntipatterns,
137
+ loadGlobalDecisions,
138
+ loadGlobalPreferences,
139
+ recordGlobalAntipattern,
140
+ recordGlobalDecision
141
+ } from "./chunk-4L3UTYQX.js";
142
+ import "./chunk-CL7JSK52.js";
143
+ import {
144
+ completeTask,
145
+ createTask,
146
+ loadTask,
147
+ loadTasks,
148
+ shelveTask,
149
+ updateTask
150
+ } from "./chunk-CSD7IHSN.js";
138
151
  import {
139
152
  addNotebookEntry,
140
153
  adjustAttentionFromFeedback,
@@ -159,7 +172,7 @@ import {
159
172
  queryEvents,
160
173
  resolveDebate,
161
174
  searchNotebooks
162
- } from "./chunk-V7BZBBI6.js";
175
+ } from "./chunk-VPPK3SY4.js";
163
176
  import {
164
177
  buildProfileEnrichment,
165
178
  init_agent_loader,
@@ -170,7 +183,7 @@ import {
170
183
  queryExpertise,
171
184
  saveProjectRoster,
172
185
  verifyIntegrity
173
- } from "./chunk-MA7G4CTI.js";
186
+ } from "./chunk-RJE5G7WO.js";
174
187
  import {
175
188
  getJournalStats,
176
189
  init_journal_loader,
@@ -178,14 +191,6 @@ import {
178
191
  loadJournalEntries,
179
192
  recordJournalEntry
180
193
  } from "./chunk-MCMOGQMU.js";
181
- import {
182
- PatternMatcher,
183
- PatternSuggester,
184
- SentinelStorage,
185
- StatsCalculator,
186
- TimelineBuilder,
187
- loadAllSeedPatterns
188
- } from "./chunk-ZDHLG5VP.js";
189
194
  import {
190
195
  __esm,
191
196
  __export,
@@ -6065,6 +6070,14 @@ async function handleOrchestrateInline(args, ctx) {
6065
6070
  manifest.agents = filtered;
6066
6071
  }
6067
6072
  const symbols = extractSymbols(task);
6073
+ let activeNominations = [];
6074
+ try {
6075
+ const { processPendingEvents: processPendingEvents2, loadNominations: loadNominations2 } = await import("./nomination-engine-RV5CNO5B.js");
6076
+ processPendingEvents2(ctx.rootDir);
6077
+ const nominations = loadNominations2(ctx.rootDir, { pending_only: true, limit: 10 });
6078
+ activeNominations = nominations.filter((n) => n.urgency === "high" || n.urgency === "critical").map((n) => ({ agent: n.agent, urgency: n.urgency, brief: n.brief }));
6079
+ } catch {
6080
+ }
6068
6081
  const classification = classifyTaskLocal(task);
6069
6082
  const plan = planAgentSequence(task, manifest.agents, agentOverride, classification);
6070
6083
  if (mode === "plan") {
@@ -6082,9 +6095,14 @@ async function handleOrchestrateInline(args, ctx) {
6082
6095
  plan,
6083
6096
  suggestedAgents,
6084
6097
  costPreview,
6098
+ ...activeNominations.length > 0 ? {
6099
+ activeNominations,
6100
+ nominationNote: `${activeNominations.length} high-urgency agent nomination(s) pending. These agents have been flagged by the system for attention on this project.`
6101
+ } : {},
6085
6102
  instructions: [
6086
6103
  "Review task classification and cost preview above",
6087
6104
  "Review suggested agents based on task triggers",
6105
+ ...activeNominations.length > 0 ? ["Review active nominations \u2014 agents flagged by the system may need to be included"] : [],
6088
6106
  'Call again with mode="execute" to get full prompts and execution strategy',
6089
6107
  "Stages marked canRunParallel: true can be launched simultaneously",
6090
6108
  "After each agent completes, pass handoff context to the next stage"
@@ -6095,10 +6113,11 @@ async function handleOrchestrateInline(args, ctx) {
6095
6113
  }
6096
6114
  let agentProfiles = /* @__PURE__ */ new Map();
6097
6115
  try {
6098
- const { loadAgentProfile: loadAgentProfile2, buildProfileEnrichment: buildProfileEnrichment2 } = await import("./agent-loader-X7TDYLFL.js");
6116
+ const { loadAgentProfile: loadAgentProfile2, buildProfileEnrichment: buildProfileEnrichment2 } = await import("./agent-loader-TFIANSF4.js");
6099
6117
  const { loadDecisions: loadDecisions3 } = await import("./decision-loader-WWCLIQPJ.js");
6100
6118
  const { loadJournalEntries: loadJournalEntries2 } = await import("./journal-loader-5EYSBFFY.js");
6101
- const { loadNominations: loadNominations2 } = await import("./nomination-engine-LLREC5BZ.js");
6119
+ const { loadNominations: loadNominations2 } = await import("./nomination-engine-RV5CNO5B.js");
6120
+ const { loadAgentState: loadState } = await import("./agent-state-S5DAWPTF.js");
6102
6121
  const recentDecisions = loadDecisions3(ctx.rootDir, { status: "active", limit: 5 }).map((d) => ({ title: d.title, decision: d.decision.slice(0, 150) }));
6103
6122
  const pendingNominations = loadNominations2(ctx.rootDir, { pending_only: true, limit: 10 }).map((n) => ({ urgency: n.urgency, brief: n.brief }));
6104
6123
  for (const stage of plan.stages) {
@@ -6111,11 +6130,17 @@ async function handleOrchestrateInline(args, ctx) {
6111
6130
  transferable: true,
6112
6131
  limit: 5
6113
6132
  }).map((j) => ({ trigger: j.trigger, insight: j.insight.slice(0, 150) }));
6133
+ const agentProjectState = loadState(agentStep.name, ctx.rootDir);
6114
6134
  let enrichment = buildProfileEnrichment2(profile, symbols, void 0, {
6115
6135
  recentDecisions,
6116
6136
  journalInsights,
6117
6137
  pendingNominations
6118
- });
6138
+ }, agentProjectState ? {
6139
+ lastSession: agentProjectState.lastSession,
6140
+ pendingWork: agentProjectState.pendingWork,
6141
+ recentPatterns: agentProjectState.recentPatterns,
6142
+ sessionsOnProject: agentProjectState.sessionsOnProject
6143
+ } : void 0);
6119
6144
  if (profile.permissions) {
6120
6145
  const constraints = ["\n## Permission Constraints"];
6121
6146
  if (profile.permissions.paths?.deny?.length) {
@@ -6179,7 +6204,7 @@ async function handleOrchestrateInline(args, ctx) {
6179
6204
  const orchestrationId = `orch-${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 6)}`;
6180
6205
  logOrchestration(ctx.rootDir, orchestrationId, task, plan);
6181
6206
  try {
6182
- const { appendSessionWorkEntry } = await import("./session-work-log-KDOH4GER.js");
6207
+ const { appendSessionWorkEntry } = await import("./session-work-log-MZ47OAPB.js");
6183
6208
  for (const stage of stagePrompts) {
6184
6209
  for (const agent of stage.agents) {
6185
6210
  appendSessionWorkEntry(ctx.rootDir, {
@@ -6194,6 +6219,21 @@ async function handleOrchestrateInline(args, ctx) {
6194
6219
  }
6195
6220
  } catch {
6196
6221
  }
6222
+ try {
6223
+ const { recordAgentSession } = await import("./agent-state-S5DAWPTF.js");
6224
+ const sessionTracker = await import("./session-tracker-C4BMD5WG.js");
6225
+ const sessionId = sessionTracker.default?.session?.sessionId || orchestrationId;
6226
+ for (const stage of stagePrompts) {
6227
+ for (const agent of stage.agents) {
6228
+ recordAgentSession(agent.agent, ctx.rootDir, {
6229
+ sessionId,
6230
+ summary: `${agent.attribution || agent.agent}: ${(agent.taskDescription || task).slice(0, 200)}`,
6231
+ symbolsTouched: symbols
6232
+ });
6233
+ }
6234
+ }
6235
+ } catch {
6236
+ }
6197
6237
  const orchestrationThread = `thr-orch-${orchestrationId}`;
6198
6238
  try {
6199
6239
  const symphony = await import("./symphony-loader-UZGON56V.js");
@@ -6245,6 +6285,7 @@ async function handleOrchestrateInline(args, ctx) {
6245
6285
  mode: "execute",
6246
6286
  symbols,
6247
6287
  totalAgents: plan.estimatedAgents,
6288
+ ...activeNominations.length > 0 ? { activeNominations } : {},
6248
6289
  stages: stagePrompts,
6249
6290
  // IDE-agnostic execution instructions
6250
6291
  executionInstructions: [
@@ -6340,10 +6381,10 @@ async function handleAgentPrompt(args, ctx) {
6340
6381
  let profileEnrichment;
6341
6382
  let nickname;
6342
6383
  try {
6343
- const { loadAgentProfile: loadAgentProfile2, buildProfileEnrichment: buildProfileEnrichment2 } = await import("./agent-loader-X7TDYLFL.js");
6384
+ const { loadAgentProfile: loadAgentProfile2, buildProfileEnrichment: buildProfileEnrichment2 } = await import("./agent-loader-TFIANSF4.js");
6344
6385
  const { loadDecisions: loadDecisions3 } = await import("./decision-loader-WWCLIQPJ.js");
6345
6386
  const { loadJournalEntries: loadJournalEntries2 } = await import("./journal-loader-5EYSBFFY.js");
6346
- const { loadNominations: loadNominations2 } = await import("./nomination-engine-LLREC5BZ.js");
6387
+ const { loadNominations: loadNominations2 } = await import("./nomination-engine-RV5CNO5B.js");
6347
6388
  const profile = loadAgentProfile2(ctx.rootDir, agentName);
6348
6389
  if (profile) {
6349
6390
  nickname = profile.nickname;
@@ -8880,6 +8921,37 @@ var SEED_HABITS = [
8880
8921
  severity: "advisory",
8881
8922
  check: { type: "tool-called", params: { tools: ["paradigm_university_onboard"] } },
8882
8923
  enabled: false
8924
+ },
8925
+ // ── Agent Orchestration Enforcement ──────────────────────────
8926
+ {
8927
+ id: "orchestration-required",
8928
+ name: "Orchestrate Complex Tasks",
8929
+ description: "Tasks affecting 3+ files or touching security symbols should use paradigm_orchestrate_inline to determine which agents are needed. Ensures security review, test coverage, and documentation.",
8930
+ category: "collaboration",
8931
+ trigger: "preflight",
8932
+ severity: "warn",
8933
+ check: { type: "tool-called", params: { tools: ["paradigm_orchestrate_inline"] } },
8934
+ enabled: true
8935
+ },
8936
+ {
8937
+ id: "agent-coverage-validated",
8938
+ name: "Validate Agent Involvement",
8939
+ description: "After completing work, verify that agents with relevant expertise were consulted. Check nominations that were surfaced but not acted on.",
8940
+ category: "collaboration",
8941
+ trigger: "postflight",
8942
+ severity: "advisory",
8943
+ check: { type: "tool-called", params: { tools: ["paradigm_ambient_nominations", "paradigm_agent_list"] } },
8944
+ enabled: true
8945
+ },
8946
+ {
8947
+ id: "hot-mode-incident",
8948
+ name: "Incident Response Acknowledgment",
8949
+ description: "During incident response, orchestration enforcement is waived. But a post-incident lore entry is required and a postflight review should be scheduled.",
8950
+ category: "collaboration",
8951
+ trigger: "on-stop",
8952
+ severity: "advisory",
8953
+ check: { type: "lore-recorded" },
8954
+ enabled: true
8883
8955
  }
8884
8956
  ];
8885
8957
  var HABITS_CACHE_TTL_MS = 30 * 1e3;
@@ -10267,7 +10339,7 @@ async function handleLoreTool(name, args, ctx) {
10267
10339
  try {
10268
10340
  const agentId = process.env.PARADIGM_AGENT_ID;
10269
10341
  if (agentId && symbols_touched && symbols_touched.length > 0) {
10270
- const { updateExpertiseFromLore } = await import("./agent-loader-X7TDYLFL.js");
10342
+ const { updateExpertiseFromLore } = await import("./agent-loader-TFIANSF4.js");
10271
10343
  updateExpertiseFromLore(ctx.rootDir, agentId, {
10272
10344
  symbols_touched,
10273
10345
  confidence: confidence != null && confidence >= 0 && confidence <= 1 ? confidence : void 0
@@ -10438,7 +10510,7 @@ async function handleLoreTool(name, args, ctx) {
10438
10510
  try {
10439
10511
  const agentId = process.env.PARADIGM_AGENT_ID;
10440
10512
  if (agentId && success && entryToAssess.symbols_touched?.length) {
10441
- const { updateExpertiseFromAssessment } = await import("./agent-loader-X7TDYLFL.js");
10513
+ const { updateExpertiseFromAssessment } = await import("./agent-loader-TFIANSF4.js");
10442
10514
  updateExpertiseFromAssessment(ctx.rootDir, agentId, {
10443
10515
  symbols_touched: entryToAssess.symbols_touched,
10444
10516
  verdict
@@ -17694,26 +17766,37 @@ async function handleAgentTool(name, args, ctx) {
17694
17766
  }
17695
17767
  const activeProfiles = roster ? profiles.filter((p) => roster.includes(p.id)) : profiles;
17696
17768
  const inactiveCount = roster ? profiles.length - activeProfiles.length : 0;
17769
+ const allStates = loadAllAgentStates(ctx.rootDir);
17770
+ const stateMap = new Map(allStates.map((s) => [s.id, s]));
17697
17771
  return {
17698
17772
  handled: true,
17699
17773
  text: JSON.stringify({
17700
17774
  count: activeProfiles.length,
17701
17775
  totalAvailable: profiles.length,
17702
17776
  ...roster ? { rosterActive: true, inactiveCount } : { rosterActive: false },
17703
- agents: activeProfiles.map((p) => ({
17704
- id: p.id,
17705
- role: p.role,
17706
- nickname: p.nickname,
17707
- personality: p.personality,
17708
- topExpertise: (p.expertise || []).sort((a, b) => b.confidence - a.confidence).slice(0, 5).map((e) => ({
17709
- symbol: e.symbol,
17710
- confidence: parseFloat(e.confidence.toFixed(2)),
17711
- sessions: e.sessions
17712
- })),
17713
- projectContexts: Object.keys(p.contexts || {}),
17714
- transferableCount: (p.transferable || []).length,
17715
- ...p.attention?.threshold != null ? { threshold: p.attention.threshold } : {}
17716
- }))
17777
+ agents: activeProfiles.map((p) => {
17778
+ const state = stateMap.get(p.id);
17779
+ return {
17780
+ id: p.id,
17781
+ role: p.role,
17782
+ nickname: p.nickname,
17783
+ personality: p.personality,
17784
+ ...state ? {
17785
+ lastSession: state.lastSession?.summary?.slice(0, 100),
17786
+ lastSessionAge: state.lastSession?.date,
17787
+ pendingWork: state.pendingWork?.length || 0,
17788
+ sessionsOnProject: state.sessionsOnProject || 0
17789
+ } : {},
17790
+ topExpertise: (p.expertise || []).sort((a, b) => b.confidence - a.confidence).slice(0, 5).map((e) => ({
17791
+ symbol: e.symbol,
17792
+ confidence: parseFloat(e.confidence.toFixed(2)),
17793
+ sessions: e.sessions
17794
+ })),
17795
+ projectContexts: Object.keys(p.contexts || {}),
17796
+ transferableCount: (p.transferable || []).length,
17797
+ ...p.attention?.threshold != null ? { threshold: p.attention.threshold } : {}
17798
+ };
17799
+ })
17717
17800
  }, null, 2)
17718
17801
  };
17719
17802
  }
@@ -19490,7 +19573,7 @@ async function handleAmbientTool(name, args, ctx) {
19490
19573
  const engaged = engageNomination(ctx.rootDir, nominationId, response, reason);
19491
19574
  if (engaged) {
19492
19575
  try {
19493
- const { appendSessionWorkEntry } = await import("./session-work-log-KDOH4GER.js");
19576
+ const { appendSessionWorkEntry } = await import("./session-work-log-MZ47OAPB.js");
19494
19577
  const noms = loadNominations(ctx.rootDir, { limit: 500 });
19495
19578
  const nom = noms.find((n) => n.id === nominationId);
19496
19579
  appendSessionWorkEntry(ctx.rootDir, {
@@ -20728,7 +20811,7 @@ Update command:
20728
20811
  trackToolCall(noWsText.length, name);
20729
20812
  return { content: [{ type: "text", text: noWsText }] };
20730
20813
  }
20731
- const { rebuildStaticFiles: rebuildStaticFiles2 } = await import("./reindex-U2HEB6GW.js");
20814
+ const { rebuildStaticFiles: rebuildStaticFiles2 } = await import("./reindex-5LTD53ZC.js");
20732
20815
  const memberResults = [];
20733
20816
  for (const member of ctx.workspace.config.members) {
20734
20817
  const memberAbsPath = path33.resolve(path33.dirname(ctx.workspace.workspacePath), member.path);
@@ -17,8 +17,8 @@ import {
17
17
  processEvent,
18
18
  processPendingEvents,
19
19
  resolveDebate
20
- } from "./chunk-V7BZBBI6.js";
21
- import "./chunk-MA7G4CTI.js";
20
+ } from "./chunk-VPPK3SY4.js";
21
+ import "./chunk-RJE5G7WO.js";
22
22
  import "./chunk-MCMOGQMU.js";
23
23
  import "./chunk-7N7GSU6K.js";
24
24
  init_nomination_engine();
@@ -3,10 +3,11 @@ import {
3
3
  getReindexToolsList,
4
4
  handleReindexTool,
5
5
  rebuildStaticFiles
6
- } from "./chunk-3UCH56D5.js";
6
+ } from "./chunk-4BLYIB7J.js";
7
7
  import "./chunk-L27I3CPZ.js";
8
- import "./chunk-SDDCVUCV.js";
9
8
  import "./chunk-5VKJBNJL.js";
9
+ import "./chunk-4L3UTYQX.js";
10
+ import "./chunk-CL7JSK52.js";
10
11
  import "./chunk-7N7GSU6K.js";
11
12
  export {
12
13
  getReindexToolsList,
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ MODEL_PRICING,
4
+ getSessionTracker,
5
+ resetSessionTracker
6
+ } from "./chunk-4L3UTYQX.js";
7
+ import "./chunk-CL7JSK52.js";
8
+ import "./chunk-7N7GSU6K.js";
9
+ export {
10
+ MODEL_PRICING,
11
+ getSessionTracker,
12
+ resetSessionTracker
13
+ };
@@ -7,7 +7,7 @@ import {
7
7
  getContributingAgents,
8
8
  init_session_work_log,
9
9
  readSessionWorkLog
10
- } from "./chunk-SDDCVUCV.js";
10
+ } from "./chunk-CL7JSK52.js";
11
11
  import "./chunk-7N7GSU6K.js";
12
12
  init_session_work_log();
13
13
  export {