@theronap/agnoclast-mcp 0.9.328 → 0.9.329

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,11 @@
1
+ // WHO IS WRITING A SESSION LOG (agent conversation capture, step 2; obligation de216454).
2
+ // log_session sends source claude-code from every agent, so Muse and Hermes logs read as Claude Code sessions.
3
+ // It now also sends the agent's name, which the server records as capturedBy (web/lib/engine/session_log_writer.ts).
4
+
5
+ /** AGNOCLAST_CLIENT when the runner sets it (Muse, Hermes), Claude Code when its own session id is present, else
6
+ * null, and the server names the token's connection instead. */
7
+ export function logAgent(env) {
8
+ const declared = typeof env?.AGNOCLAST_CLIENT === 'string' ? env.AGNOCLAST_CLIENT.trim().slice(0, 60) : ''
9
+ if (declared) return declared
10
+ return env?.CLAUDE_CODE_SESSION_ID ? 'Claude Code' : null
11
+ }
@@ -22,9 +22,19 @@ const SOURCE_LABEL = {
22
22
  handoff: 'Transcript or document', meeting: 'Meeting',
23
23
  // Every remote connector's saves, not only claude.ai's: which AI made one is rec.capturedBy (header line below).
24
24
  'claude-connector': 'Saved through a connector',
25
+ // An agent's text conversation, summarised into a session (web/lib/engine/agent_conversation_log.ts).
26
+ 'agent-chat': 'Agent conversation',
25
27
  }
26
28
 
27
29
  const label = (source) => SOURCE_LABEL[source] ?? source
30
+
31
+ /** PURE. A session log written by another agent (Muse, Hermes) is named for that agent, not "Claude Code session":
32
+ * log_session keeps the claude-code source for routing and tier, and the server records who wrote it as capturedBy. */
33
+ export function sourceLine(source, capturedBy, by = '') {
34
+ const agent = typeof capturedBy === 'string' ? capturedBy.trim() : ''
35
+ if (source === 'claude-code' && agent && !/claude code/i.test(agent)) return `${agent} session`
36
+ return `${label(source)}${by}`
37
+ }
28
38
  const line = (e) => ` · ${e.title || '(untitled)'} — ${label(e.source)} · ${e.occurredAt} — id ${e.id}`
29
39
 
30
40
  /**
@@ -41,7 +51,7 @@ export function renderRecord(rec, maxChars = READ_RECORD_DEFAULT_CHARS, part = '
41
51
  const out = []
42
52
  out.push(`# ${rec.title || '(untitled record)'}`)
43
53
  const by = typeof rec.capturedBy === 'string' && rec.capturedBy ? ` (${rec.capturedBy})` : ''
44
- out.push(`${label(rec.source)}${by} · ${rec.occurredAt} · brain ${rec.brain?.name ?? rec.brain ?? '?'}${rec.superseded ? ' · ⚠ superseded by a newer version' : ''}`)
54
+ out.push(`${sourceLine(rec.source, rec.capturedBy, by)} · ${rec.occurredAt} · brain ${rec.brain?.name ?? rec.brain ?? '?'}${rec.superseded ? ' · ⚠ superseded by a newer version' : ''}`)
45
55
  out.push(`id: ${rec.id}`)
46
56
  out.push('')
47
57
  const content = typeof rec.content === 'string' ? rec.content : ''
package/lib/server.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
3
3
  import { z } from 'zod'
4
+ import { logAgent } from './log_agent.mjs'
4
5
  import { writeFileSync, mkdirSync, readFileSync, statSync } from 'fs'
5
6
  import { homedir } from 'os'
6
7
  import { join } from 'path'
@@ -885,7 +886,10 @@ function renderNudge(payload) {
885
886
  // org. Measured 2026-08-09: 86 staged rows, not drainable by /api/staged/promote.
886
887
  ...(seg.brain ? { brain: seg.brain } : {}),
887
888
  ...(privacy ? { privacy } : {}),
888
- payload: { via: 'log_session' },
889
+ // WHICH AGENT wrote this log. The source stays claude-code (routing and the tier floor key on it), so
890
+ // Muse or Hermes says who it is here and the server records it as capturedBy (session_log_writer.ts).
891
+ // Without either, the server names the token's connection instead.
892
+ payload: { via: 'log_session', ...(logAgent(process.env) ? { agent: logAgent(process.env) } : {}) },
889
893
  }),
890
894
  })
891
895
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/agnoclast-mcp",
3
- "version": "0.9.328",
3
+ "version": "0.9.329",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {