agentix-cli 0.189.1 → 0.191.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.
- package/dist/{App-6AHOJ2PO.js → App-Z4OZ4VAI.js} +2 -2
- package/dist/{ChatApp-MVSQX44C.js → ChatApp-7VLNOH2N.js} +2 -2
- package/dist/{absorb-eval-PHA44MPA.js → absorb-eval-QR3EEHDE.js} +2 -2
- package/dist/{adapter-RXZGBGFY.js → adapter-VWMQAALK.js} +2 -2
- package/dist/{agent-4CGWR2XJ.js → agent-RS4W545P.js} +2 -2
- package/dist/{board-dashboard-WCRDEXEC.js → board-dashboard-RXOSENTD.js} +452 -361
- package/dist/board-dashboard-RXOSENTD.js.map +1 -0
- package/dist/chunk-2HBEZV7L.js +24 -0
- package/dist/chunk-2HBEZV7L.js.map +1 -0
- package/dist/{chunk-YHRQQ4DB.js → chunk-34O2GH4J.js} +2 -2
- package/dist/{chunk-SOVWD6TL.js → chunk-3NMBTBNW.js} +2 -2
- package/dist/{chunk-EGKOB3ZM.js → chunk-54J6PXBG.js} +2 -2
- package/dist/{chunk-PE5V2LI7.js → chunk-5ONH4ITT.js} +2 -2
- package/dist/{chunk-ZJNEJRUU.js → chunk-6MU3OEII.js} +2 -2
- package/dist/chunk-A7JSRDJL.js +3 -0
- package/dist/chunk-A7JSRDJL.js.map +1 -0
- package/dist/{chunk-OBVLO6FV.js → chunk-AS4NDKUJ.js} +2 -2
- package/dist/{chunk-URWRA3EO.js → chunk-BWBTNBPS.js} +2 -2
- package/dist/{chunk-U2OGZDAN.js → chunk-CKHLBNMN.js} +2 -2
- package/dist/{chunk-ZYZ4VQUD.js → chunk-FRTU3ICQ.js} +2 -2
- package/dist/{chunk-FKT34MQ7.js → chunk-IGLJXEXX.js} +2 -2
- package/dist/chunk-JRAG37V5.js +3 -0
- package/dist/chunk-JRAG37V5.js.map +1 -0
- package/dist/{chunk-H7VI7OTS.js → chunk-KTGTKOLV.js} +2 -2
- package/dist/{chunk-A5KZSTYI.js → chunk-L3CWRXKQ.js} +2 -2
- package/dist/{chunk-POK4IPY3.js → chunk-MW75GECE.js} +94 -92
- package/dist/chunk-MW75GECE.js.map +1 -0
- package/dist/{chunk-WXJ25XH2.js → chunk-OTCMYGQR.js} +2 -2
- package/dist/{chunk-7BA4KCRW.js → chunk-RA4WCDGV.js} +2 -2
- package/dist/{chunk-QBR6TGRW.js → chunk-RQKLUGMS.js} +3 -3
- package/dist/{chunk-YLCMN4OA.js → chunk-RRGC6Y4L.js} +2 -2
- package/dist/{chunk-JE5KSD6Z.js → chunk-S3XUIVC2.js} +2 -2
- package/dist/{chunk-WILRVP4X.js → chunk-T2NPSEPJ.js} +2 -2
- package/dist/chunk-U5B275AU.js +143 -0
- package/dist/chunk-U5B275AU.js.map +1 -0
- package/dist/{chunk-IXUG76KI.js → chunk-WXSS7VIW.js} +302 -297
- package/dist/chunk-WXSS7VIW.js.map +1 -0
- package/dist/{chunk-J522P3Z3.js → chunk-XJEBJZLX.js} +2 -2
- package/dist/{chunk-Z55PWDYH.js → chunk-XJUBFPOM.js} +2 -2
- package/dist/chunk-XVV7ZZ77.js +6 -0
- package/dist/{chunk-4ZWZ42YE.js.map → chunk-XVV7ZZ77.js.map} +1 -1
- package/dist/{chunk-2MFBCDWL.js → chunk-YFJVQOWI.js} +2 -2
- package/dist/{chunk-FM5VBO3D.js → chunk-YMDGKFIG.js} +2 -2
- package/dist/{chunk-V2O4OQZC.js → chunk-YOMLHG33.js} +2 -2
- package/dist/{chunk-XIGFRLU5.js → chunk-ZCBTTYQN.js} +20 -20
- package/dist/chunk-ZCBTTYQN.js.map +1 -0
- package/dist/{chunk-YJDQK22T.js → chunk-ZJ74H5SV.js} +2 -2
- package/dist/{chunk-BSQIPD6F.js → chunk-ZU6W3CXO.js} +36 -36
- package/dist/chunk-ZU6W3CXO.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{client-YDESLBEL.js → client-N5YTG2K6.js} +2 -2
- package/dist/{compaction-R7VWQB6X.js → compaction-ZE2WYXHQ.js} +2 -2
- package/dist/{config-J7LIYG6O.js → config-WUB5SJPH.js} +2 -2
- package/dist/{config-mutate-WNWJL2BY.js → config-mutate-ZLPUEIVN.js} +2 -2
- package/dist/config-mutator-S5X4DOJK.js +2 -0
- package/dist/{contributions-VVKFLXVL.js → contributions-C4DKQJY6.js} +2 -2
- package/dist/{contributions-VVKFLXVL.js.map → contributions-C4DKQJY6.js.map} +1 -1
- package/dist/{doctor-IPU5KA2L.js → doctor-ND3OS575.js} +2 -2
- package/dist/fact-proposals-Z7HJG7QJ.js +2 -0
- package/dist/{follow-up-tool-NUXHITTB.js → follow-up-tool-TWOEAWOL.js} +2 -2
- package/dist/{hub-4SPXWMRT.js → hub-FUM7UY5S.js} +2 -2
- package/dist/index.d.ts +216 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ledger-5GMBLR7W.js +2 -0
- package/dist/memory-extract-QYSXPK22.js +2 -0
- package/dist/memory-migrate-SO7RC5OU.js +2 -0
- package/dist/{memory-migrate-ED37IBEL.js.map → memory-migrate-SO7RC5OU.js.map} +1 -1
- package/dist/{program-UQUMJH2Q.js → program-JLUZINRR.js} +201 -201
- package/dist/program-JLUZINRR.js.map +1 -0
- package/dist/{promote-A7VZBQUZ.js → promote-M5AJSWHZ.js} +2 -2
- package/dist/{query-5I6RBPPK.js → query-NPDKXBTN.js} +2 -2
- package/dist/{query-settings-QLLC46BO.js → query-settings-HXKZYIEV.js} +2 -2
- package/dist/registry-A2FFL4EA.js +2 -0
- package/dist/{request-planner-SF4GYBQE.js → request-planner-ANGZP4JL.js} +2 -2
- package/dist/{review-candidates-KPAZ3FYG.js → review-candidates-B7T2QA3R.js} +2 -2
- package/dist/{rotation-memo-6RP4Z3S5.js → rotation-memo-26CFE4JN.js} +4 -3
- package/dist/rotation-memo-26CFE4JN.js.map +1 -0
- package/dist/rotation-memo-store-WMDI7NND.js +2 -0
- package/dist/{rotation-memo-store-Z4D5KRA6.js.map → rotation-memo-store-WMDI7NND.js.map} +1 -1
- package/dist/{routing-RUJNJHM6.js → routing-2KWP5TAT.js} +2 -2
- package/dist/schedule-tool-2UNMXEBQ.js +2 -0
- package/dist/{scheduler-C44WJX4C.js → scheduler-VN7WDAKE.js} +2 -2
- package/dist/{seat-QY2GW3FI.js → seat-MAC3QGGD.js} +2 -2
- package/dist/{select-XJMJ2XVP.js → select-UYKEN4N4.js} +2 -2
- package/dist/{set-enabled-JC3TJ6VZ.js → set-enabled-JEUIINT3.js} +2 -2
- package/dist/{sprint-tool-NP4WN7KL.js → sprint-tool-MB2MPR4K.js} +2 -2
- package/dist/{tool-23ODBVYF.js → tool-L4CQCPRF.js} +2 -2
- package/dist/{tool-LZR4EOQJ.js → tool-SZ6C6EBP.js} +2 -2
- package/dist/{tool-KHD45TSF.js → tool-TLXKW55S.js} +2 -2
- package/dist/web/workflow-editor.global.js +457 -328
- package/dist/web/workflow-editor.global.js.map +1 -1
- package/dist/{wiki-N3JOY2NN.js → wiki-ZAHFGDKE.js} +2 -2
- package/dist/wiki-enrich-QLCQHV6B.js +2 -0
- package/package.json +1 -1
- package/dist/board-dashboard-WCRDEXEC.js.map +0 -1
- package/dist/chunk-4ZWZ42YE.js +0 -5
- package/dist/chunk-BSQIPD6F.js.map +0 -1
- package/dist/chunk-C5OCJCDC.js +0 -137
- package/dist/chunk-C5OCJCDC.js.map +0 -1
- package/dist/chunk-GQ76J72O.js +0 -3
- package/dist/chunk-GQ76J72O.js.map +0 -1
- package/dist/chunk-IXUG76KI.js.map +0 -1
- package/dist/chunk-LE3BXIUF.js +0 -23
- package/dist/chunk-LE3BXIUF.js.map +0 -1
- package/dist/chunk-POK4IPY3.js.map +0 -1
- package/dist/chunk-XIGFRLU5.js.map +0 -1
- package/dist/config-mutator-V3PSCM6Q.js +0 -2
- package/dist/fact-proposals-X2O4W7VN.js +0 -2
- package/dist/ledger-P62U3FHT.js +0 -2
- package/dist/memory-extract-NLVLQE7V.js +0 -2
- package/dist/memory-migrate-ED37IBEL.js +0 -2
- package/dist/program-UQUMJH2Q.js.map +0 -1
- package/dist/registry-J724YF5H.js +0 -2
- package/dist/rotation-memo-6RP4Z3S5.js.map +0 -1
- package/dist/rotation-memo-store-Z4D5KRA6.js +0 -2
- package/dist/schedule-tool-PX5YULLG.js +0 -2
- package/dist/wiki-enrich-ZNFEO7BX.js +0 -2
- /package/dist/{App-6AHOJ2PO.js.map → App-Z4OZ4VAI.js.map} +0 -0
- /package/dist/{ChatApp-MVSQX44C.js.map → ChatApp-7VLNOH2N.js.map} +0 -0
- /package/dist/{absorb-eval-PHA44MPA.js.map → absorb-eval-QR3EEHDE.js.map} +0 -0
- /package/dist/{adapter-RXZGBGFY.js.map → adapter-VWMQAALK.js.map} +0 -0
- /package/dist/{agent-4CGWR2XJ.js.map → agent-RS4W545P.js.map} +0 -0
- /package/dist/{chunk-YHRQQ4DB.js.map → chunk-34O2GH4J.js.map} +0 -0
- /package/dist/{chunk-SOVWD6TL.js.map → chunk-3NMBTBNW.js.map} +0 -0
- /package/dist/{chunk-EGKOB3ZM.js.map → chunk-54J6PXBG.js.map} +0 -0
- /package/dist/{chunk-PE5V2LI7.js.map → chunk-5ONH4ITT.js.map} +0 -0
- /package/dist/{chunk-ZJNEJRUU.js.map → chunk-6MU3OEII.js.map} +0 -0
- /package/dist/{chunk-OBVLO6FV.js.map → chunk-AS4NDKUJ.js.map} +0 -0
- /package/dist/{chunk-URWRA3EO.js.map → chunk-BWBTNBPS.js.map} +0 -0
- /package/dist/{chunk-U2OGZDAN.js.map → chunk-CKHLBNMN.js.map} +0 -0
- /package/dist/{chunk-ZYZ4VQUD.js.map → chunk-FRTU3ICQ.js.map} +0 -0
- /package/dist/{chunk-FKT34MQ7.js.map → chunk-IGLJXEXX.js.map} +0 -0
- /package/dist/{chunk-H7VI7OTS.js.map → chunk-KTGTKOLV.js.map} +0 -0
- /package/dist/{chunk-A5KZSTYI.js.map → chunk-L3CWRXKQ.js.map} +0 -0
- /package/dist/{chunk-WXJ25XH2.js.map → chunk-OTCMYGQR.js.map} +0 -0
- /package/dist/{chunk-7BA4KCRW.js.map → chunk-RA4WCDGV.js.map} +0 -0
- /package/dist/{chunk-QBR6TGRW.js.map → chunk-RQKLUGMS.js.map} +0 -0
- /package/dist/{chunk-YLCMN4OA.js.map → chunk-RRGC6Y4L.js.map} +0 -0
- /package/dist/{chunk-JE5KSD6Z.js.map → chunk-S3XUIVC2.js.map} +0 -0
- /package/dist/{chunk-WILRVP4X.js.map → chunk-T2NPSEPJ.js.map} +0 -0
- /package/dist/{chunk-J522P3Z3.js.map → chunk-XJEBJZLX.js.map} +0 -0
- /package/dist/{chunk-Z55PWDYH.js.map → chunk-XJUBFPOM.js.map} +0 -0
- /package/dist/{chunk-2MFBCDWL.js.map → chunk-YFJVQOWI.js.map} +0 -0
- /package/dist/{chunk-FM5VBO3D.js.map → chunk-YMDGKFIG.js.map} +0 -0
- /package/dist/{chunk-V2O4OQZC.js.map → chunk-YOMLHG33.js.map} +0 -0
- /package/dist/{chunk-YJDQK22T.js.map → chunk-ZJ74H5SV.js.map} +0 -0
- /package/dist/{client-YDESLBEL.js.map → client-N5YTG2K6.js.map} +0 -0
- /package/dist/{compaction-R7VWQB6X.js.map → compaction-ZE2WYXHQ.js.map} +0 -0
- /package/dist/{config-J7LIYG6O.js.map → config-WUB5SJPH.js.map} +0 -0
- /package/dist/{config-mutate-WNWJL2BY.js.map → config-mutate-ZLPUEIVN.js.map} +0 -0
- /package/dist/{config-mutator-V3PSCM6Q.js.map → config-mutator-S5X4DOJK.js.map} +0 -0
- /package/dist/{doctor-IPU5KA2L.js.map → doctor-ND3OS575.js.map} +0 -0
- /package/dist/{fact-proposals-X2O4W7VN.js.map → fact-proposals-Z7HJG7QJ.js.map} +0 -0
- /package/dist/{follow-up-tool-NUXHITTB.js.map → follow-up-tool-TWOEAWOL.js.map} +0 -0
- /package/dist/{hub-4SPXWMRT.js.map → hub-FUM7UY5S.js.map} +0 -0
- /package/dist/{ledger-P62U3FHT.js.map → ledger-5GMBLR7W.js.map} +0 -0
- /package/dist/{memory-extract-NLVLQE7V.js.map → memory-extract-QYSXPK22.js.map} +0 -0
- /package/dist/{promote-A7VZBQUZ.js.map → promote-M5AJSWHZ.js.map} +0 -0
- /package/dist/{query-5I6RBPPK.js.map → query-NPDKXBTN.js.map} +0 -0
- /package/dist/{query-settings-QLLC46BO.js.map → query-settings-HXKZYIEV.js.map} +0 -0
- /package/dist/{registry-J724YF5H.js.map → registry-A2FFL4EA.js.map} +0 -0
- /package/dist/{request-planner-SF4GYBQE.js.map → request-planner-ANGZP4JL.js.map} +0 -0
- /package/dist/{review-candidates-KPAZ3FYG.js.map → review-candidates-B7T2QA3R.js.map} +0 -0
- /package/dist/{routing-RUJNJHM6.js.map → routing-2KWP5TAT.js.map} +0 -0
- /package/dist/{schedule-tool-PX5YULLG.js.map → schedule-tool-2UNMXEBQ.js.map} +0 -0
- /package/dist/{scheduler-C44WJX4C.js.map → scheduler-VN7WDAKE.js.map} +0 -0
- /package/dist/{seat-QY2GW3FI.js.map → seat-MAC3QGGD.js.map} +0 -0
- /package/dist/{select-XJMJ2XVP.js.map → select-UYKEN4N4.js.map} +0 -0
- /package/dist/{set-enabled-JC3TJ6VZ.js.map → set-enabled-JEUIINT3.js.map} +0 -0
- /package/dist/{sprint-tool-NP4WN7KL.js.map → sprint-tool-MB2MPR4K.js.map} +0 -0
- /package/dist/{tool-23ODBVYF.js.map → tool-L4CQCPRF.js.map} +0 -0
- /package/dist/{tool-LZR4EOQJ.js.map → tool-SZ6C6EBP.js.map} +0 -0
- /package/dist/{tool-KHD45TSF.js.map → tool-TLXKW55S.js.map} +0 -0
- /package/dist/{wiki-N3JOY2NN.js.map → wiki-ZAHFGDKE.js.map} +0 -0
- /package/dist/{wiki-enrich-ZNFEO7BX.js.map → wiki-enrich-QLCQHV6B.js.map} +0 -0
package/dist/chunk-LE3BXIUF.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{a as u,b as f}from"./chunk-BERWTVG2.js";var d=new Set(["cron","a2a","workflow","selftest"]),g=[[/^User:\s*You are\s/i,"role brief"],[/^User:\s*(Run|Execute)\s/i,"run instruction"],[/^User:\s*\[MISSED RUN/i,"missed cron run"],[/^User:\s*(\[[^\]]{0,40}\]:?\s*)?\[Recent group conversation\]/i,"group chat dump"]];function l(e){if(e.responseLength<=50)return{capture:!1,reason:"response too short"};let r=(e.channel??"").toLowerCase().split("@")[0];if(d.has(r))return{capture:!1,reason:`machine channel: ${r}`};let n=e.content.slice(0,400);for(let[o,c]of g)if(o.test(n))return{capture:!1,reason:c};return{capture:!0}}var y="claude-haiku-4-5-20251001",w=`You are a memory extraction system for an AI agent. Given a conversation exchange, extract facts worth remembering for future conversations across different chat sessions.
|
|
2
|
-
|
|
3
|
-
Extract ONLY facts that would help the agent in FUTURE, DIFFERENT conversations:
|
|
4
|
-
- User preferences and instructions ("never do X", "always use Y")
|
|
5
|
-
- Commitments the agent made ("I will deploy by Friday")
|
|
6
|
-
- Relationships ("Alex is the admin", "Marketing handles content")
|
|
7
|
-
- Task state ("GitLab tokens need deploying to peer-server")
|
|
8
|
-
- Important facts about infrastructure, config, or processes
|
|
9
|
-
|
|
10
|
-
SKIP:
|
|
11
|
-
- Credentials of any kind: passwords, tokens, API keys, private keys, connection strings. Never repeat one, not even partly. At most note that a credential exists and where it is kept, without its value.
|
|
12
|
-
- Routine greetings, acknowledgments, status updates
|
|
13
|
-
- Information derivable from code or config files
|
|
14
|
-
- Transient conversation flow ("let me check", "here's what I found")
|
|
15
|
-
- Facts already obvious from the agent's system prompt
|
|
16
|
-
|
|
17
|
-
For each fact, output a JSON array:
|
|
18
|
-
[{"category":"fact|preference|commitment|task-state","content":"concise fact, 1-2 sentences","keywords":["keyword1","keyword2"]}]
|
|
19
|
-
|
|
20
|
-
If nothing worth remembering, output: []`;async function I(e,s,r,n,o){if(s.length<20&&r.length<50||!l({channel:n.channel,content:`User: ${s}`,responseLength:r.length}).capture)return;let{createProvider:h}=await import("./providers-F5GDJSYD.js"),i=(await h("claude").generate([{role:"system",content:w},{role:"user",content:`${n.sender} (via ${n.channel}): ${s}
|
|
21
|
-
|
|
22
|
-
Agent: ${r}`}],{model:y,maxTokens:512})).content.trim().match(/\[[\s\S]*\]/);if(!i)return;let a=JSON.parse(i[0]);if(!Array.isArray(a)||a.length===0)return;let m=new Date().toISOString().slice(0,10),p=u(n.channel);for(let t of a)typeof t?.content=="string"&&(t.category==="secret"||f(t.content)||o.hasSimilar(e,t.content)||o.addMemory(e,{agentId:e,category:t.category,content:t.content,keywords:t.keywords||[],source:{...n,date:m,trust:p},expiresAt:t.category==="task-state"?new Date(Date.now()+7*24*60*60*1e3).toISOString():void 0}));Math.random()<.02&&o.prune(e)}export{l as a,I as b};
|
|
23
|
-
//# sourceMappingURL=chunk-LE3BXIUF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wiki/capture-filter.ts","../src/agents/memory-extract.ts"],"sourcesContent":["// What deserves to become a raw wiki entry.\n//\n// Until now the only gate was `response.content.length > 50`. Every agent\n// task was captured, with the task's own message as the \"User:\" half — so\n// a cron's prompt became an entry, a role brief became an entry, and a\n// \"[MISSED RUN]\" notice became an entry.\n//\n// Measured over the 10,703 entries that produced: 30% arrived on a\n// machine-origin channel, 33% are prompt-shaped, and 47.5% are one or\n// both. That is the bulk of a corpus that has yielded 257 articles and is\n// read about three times a quarter.\n//\n// These rules are deterministic and free. They are deliberately\n// conservative — each one describes a shape that cannot contain knowledge\n// about the world, rather than guessing at value. Judging whether the\n// REMAINDER is worth keeping is a different question, and belongs to the\n// entry-triage seat, which costs money and can be wrong.\n\n/** Channels where both sides of the exchange are machines. A cron's\n * prompt is configuration, and its reply is a status report. */\nconst MACHINE_CHANNELS = new Set([\"cron\", \"a2a\", \"workflow\", \"selftest\"])\n\n/** Shapes that are an instruction to an agent, not a record of anything.\n * Anchored at the start of the captured content, which always begins\n * \"User: \" followed by the task message. */\nconst PROMPT_SHAPES: Array<[RegExp, string]> = [\n [/^User:\\s*You are\\s/i, \"role brief\"],\n [/^User:\\s*(Run|Execute)\\s/i, \"run instruction\"],\n [/^User:\\s*\\[MISSED RUN/i, \"missed cron run\"],\n // The bracketed prefix varies: some arrive as \"[Group, 09:43]: [Recent\n // group conversation]\". Anchoring on the bare marker missed 367 entries\n // in the first purge, so allow one leading bracketed segment.\n [/^User:\\s*(\\[[^\\]]{0,40}\\]:?\\s*)?\\[Recent group conversation\\]/i, \"group chat dump\"],\n]\n\nexport interface CaptureDecision {\n capture: boolean\n /** Why it was rejected, for logging and for counting what the filter\n * actually removes once it is live. */\n reason?: string\n}\n\nexport function shouldCaptureEntry(input: {\n channel: string | undefined\n content: string\n responseLength: number\n}): CaptureDecision {\n if (input.responseLength <= 50) return { capture: false, reason: \"response too short\" }\n\n const channel = (input.channel ?? \"\").toLowerCase()\n // Channels carry a node suffix: \"telegram@peer-server\".\n const base = channel.split(\"@\")[0]\n if (MACHINE_CHANNELS.has(base)) return { capture: false, reason: `machine channel: ${base}` }\n\n const head = input.content.slice(0, 400)\n for (const [shape, reason] of PROMPT_SHAPES) {\n if (shape.test(head)) return { capture: false, reason }\n }\n\n return { capture: true }\n}\n","import type { MemoryStore } from \"./memory-store\"\nimport { shouldCaptureEntry } from \"@/wiki/capture-filter\"\nimport { containsSecret, trustForChannel } from \"./memory-trust\"\n\n// --- Haiku-powered memory extraction ---\n// Fire-and-forget after each agent response.\n// Extracts memorable facts and writes them to the persistent store.\n\nconst EXTRACTION_MODEL = \"claude-haiku-4-5-20251001\"\n\nconst EXTRACTION_PROMPT = `You are a memory extraction system for an AI agent. Given a conversation exchange, extract facts worth remembering for future conversations across different chat sessions.\n\nExtract ONLY facts that would help the agent in FUTURE, DIFFERENT conversations:\n- User preferences and instructions (\"never do X\", \"always use Y\")\n- Commitments the agent made (\"I will deploy by Friday\")\n- Relationships (\"Alex is the admin\", \"Marketing handles content\")\n- Task state (\"GitLab tokens need deploying to peer-server\")\n- Important facts about infrastructure, config, or processes\n\nSKIP:\n- Credentials of any kind: passwords, tokens, API keys, private keys, connection strings. Never repeat one, not even partly. At most note that a credential exists and where it is kept, without its value.\n- Routine greetings, acknowledgments, status updates\n- Information derivable from code or config files\n- Transient conversation flow (\"let me check\", \"here's what I found\")\n- Facts already obvious from the agent's system prompt\n\nFor each fact, output a JSON array:\n[{\"category\":\"fact|preference|commitment|task-state\",\"content\":\"concise fact, 1-2 sentences\",\"keywords\":[\"keyword1\",\"keyword2\"]}]\n\nIf nothing worth remembering, output: []`\n\nexport async function extractMemories(\n agentId: string,\n userMessage: string,\n agentResponse: string,\n source: { channel: string; chatId: string; sender: string },\n store: MemoryStore,\n): Promise<void> {\n // Skip very short exchanges (unlikely to contain memorable facts)\n if (userMessage.length < 20 && agentResponse.length < 50) return\n\n // Same gate as wiki capture: machine channels (cron, a2a, workflow) and\n // prompt-shaped messages hold configuration, not facts about the world.\n const gate = shouldCaptureEntry({\n channel: source.channel,\n content: `User: ${userMessage}`,\n responseLength: agentResponse.length,\n })\n if (!gate.capture) return\n\n const { createProvider } = await import(\"@/agent/providers\")\n const provider = createProvider(\"claude\")\n\n const result = await provider.generate(\n [\n { role: \"system\", content: EXTRACTION_PROMPT },\n {\n role: \"user\",\n content: `${source.sender} (via ${source.channel}): ${userMessage}\\n\\nAgent: ${agentResponse}`,\n },\n ],\n { model: EXTRACTION_MODEL, maxTokens: 512 },\n )\n\n // Parse JSON array from response\n const content = result.content.trim()\n const jsonMatch = content.match(/\\[[\\s\\S]*\\]/)\n if (!jsonMatch) return\n\n const facts = JSON.parse(jsonMatch[0]) as Array<{\n category: string\n content: string\n keywords: string[]\n }>\n\n if (!Array.isArray(facts) || facts.length === 0) return\n\n const date = new Date().toISOString().slice(0, 10)\n const trust = trustForChannel(source.channel)\n\n for (const fact of facts) {\n if (typeof fact?.content !== \"string\") continue\n // The prompt says never to extract credentials; this holds when the\n // model does it anyway. addMemory refuses them too.\n if (fact.category === \"secret\" || containsSecret(fact.content)) continue\n // Skip duplicates\n if (store.hasSimilar(agentId, fact.content)) continue\n\n store.addMemory(agentId, {\n agentId,\n category: fact.category as any,\n content: fact.content,\n keywords: fact.keywords || [],\n source: { ...source, date, trust },\n expiresAt: fact.category === \"task-state\"\n ? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString()\n : undefined,\n })\n }\n\n // Prune occasionally (every ~50 calls, probabilistic)\n if (Math.random() < 0.02) {\n store.prune(agentId)\n }\n}\n"],"mappings":"+CAoBA,IAAMA,EAAmB,IAAI,IAAI,CAAC,OAAQ,MAAO,WAAY,UAAU,CAAC,EAKlEC,EAAyC,CAC7C,CAAC,sBAAuB,YAAY,EACpC,CAAC,4BAA6B,iBAAiB,EAC/C,CAAC,yBAA0B,iBAAiB,EAI5C,CAAC,iEAAkE,iBAAiB,CACtF,EASO,SAASC,EAAmBC,EAIf,CAClB,GAAIA,EAAM,gBAAkB,GAAI,MAAO,CAAE,QAAS,GAAO,OAAQ,oBAAqB,EAItF,IAAMC,GAFWD,EAAM,SAAW,IAAI,YAAY,EAE7B,MAAM,GAAG,EAAE,CAAC,EACjC,GAAIH,EAAiB,IAAII,CAAI,EAAG,MAAO,CAAE,QAAS,GAAO,OAAQ,oBAAoBA,GAAO,EAE5F,IAAMC,EAAOF,EAAM,QAAQ,MAAM,EAAG,GAAG,EACvC,OAAW,CAACG,EAAOC,CAAM,IAAKN,EAC5B,GAAIK,EAAM,KAAKD,CAAI,EAAG,MAAO,CAAE,QAAS,GAAO,OAAAE,CAAO,EAGxD,MAAO,CAAE,QAAS,EAAK,CACzB,CCpDA,IAAMC,EAAmB,4BAEnBC,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0CAqB1B,eAAsBC,EACpBC,EACAC,EACAC,EACAC,EACAC,EACe,CAWf,GATIH,EAAY,OAAS,IAAMC,EAAc,OAAS,IASlD,CALSG,EAAmB,CAC9B,QAASF,EAAO,QAChB,QAAS,SAASF,IAClB,eAAgBC,EAAc,MAChC,CAAC,EACS,QAAS,OAEnB,GAAM,CAAE,eAAAI,CAAe,EAAI,KAAM,QAAO,yBAAmB,EAgBrDC,GAbS,MAFED,EAAe,QAAQ,EAEV,SAC5B,CACE,CAAE,KAAM,SAAU,QAASR,CAAkB,EAC7C,CACE,KAAM,OACN,QAAS,GAAGK,EAAO,eAAeA,EAAO,aAAaF;AAAA;AAAA,SAAyBC,GACjF,CACF,EACA,CAAE,MAAOL,EAAkB,UAAW,GAAI,CAC5C,GAGuB,QAAQ,KAAK,EACV,MAAM,aAAa,EAC7C,GAAI,CAACU,EAAW,OAEhB,IAAMC,EAAQ,KAAK,MAAMD,EAAU,CAAC,CAAC,EAMrC,GAAI,CAAC,MAAM,QAAQC,CAAK,GAAKA,EAAM,SAAW,EAAG,OAEjD,IAAMC,EAAO,IAAI,KAAK,EAAE,YAAY,EAAE,MAAM,EAAG,EAAE,EAC3CC,EAAQC,EAAgBR,EAAO,OAAO,EAE5C,QAAWS,KAAQJ,EACb,OAAOI,GAAM,SAAY,WAGzBA,EAAK,WAAa,UAAYC,EAAeD,EAAK,OAAO,GAEzDR,EAAM,WAAWJ,EAASY,EAAK,OAAO,GAE1CR,EAAM,UAAUJ,EAAS,CACvB,QAAAA,EACA,SAAUY,EAAK,SACf,QAASA,EAAK,QACd,SAAUA,EAAK,UAAY,CAAC,EAC5B,OAAQ,CAAE,GAAGT,EAAQ,KAAAM,EAAM,MAAAC,CAAM,EACjC,UAAWE,EAAK,WAAa,aACzB,IAAI,KAAK,KAAK,IAAI,EAAI,EAAI,GAAK,GAAK,GAAK,GAAI,EAAE,YAAY,EAC3D,MACN,CAAC,GAIC,KAAK,OAAO,EAAI,KAClBR,EAAM,MAAMJ,CAAO,CAEvB","names":["MACHINE_CHANNELS","PROMPT_SHAPES","shouldCaptureEntry","input","base","head","shape","reason","EXTRACTION_MODEL","EXTRACTION_PROMPT","extractMemories","agentId","userMessage","agentResponse","source","store","shouldCaptureEntry","createProvider","jsonMatch","facts","date","trust","trustForChannel","fact","containsSecret"]}
|