aismemory 0.8.7 → 0.8.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
@@ -37,7 +37,7 @@ Add to your IDE's MCP server config:
37
37
  "mcpServers": {
38
38
  "aismemory": {
39
39
  "command": "npx",
40
- "args": ["aismemory@0.8.7"],
40
+ "args": ["aismemory@0.8.8"],
41
41
  "env": {
42
42
  "npm_config_audit": "false",
43
43
  "npm_config_fund": "false"
@@ -117,6 +117,7 @@ unreachable, they print one warning line and let the session carry on.
117
117
  | `goal_create` | Create a new goal for the current agent |
118
118
  | `goal_list` | List goals for the current agent, with status/parent filters |
119
119
  | `goal_update_progress` | Update a goal's progress (0-100) |
120
+ | `goal_activate` | Activate one of your own draft goals so it shows in your context |
120
121
  | `goal_complete` | Mark a goal complete (success or failure) |
121
122
  | `operating_layer_put` | Store one rule or skill in this agent's OWN operating layer, so it loads in every tool connected to the agent (`full_context` / `agent_load`). Agent API key only; takes no agent argument; only when the human asked |
122
123
  | `agent_archive` | Archive one of your own agents by id. Restorable; nothing is deleted. Owner sign-in only |
@@ -324,7 +325,7 @@ mint a new one.
324
325
  "mcpServers": {
325
326
  "aismemory": {
326
327
  "command": "npx",
327
- "args": ["aismemory@0.8.7"],
328
+ "args": ["aismemory@0.8.8"],
328
329
  "env": {
329
330
  "AIS_WORKSPACE_KEY": "ais_wk_...",
330
331
  "AIS_AGENT_ID": "<the agent to start with>",
@@ -27,7 +27,7 @@ import { emitTelemetry } from './telemetry.js';
27
27
  import { retryAfterOf, shouldHonourRetryAfter, sleepSeconds } from './retry-after.js';
28
28
  import { getAisRequestTimeoutMs, toAisRequestError } from './request-timeout.js';
29
29
  import { withDeclaredAgent } from './declared-agent.js';
30
- import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseInboxSendArgs, parseInboxReadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalCompleteArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
30
+ import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseInboxSendArgs, parseInboxReadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
31
31
  import { readInboxAndMaybeAck } from './inbox-client.js';
32
32
  import { AGENT_ARCHIVE_KEY_MODE_DETAIL } from './agent-archive.js';
33
33
  import { OPERATING_LAYER_PUT_TOOL, putOperatingLayerEntry } from './operating-layer-write.js';
@@ -351,6 +351,10 @@ export async function dispatchToolKeyMode(aisUrl, config, name, rawArgs, fetchIm
351
351
  progress: args.progress,
352
352
  }, fetchImpl);
353
353
  }
354
+ case 'goal_activate': {
355
+ const args = parseGoalActivateArgs(rawArgs);
356
+ return aisKeyPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/activate`, apiKey, {}, fetchImpl);
357
+ }
354
358
  case 'goal_complete': {
355
359
  const args = parseGoalCompleteArgs(rawArgs);
356
360
  return aisKeyPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/complete`, apiKey, {
@@ -8,10 +8,14 @@ export declare class ActivityTracker {
8
8
  getStoredMemoryCount(): number;
9
9
  getStoredMemories(): string[];
10
10
  hasActivity(): boolean;
11
+ /** Drop everything recorded so far; used when the session switches agents. */
12
+ reset(): void;
11
13
  }
12
14
  export interface HandoffPayload {
13
15
  summary: string;
14
16
  keyLearnings: string[];
15
17
  }
16
18
  export declare function buildHandoffPayload(tracker: ActivityTracker): HandoffPayload;
17
- export declare function setupAutoHandoff(aisUrl: string, agentId: string, token: string, tracker: ActivityTracker, onBeforeExit?: () => void, beforeWrite?: () => Promise<void>): () => void;
19
+ export declare function setupAutoHandoff(aisUrl: string, agentId: string, token: string, tracker: ActivityTracker,
20
+ /** Called once at exit; `saved` is true only when the server accepted the handoff. */
21
+ onBeforeExit?: (saved: boolean) => void, beforeWrite?: () => Promise<void>): () => void;
@@ -32,6 +32,12 @@ export class ActivityTracker {
32
32
  hasActivity() {
33
33
  return Object.keys(this.toolCounts).length > 0;
34
34
  }
35
+ /** Drop everything recorded so far; used when the session switches agents. */
36
+ reset() {
37
+ this.toolCounts = {};
38
+ this.storedMemories = [];
39
+ this.storedMemoryCount = 0;
40
+ }
35
41
  }
36
42
  export function buildHandoffPayload(tracker) {
37
43
  if (!tracker.hasActivity()) {
@@ -70,7 +76,9 @@ async function describeHandoffFailure(response) {
70
76
  }
71
77
  return `HTTP ${response.status}${detail}`;
72
78
  }
73
- export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit, beforeWrite) {
79
+ export function setupAutoHandoff(aisUrl, agentId, token, tracker,
80
+ /** Called once at exit; `saved` is true only when the server accepted the handoff. */
81
+ onBeforeExit, beforeWrite) {
74
82
  let exiting = false;
75
83
  const doHandoff = async () => {
76
84
  if (exiting)
@@ -79,6 +87,7 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
79
87
  if (!tracker.hasActivity())
80
88
  return;
81
89
  const payload = buildHandoffPayload(tracker);
90
+ let saved = false;
82
91
  try {
83
92
  if (beforeWrite)
84
93
  await beforeWrite();
@@ -93,6 +102,7 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
93
102
  // handoff and the session exits as though its handoff had landed, which
94
103
  // is exactly how a production 500 on this route stayed invisible to
95
104
  // every client (tester reconciliation 2026-09-17, defect 2).
105
+ saved = response.ok;
96
106
  if (!response.ok) {
97
107
  process.stderr.write(`[aismemory] Auto-handoff was NOT saved — the server rejected it (${await describeHandoffFailure(response)}). This session's handoff is lost.\n`);
98
108
  }
@@ -101,7 +111,7 @@ export function setupAutoHandoff(aisUrl, agentId, token, tracker, onBeforeExit,
101
111
  process.stderr.write(`[aismemory] Auto-handoff stopped: ${error instanceof Error ? error.message : String(error)}\n`);
102
112
  }
103
113
  if (onBeforeExit)
104
- onBeforeExit();
114
+ onBeforeExit(saved);
105
115
  };
106
116
  const onSignal = () => {
107
117
  void doHandoff().finally(() => process.exit(0));
@@ -589,6 +589,14 @@ function isJsonObject(value) {
589
589
  function deepJsonEqual(a, b) {
590
590
  return JSON.stringify(a) === JSON.stringify(b);
591
591
  }
592
+ function jsonTextEquals(text, expected) {
593
+ try {
594
+ return deepJsonEqual(JSON.parse(text), expected);
595
+ }
596
+ catch {
597
+ return false;
598
+ }
599
+ }
592
600
  function detectJsonIndent(existingJson) {
593
601
  const trailingNewline = existingJson.endsWith('\n');
594
602
  const firstIndented = existingJson.split('\n').find((line) => /^\s+\S/.test(line));
@@ -599,6 +607,139 @@ function detectJsonIndent(existingJson) {
599
607
  const spaces = m?.[1]?.length ?? 2;
600
608
  return { space: spaces, trailingNewline };
601
609
  }
610
+ function skipJsonWhitespace(text, from) {
611
+ let i = from;
612
+ while (i < text.length && /\s/.test(text.charAt(i)))
613
+ i++;
614
+ return i;
615
+ }
616
+ /** Index just past the string that opens at `open`, or -1 when it never closes. */
617
+ function endOfJsonString(text, open) {
618
+ let i = open + 1;
619
+ while (i < text.length) {
620
+ const ch = text.charAt(i);
621
+ if (ch === '\\')
622
+ i += 2;
623
+ else if (ch === '"')
624
+ return i + 1;
625
+ else
626
+ i++;
627
+ }
628
+ return -1;
629
+ }
630
+ /** Index just past the JSON value that starts at `from`, or -1 when it is malformed. */
631
+ function endOfJsonValue(text, from) {
632
+ const first = text.charAt(from);
633
+ if (first === '"')
634
+ return endOfJsonString(text, from);
635
+ if (first === '{' || first === '[') {
636
+ let depth = 0;
637
+ let i = from;
638
+ while (i < text.length) {
639
+ const ch = text.charAt(i);
640
+ if (ch === '"') {
641
+ i = endOfJsonString(text, i);
642
+ if (i === -1)
643
+ return -1;
644
+ continue;
645
+ }
646
+ if (ch === '{' || ch === '[')
647
+ depth++;
648
+ else if (ch === '}' || ch === ']') {
649
+ depth--;
650
+ if (depth === 0)
651
+ return i + 1;
652
+ }
653
+ i++;
654
+ }
655
+ return -1;
656
+ }
657
+ let i = from;
658
+ while (i < text.length && !/[\s,}\]]/.test(text.charAt(i)))
659
+ i++;
660
+ return i > from ? i : -1;
661
+ }
662
+ /** The direct members of the object whose `{` is at `open`, or null when the text is not plain JSON. */
663
+ function scanJsonObjectMembers(text, open) {
664
+ if (text.charAt(open) !== '{')
665
+ return null;
666
+ const members = [];
667
+ let i = skipJsonWhitespace(text, open + 1);
668
+ if (text.charAt(i) === '}')
669
+ return { members, close: i };
670
+ for (;;) {
671
+ if (text.charAt(i) !== '"')
672
+ return null;
673
+ const keyEnd = endOfJsonString(text, i);
674
+ if (keyEnd === -1)
675
+ return null;
676
+ let key;
677
+ try {
678
+ key = JSON.parse(text.slice(i, keyEnd));
679
+ }
680
+ catch {
681
+ return null;
682
+ }
683
+ const colon = skipJsonWhitespace(text, keyEnd);
684
+ if (text.charAt(colon) !== ':')
685
+ return null;
686
+ const valueStart = skipJsonWhitespace(text, colon + 1);
687
+ const end = endOfJsonValue(text, valueStart);
688
+ if (end === -1)
689
+ return null;
690
+ members.push({ key, start: i, end, valueStart });
691
+ const after = skipJsonWhitespace(text, end);
692
+ if (text.charAt(after) === '}')
693
+ return { members, close: after };
694
+ if (text.charAt(after) !== ',')
695
+ return null;
696
+ i = skipJsonWhitespace(text, after + 1);
697
+ }
698
+ }
699
+ /** The members of the root object's `mcpServers` object, or null when it cannot be located in plain text. */
700
+ function scanMcpServersMembers(text) {
701
+ const rootOpen = skipJsonWhitespace(text, 0);
702
+ const root = scanJsonObjectMembers(text, rootOpen);
703
+ if (root === null)
704
+ return null;
705
+ const servers = root.members.find((m) => m.key === 'mcpServers');
706
+ if (servers === undefined)
707
+ return null;
708
+ return scanJsonObjectMembers(text, servers.valueStart);
709
+ }
710
+ /** Add one server as the last `mcpServers` member by editing the text, or null when the layout is not simple. */
711
+ function insertJsonMcpEntryInPlace(existingJson, serverName, entry, space) {
712
+ const scanned = scanMcpServersMembers(existingJson);
713
+ const last = scanned?.members[scanned.members.length - 1];
714
+ if (scanned === null || last === undefined)
715
+ return null;
716
+ const lineStart = existingJson.lastIndexOf('\n', last.start) + 1;
717
+ const indent = existingJson.slice(lineStart, last.start);
718
+ if (!/^[ \t]+$/.test(indent))
719
+ return null;
720
+ const body = JSON.stringify(entry, null, space)
721
+ .split('\n')
722
+ .map((line, idx) => (idx === 0 ? line : `${indent}${line}`))
723
+ .join('\n');
724
+ return `${existingJson.slice(0, last.end)},\n${indent}${JSON.stringify(serverName)}: ${body}${existingJson.slice(last.end)}`;
725
+ }
726
+ /** Drop one `mcpServers` member by editing the text, or null when the layout is not simple. */
727
+ function removeJsonMcpEntryInPlace(existingJson, serverName) {
728
+ const scanned = scanMcpServersMembers(existingJson);
729
+ if (scanned === null || scanned.members.length < 2)
730
+ return null;
731
+ const idx = scanned.members.findIndex((m) => m.key === serverName);
732
+ const member = scanned.members[idx];
733
+ if (member === undefined)
734
+ return null;
735
+ const previous = scanned.members[idx - 1];
736
+ const next = scanned.members[idx + 1];
737
+ if (next !== undefined)
738
+ return existingJson.slice(0, member.start) + existingJson.slice(next.start);
739
+ if (previous === undefined)
740
+ return null;
741
+ return existingJson.slice(0, previous.end) + existingJson.slice(member.end);
742
+ }
602
743
  /** Parse JSON, add only `mcpServers.<name>`, verify no other keys or servers change. */
603
744
  function mergeJsonMcpConfigPreserving(existingJson, agentId, version, serverName, configPath) {
604
745
  const parsed = parseJsonFile(configPath, existingJson);
@@ -613,7 +754,10 @@ function mergeJsonMcpConfigPreserving(existingJson, agentId, version, serverName
613
754
  const nextRoot = { ...parsed, mcpServers: { ...servers, [serverName]: entry } };
614
755
  const { space, trailingNewline } = detectJsonIndent(existingJson);
615
756
  const serialized = JSON.stringify(nextRoot, null, space);
616
- const withNl = trailingNewline ? `${serialized}\n` : serialized;
757
+ const reserialized = trailingNewline ? `${serialized}\n` : serialized;
758
+ // Keep the person's own layout when the entry can be added as plain text and still parses to the same object.
759
+ const inPlace = insertJsonMcpEntryInPlace(existingJson, serverName, entry, space);
760
+ const withNl = inPlace !== null && jsonTextEquals(inPlace, nextRoot) ? inPlace : reserialized;
617
761
  let reparsed;
618
762
  try {
619
763
  reparsed = JSON.parse(withNl);
@@ -707,6 +851,10 @@ export function removeJsonMcpEntry(existingJson, serverName, configPath, keepEmp
707
851
  delete root['mcpServers'];
708
852
  else
709
853
  root['mcpServers'] = merged;
854
+ // Other servers remain: cut the one member out of the text so the file keeps its layout.
855
+ const inPlace = Object.keys(merged).length > 0 ? removeJsonMcpEntryInPlace(existingJson, serverName) : null;
856
+ if (inPlace !== null && jsonTextEquals(inPlace, root))
857
+ return inPlace;
710
858
  return stableStringifyMcp(root);
711
859
  }
712
860
  function codexMcpTableHeader(serverName) {
package/dist/index.js CHANGED
@@ -679,6 +679,7 @@ const tools = [
679
679
  view: { type: 'string', enum: ['full', 'lean', 'bootstrap'], description: "Which projection to load. 'full' (default) is everything the stores hold, bounded to 6000 tokens. 'lean' is continuity only — last handoff first, then recent memories. 'bootstrap' is lean plus goals and inbox, for starting a session in another harness. All three honour maxTokens." },
680
680
  maxTokens: { type: 'number', description: 'Token ceiling (500-20000; default 6000 for full, 2000 for lean, 3000 for bootstrap). Content is evicted from the tail until the payload fits — assembled context sections, then facts, then goals, then recent memories on the full view — and each eviction is named in receipt.omitted. Identity, the operating layer and the last handoff are never dropped.' },
681
681
  openOrdersLimit: { type: 'number', description: 'Number of newest open task memories to include in bootstrap view (1-50; default 10).' },
682
+ harness: { type: 'string', description: 'Your current harness for session-specific guidance: chatgpt, claude-code, claude-desktop, codex, cursor, or grokbot. Omit when unknown. Unrecognized names receive no harness guidance.' },
682
683
  contextWindowSize: { type: 'number', description: "Your model's context window in tokens (1000-10000000). The skills budget scales with it; omit for the server default." },
683
684
  tags: { type: 'array', items: { type: 'string' }, description: 'Only memories carrying every one of these tags (forwarded to AIS). Memories tagged no-lean are omitted from lean and bootstrap reads unless you pass your own tags, anyTags, or excludeTags.' },
684
685
  anyTags: { type: 'array', items: { type: 'string' }, description: 'Only memories carrying at least one of these tags (forwarded to AIS). Memories tagged no-lean are omitted from lean and bootstrap reads unless you pass your own tags, anyTags, or excludeTags.' },
@@ -878,6 +879,17 @@ const tools = [
878
879
  required: ['goalId', 'progress'],
879
880
  },
880
881
  },
882
+ {
883
+ name: 'goal_activate',
884
+ description: 'Activate one of your own draft goals so it appears in your context. New goals start as draft.',
885
+ inputSchema: {
886
+ type: 'object',
887
+ properties: {
888
+ goalId: { type: 'string', description: 'The id of the goal.' },
889
+ },
890
+ required: ['goalId'],
891
+ },
892
+ },
881
893
  {
882
894
  name: 'goal_complete',
883
895
  description: 'Mark a goal as complete (success or failure). Records the outcome for success-rate tracking.',
@@ -1404,9 +1416,10 @@ async function main() {
1404
1416
  }
1405
1417
  function installAutoHandoff(c) {
1406
1418
  removeAutoHandoff?.();
1407
- removeAutoHandoff = setupAutoHandoff(AIS_URL, c.agentId, c.token, activityTracker, () => {
1419
+ removeAutoHandoff = setupAutoHandoff(AIS_URL, c.agentId, c.token, activityTracker, (saved) => {
1408
1420
  stopRefreshTimer();
1409
- stderr('Session handoff saved');
1421
+ if (saved)
1422
+ stderr('Session handoff saved');
1410
1423
  }, () => verifyConfirmedIdentityForAutoHandoff(sessionIdentity, c.agentId, () => aisGet(`/v1/agents/${c.agentId}`, c.token), { credentialKey: identityCredentialFingerprint('oauth-bearer', c.token) }));
1411
1424
  }
1412
1425
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
@@ -1437,6 +1450,12 @@ async function main() {
1437
1450
  setCredentials: (next) => { creds = next; },
1438
1451
  setSessionAgentOverride: (next) => {
1439
1452
  sessionAgentOverride = next;
1453
+ // One agent's activity must never enter another agent's handoff.
1454
+ // The switch itself is the new agent's first recorded activity.
1455
+ if (next) {
1456
+ activityTracker.reset();
1457
+ activityTracker.recordToolUse('agent_load');
1458
+ }
1440
1459
  if (next && creds)
1441
1460
  installAutoHandoff({ ...creds, ...next });
1442
1461
  },
package/dist/mcp/tools.js CHANGED
@@ -19,7 +19,7 @@ import { saveOAuthCredentials } from '../oauth-credentials.js';
19
19
  import { hasEnrolledKey } from '../key-auth.js';
20
20
  import { emitTelemetry, hashAgentId } from '../telemetry.js';
21
21
  import { duplicateMemoryResult } from '../ais-http-error.js';
22
- import { parseAgentLoadArgs, parseEmptyToolArgs, parseHandoffArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalCompleteArgs, } from '../tool-args.js';
22
+ import { parseAgentLoadArgs, parseEmptyToolArgs, parseHandoffArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, } from '../tool-args.js';
23
23
  import { AGENT_LOAD_WRITE_REQUIRED, assertPinnedAgent, assertWriteIdentityConfirmed, clearPinnedIdentityConfirmation, identityCredentialFingerprint, requiresIdentityGate, sessionIdentityFromAgentLoad, switchedTo, unconfirmedWhoamiFromAgent, unconfirmedWhoamiPayload, verifyPinnedIdentity, whoamiMustDeferToAgentLoad, } from '../session-identity.js';
24
24
  import { readInboxAndMaybeAck } from '../inbox-client.js';
25
25
  import { OPERATING_LAYER_PUT_TOOL, OPERATING_LAYER_PUT_KEY_MODE_DETAIL } from '../operating-layer-write.js';
@@ -539,6 +539,11 @@ export function createOAuthCallToolHandler(ctx) {
539
539
  }, token);
540
540
  break;
541
541
  }
542
+ case 'goal_activate': {
543
+ const goalActivateArgs = parseGoalActivateArgs(rawArgs);
544
+ result = await aisPost(`/v1/agents/${agentId}/goals/${goalActivateArgs.goalId}/activate`, {}, token);
545
+ break;
546
+ }
542
547
  case 'goal_complete': {
543
548
  const goalCompleteArgs = parseGoalCompleteArgs(rawArgs);
544
549
  result = await aisPost(`/v1/agents/${agentId}/goals/${goalCompleteArgs.goalId}/complete`, {
@@ -16,7 +16,7 @@ import { readInboxAndMaybeAck } from './inbox-client.js';
16
16
  import { orient } from './cli/orientation.js';
17
17
  import { AGENT_ARCHIVE_KEY_MODE_DETAIL } from './agent-archive.js';
18
18
  import { fetchCredentialWhoami } from './credential-whoami.js';
19
- import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalCompleteArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
19
+ import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
20
20
  import { resolveDreamResponse } from './dream-poll.js';
21
21
  import { forgetOwnMemory } from './memory-forget.js';
22
22
  const AGENT_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -256,6 +256,10 @@ export async function dispatchToolRunPassMode(aisUrl, config, name, rawArgs, fet
256
256
  progress: args.progress,
257
257
  }, fetchImpl);
258
258
  }
259
+ case 'goal_activate': {
260
+ const args = parseGoalActivateArgs(rawArgs);
261
+ return runPassPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/activate`, runPassFile, {}, fetchImpl);
262
+ }
259
263
  case 'goal_complete': {
260
264
  const args = parseGoalCompleteArgs(rawArgs);
261
265
  return runPassPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/complete`, runPassFile, {
@@ -246,6 +246,7 @@ export function requiresIdentityGate(name, args) {
246
246
  'inbox_ack',
247
247
  'goal_create',
248
248
  'goal_update_progress',
249
+ 'goal_activate',
249
250
  'goal_complete',
250
251
  'operating_layer_put',
251
252
  ].includes(name) ||
@@ -93,6 +93,7 @@ export declare const fullContextArgsSchema: z.ZodObject<{
93
93
  lean: "lean";
94
94
  bootstrap: "bootstrap";
95
95
  }>>;
96
+ harness: z.ZodOptional<z.ZodString>;
96
97
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
98
  anyTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
99
  excludeTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -159,6 +160,9 @@ export declare const goalUpdateProgressArgsSchema: z.ZodObject<{
159
160
  goalId: z.ZodString;
160
161
  progress: z.ZodNumber;
161
162
  }, z.core.$strict>;
163
+ export declare const goalActivateArgsSchema: z.ZodObject<{
164
+ goalId: z.ZodString;
165
+ }, z.core.$strict>;
162
166
  export declare const goalCompleteArgsSchema: z.ZodObject<{
163
167
  goalId: z.ZodString;
164
168
  success: z.ZodBoolean;
@@ -200,6 +204,7 @@ export type InboxReadArgs = z.infer<typeof inboxReadArgsSchema>;
200
204
  export type GoalCreateArgs = z.infer<typeof goalCreateArgsSchema>;
201
205
  export type GoalListArgs = z.infer<typeof goalListArgsSchema>;
202
206
  export type GoalUpdateProgressArgs = z.infer<typeof goalUpdateProgressArgsSchema>;
207
+ export type GoalActivateArgs = z.infer<typeof goalActivateArgsSchema>;
203
208
  export type GoalCompleteArgs = z.infer<typeof goalCompleteArgsSchema>;
204
209
  export type InboxAckArgs = z.infer<typeof inboxAckArgsSchema>;
205
210
  export declare function formatValidationError(error: z.ZodError): string;
@@ -237,5 +242,6 @@ export declare function parseInboxReadArgs(raw: unknown): InboxReadArgs;
237
242
  export declare function parseGoalCreateArgs(raw: unknown): GoalCreateArgs;
238
243
  export declare function parseGoalListArgs(raw: unknown): GoalListArgs;
239
244
  export declare function parseGoalUpdateProgressArgs(raw: unknown): GoalUpdateProgressArgs;
245
+ export declare function parseGoalActivateArgs(raw: unknown): GoalActivateArgs;
240
246
  export declare function parseGoalCompleteArgs(raw: unknown): GoalCompleteArgs;
241
247
  export declare function parseInboxAckArgs(raw: unknown): InboxAckArgs;
package/dist/tool-args.js CHANGED
@@ -169,6 +169,7 @@ export const fullContextArgsSchema = z
169
169
  memoriesLimit: z.number().int().min(1).max(50).optional(),
170
170
  /** View mode: full (default), lean (bounded), bootstrap (cross-harness session start). */
171
171
  view: z.enum(['full', 'lean', 'bootstrap']).optional(),
172
+ harness: z.string().optional(),
172
173
  /** Only memories carrying every one of these tags (forwarded to AIS). */
173
174
  tags: tagsArgSchema.optional(),
174
175
  /** Only memories carrying at least one of these tags (forwarded to AIS). */
@@ -282,6 +283,7 @@ export const goalUpdateProgressArgsSchema = z
282
283
  progress: z.number().min(0).max(100),
283
284
  })
284
285
  .strict();
286
+ export const goalActivateArgsSchema = z.object({ goalId: goalUuidSchema }).strict();
285
287
  export const goalCompleteArgsSchema = z
286
288
  .object({
287
289
  goalId: goalUuidSchema,
@@ -467,6 +469,8 @@ export function buildFullContextQuery(args) {
467
469
  params.set('memoriesLimit', String(args.memoriesLimit));
468
470
  if (args.view !== undefined)
469
471
  params.set('view', args.view);
472
+ if (args.harness !== undefined)
473
+ params.set('harness', args.harness);
470
474
  if (args.maxTokens !== undefined)
471
475
  params.set('maxTokens', String(args.maxTokens));
472
476
  if (args.openOrdersLimit !== undefined)
@@ -499,6 +503,9 @@ export function parseGoalListArgs(raw) {
499
503
  export function parseGoalUpdateProgressArgs(raw) {
500
504
  return parseOrThrow(goalUpdateProgressArgsSchema, raw);
501
505
  }
506
+ export function parseGoalActivateArgs(raw) {
507
+ return parseOrThrow(goalActivateArgsSchema, raw);
508
+ }
502
509
  export function parseGoalCompleteArgs(raw) {
503
510
  return parseOrThrow(goalCompleteArgsSchema, raw);
504
511
  }
@@ -30,7 +30,7 @@ import { readInboxAndMaybeAck } from './inbox-client.js';
30
30
  import { orient } from './cli/orientation.js';
31
31
  import { AGENT_ARCHIVE_KEY_MODE_DETAIL } from './agent-archive.js';
32
32
  import { fetchCredentialWhoami } from './credential-whoami.js';
33
- import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseAgentLoadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalCompleteArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
33
+ import { parseEmptyToolArgs, parseRecallArgs, parseMemoryGetArgs, buildMemoryGetPath, shapeMemoryGetResult, buildFullContextQuery, parseFullContextArgs, buildRememberStoreBody, shapeRememberResult, parseRememberArgs, parseAgentLoadArgs, parseGoalCreateArgs, parseGoalListArgs, parseGoalUpdateProgressArgs, parseGoalActivateArgs, parseGoalCompleteArgs, parseInboxSendArgs, parseInboxReadArgs, parseInboxAckArgs, parseHandoffArgs, } from './tool-args.js';
34
34
  import { resolveDreamResponse } from './dream-poll.js';
35
35
  import { forgetOwnMemory } from './memory-forget.js';
36
36
  /** Thrown by loadWorkspaceKeyConfig when AIS_WORKSPACE_KEY is set without AIS_AGENT_ID. */
@@ -301,6 +301,10 @@ export async function dispatchToolWorkspaceKeyMode(aisUrl, config, name, rawArgs
301
301
  progress: args.progress,
302
302
  }, fetchImpl);
303
303
  }
304
+ case 'goal_activate': {
305
+ const args = parseGoalActivateArgs(rawArgs);
306
+ return wksKeyPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/activate`, workspaceKey, {}, fetchImpl);
307
+ }
304
308
  case 'goal_complete': {
305
309
  const args = parseGoalCompleteArgs(rawArgs);
306
310
  return wksKeyPost(aisUrl, `/v1/agents/${agentId}/goals/${args.goalId}/complete`, workspaceKey, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aismemory",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Persistent memory for AI agents. MCP server that connects to Agent Identity Service.",
5
5
  "mcpName": "ai.agentsandswarms/ais-memory",
6
6
  "type": "module",