@theronap/agnoclast-mcp 0.9.319 → 0.9.320
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/lib/server.mjs +11 -6
- package/lib/split_render.mjs +23 -3
- package/package.json +1 -1
package/lib/server.mjs
CHANGED
|
@@ -2957,7 +2957,7 @@ function renderNudge(payload) {
|
|
|
2957
2957
|
const a = out.proposals?.attached
|
|
2958
2958
|
const records = a
|
|
2959
2959
|
? `\nRecords on the source: ${a.candidates} to sort${a.hidden ? ` (${a.hidden} you cannot read)` : ''}` +
|
|
2960
|
-
`${a.viaKeptClaims ? `; ${a.viaKeptClaims} held by
|
|
2960
|
+
`${a.viaKeptClaims ? `; ${a.viaKeptClaims} more are held by routing claims the source keeps — split_records asks whether each claim belongs to the new page too` : ''}.`
|
|
2961
2961
|
: ''
|
|
2962
2962
|
const recordsNext = out.records_next ? `\nRECORDS: ${out.records_next}` : ''
|
|
2963
2963
|
if (out.preview) {
|
|
@@ -2972,7 +2972,7 @@ function renderNudge(payload) {
|
|
|
2972
2972
|
'split_records',
|
|
2973
2973
|
{
|
|
2974
2974
|
title: 'List every record a split must sort',
|
|
2975
|
-
description: 'List EVERY record a split you applied left on its source — the full worklist for place_split_records, not the 20 that split_page names. Page through with `offset` until you have covered `total`. Each line: id, title, source/type, date, approximate length, RECORDING when it is a meeting, transcript or handoff (each long one gets its own reader), and how it is attached (moved_claim = through a routing claim the moved text names;
|
|
2975
|
+
description: 'List EVERY record a split you applied left on its source — the full worklist for place_split_records, not the 20 that split_page names. Page through with `offset` until you have covered `total`. Each line: id, title, source/type, date, approximate length, RECORDING when it is a meeting, transcript or handoff (each long one gets its own reader), and how it is attached (moved_claim = through a routing claim the moved text names; kept_claim = through a claim the source keeps, with the claim named; direct). It also lists each KEPT CLAIM with its record count and sample titles — decide those first (place_split_records `claims`). Records you cannot read are counted, never named. Also says whether the records were already placed or the split was undone. Read-only.',
|
|
2976
2976
|
inputSchema: {
|
|
2977
2977
|
plan: z.string().describe('the `plan` token split_page returned when you applied the split'),
|
|
2978
2978
|
offset: z.number().int().min(0).optional().describe('where to start (default 0); the reply names the next offset'),
|
|
@@ -2997,7 +2997,7 @@ function renderNudge(payload) {
|
|
|
2997
2997
|
'place_split_records',
|
|
2998
2998
|
{
|
|
2999
2999
|
title: 'Place a split\'s records, sorted by a full read',
|
|
3000
|
-
description: 'Place the records of a split you APPLIED, in ONE transaction: child = attach to the child and detach from the source; both = attach to the child too; parent = leave. PROCEDURE, every split: (a) FULL READ — list the whole worklist with split_records. Read EVERY candidate in full with read_record part "all" and max_chars at least its length. Each recording over ~20k chars gets its OWN sub-agent that reads every word: no keyword search, no skimming (a trial agent once keyword-searched two 150k transcripts). BOTH IS THE DEFAULT: a record goes on one page only when its own content clearly rules it out of the other (mostly-about is not enough); one with nothing readable (a header-only email, or a fragment — a stub, bare commit message, pending-summary fragment or one-line chat/status naming no subject of either page) can never rule itself out → both. (b) INBOUND LINKS — grep "[[<source title>]]" in substring mode; judge each link from its snippet; edit_page the ones you may edit to point at the child when they meant the moved text; list the rest for their owners. (c) GOVERNANCE NEVER MOVES — a record governed by the source stays on it even when you say child (it goes on both). Every readable candidate needs a decision (parent leaves it). Idempotent: a second call returns the first result.',
|
|
3000
|
+
description: 'Place the records of a split you APPLIED, in ONE transaction: child = attach to the child and detach from the source; both = attach to the child too; parent = leave. PROCEDURE, every split: (a) FULL READ — list the whole worklist with split_records. Read EVERY candidate in full with read_record part "all" and max_chars at least its length. Each recording over ~20k chars gets its OWN sub-agent that reads every word: no keyword search, no skimming (a trial agent once keyword-searched two 150k transcripts). BOTH IS THE DEFAULT: a record goes on one page only when its own content clearly rules it out of the other (mostly-about is not enough); one with nothing readable (a header-only email, or a fragment — a stub, bare commit message, pending-summary fragment or one-line chat/status naming no subject of either page) can never rule itself out → both. CLAIMS FIRST: for each kept claim split_records lists, decide whether the identifier ALSO belongs to the new page — applies: true and the new page claims it too, every record it holds goes on both, and you need not decide those records; applies: false and its records are read in full like the rest. A claim-held record never leaves the source (child means both). Identity claims (email, phone, thread) are always applies: false. (b) INBOUND LINKS — grep "[[<source title>]]" in substring mode; judge each link from its snippet; edit_page the ones you may edit to point at the child when they meant the moved text; list the rest for their owners. (c) GOVERNANCE NEVER MOVES — a record governed by the source stays on it even when you say child (it goes on both). Every readable candidate needs a decision (parent leaves it). Idempotent: a second call returns the first result.',
|
|
3001
3001
|
inputSchema: {
|
|
3002
3002
|
plan: z.string().describe('the `plan` token of the applied split'),
|
|
3003
3003
|
decisions: z.array(z.object({
|
|
@@ -3005,16 +3005,21 @@ function renderNudge(payload) {
|
|
|
3005
3005
|
placement: z.enum(['child', 'parent', 'both']),
|
|
3006
3006
|
confidence: z.number().min(0).max(1).optional(),
|
|
3007
3007
|
reason: z.string().optional().describe('one line: what in the record decided it'),
|
|
3008
|
-
})).describe('the FULL READ: one decision for EVERY candidate split_records lists'),
|
|
3008
|
+
})).describe('the FULL READ: one decision for EVERY candidate split_records lists, except records held by a claim you mark applies: true'),
|
|
3009
|
+
claims: z.array(z.object({
|
|
3010
|
+
identifier: z.string(),
|
|
3011
|
+
applies: z.boolean().describe('true = the identifier also belongs to the new page: it claims it too'),
|
|
3012
|
+
reason: z.string().optional(),
|
|
3013
|
+
})).optional().describe('one decision for EVERY kept claim split_records lists — made before reading its records'),
|
|
3009
3014
|
},
|
|
3010
3015
|
},
|
|
3011
|
-
async ({ plan, decisions }) => {
|
|
3016
|
+
async ({ plan, decisions, claims }) => {
|
|
3012
3017
|
let res
|
|
3013
3018
|
try {
|
|
3014
3019
|
res = await fetchCortex(`${BASE}/api/brain/split-records`, {
|
|
3015
3020
|
method: 'POST',
|
|
3016
3021
|
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
3017
|
-
body: JSON.stringify({ plan, decisions }),
|
|
3022
|
+
body: JSON.stringify({ plan, decisions, ...(claims ? { claims } : {}) }),
|
|
3018
3023
|
})
|
|
3019
3024
|
} catch (e) {
|
|
3020
3025
|
return toolError(`Could not place the split's records: ${e.message}`)
|
package/lib/split_render.mjs
CHANGED
|
@@ -11,7 +11,7 @@ export function worklistLine(r) {
|
|
|
11
11
|
const date = r.occurred_at ? String(r.occurred_at).slice(0, 10) : 'undated'
|
|
12
12
|
const kind = [r.source, r.record_type].filter(Boolean).join('/')
|
|
13
13
|
return `· ${r.id} — ${r.title || '(untitled)'} — ${kind} · ${date} · ${kchars(Number(r.approx_chars) || 0)}` +
|
|
14
|
-
`${r.is_recording ? ' · RECORDING' : ''} · ${r.via}`
|
|
14
|
+
`${r.is_recording ? ' · RECORDING' : ''} · ${r.via}${r.claims?.length ? ` (${r.claims.join(', ')})` : ''}`
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** split_records' reply: one page of the worklist. */
|
|
@@ -23,7 +23,17 @@ export function renderWorklist(out) {
|
|
|
23
23
|
`, ${out.recordings} of them recordings.`)
|
|
24
24
|
if (out.child?.title) lines.push(`Child: "${out.child.title}"${out.child.ref ? ` (ref ${out.child.ref})` : ''}.`)
|
|
25
25
|
if (out.hidden) lines.push(`${out.hidden} more you cannot read: counted, never named — their owners decide.`)
|
|
26
|
-
|
|
26
|
+
const kept = Array.isArray(out.kept_claims) ? out.kept_claims : []
|
|
27
|
+
if (kept.length) {
|
|
28
|
+
lines.push('', `CLAIMS FIRST — the source keeps ${kept.length} routing claim(s) that hold ${out.via_kept_claims ?? 0} of these records. ` +
|
|
29
|
+
'Decide each: does the identifier ALSO belong to the new page? (claims: [{identifier, applies}] in place_split_records)')
|
|
30
|
+
for (const c of kept) {
|
|
31
|
+
lines.push(`· ${c.identifier} — ${c.records} record(s)${c.claimable ? '' : ' — identity claim: never moves, read its records'}` +
|
|
32
|
+
(c.samples?.length ? ` — e.g. ${c.samples.map((t) => `"${t}"`).join('; ')}` : ''))
|
|
33
|
+
}
|
|
34
|
+
lines.push('applies: true → the new page claims it too and gets all its records; skip reading them. ' +
|
|
35
|
+
'applies: false → read its records IN FULL like the rest. A claim-held record never leaves the source.')
|
|
36
|
+
}
|
|
27
37
|
if (out.records.length) lines.push('', ...out.records.map(worklistLine), '')
|
|
28
38
|
if (shownTo < out.total) lines.push(`More: split_records with plan "${out.plan}" and offset ${shownTo}.`)
|
|
29
39
|
if (out.undone_at) lines.push(`⚠ This split was UNDONE at ${out.undone_at}.`)
|
|
@@ -44,8 +54,17 @@ export function renderPlacement(out) {
|
|
|
44
54
|
const attached = actions.filter((a) => a.attached_child).length
|
|
45
55
|
const detached = actions.filter((a) => a.detached_source).length
|
|
46
56
|
const kept = actions.filter((a) => a.kept_governing).length
|
|
57
|
+
const keptClaim = actions.filter((a) => a.kept_claim).length
|
|
47
58
|
lines.push(`Attached to the child: ${attached}. Detached from the source: ${detached}.` +
|
|
48
|
-
(kept ? ` ${kept} record(s) GOVERNED by the source stay on it as well — governance never moves in a split.` : '')
|
|
59
|
+
(kept ? ` ${kept} record(s) GOVERNED by the source stay on it as well — governance never moves in a split.` : '') +
|
|
60
|
+
(keptClaim ? ` ${keptClaim} record(s) held by a claim the source keeps stay on it as well.` : ''))
|
|
61
|
+
const claims = Array.isArray(p.claims) ? p.claims : []
|
|
62
|
+
if (claims.length) {
|
|
63
|
+
const yes = claims.filter((c) => c.applies).map((c) => c.identifier)
|
|
64
|
+
const no = claims.filter((c) => !c.applies).map((c) => c.identifier)
|
|
65
|
+
if (yes.length) lines.push(`The new page now claims too: ${yes.join(', ')} — future records with ${yes.length > 1 ? 'these' : 'it'} land on both pages.`)
|
|
66
|
+
if (no.length) lines.push(`Claims kept by the source alone: ${no.join(', ')}.`)
|
|
67
|
+
}
|
|
49
68
|
lines.push('Next: inbound [[links]] to the source that meant the moved text (see split_page). undo_split reverses the whole split.')
|
|
50
69
|
return lines.join('\n')
|
|
51
70
|
}
|
|
@@ -57,6 +76,7 @@ export function renderUndo(out) {
|
|
|
57
76
|
`The source has its sections back (${(out.restoredHeadings ?? []).join(' · ')}); its version is now ${out.sourceVersion}.`,
|
|
58
77
|
out.childRetired ? 'The child page is retired (superseded by the source), not deleted.' : 'The child page was already retired.',
|
|
59
78
|
`Records put back on the source: ${out.reattachedToSource}; taken off the child: ${out.detachedFromChild}.`,
|
|
79
|
+
out.claimsRemoved ? `Routing claims the split gave the child, removed: ${out.claimsRemoved}.` : '',
|
|
60
80
|
out.otherChildRecords ? `⚠ ${out.otherChildRecords} record(s) are still attached to the retired child — the split did not put them there; route them yourself.` : '',
|
|
61
81
|
].filter(Boolean).join('\n')
|
|
62
82
|
}
|
package/package.json
CHANGED