Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(ts-sdk): accept the memory_query page filters

4nrrydd29970fb96d
diff --git a/companions/ai-memory-ts/CHANGELOG.md b/companions/ai-memory-ts/CHANGELOG.md
index 34f3f78d..246da631 100644
--- a/companions/ai-memory-ts/CHANGELOG.md
+++ b/companions/ai-memory-ts/CHANGELOG.md
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- `query` takes the server's `memory_query` page filters: `kind`, `tier`,
+ `pathPrefix` and `tag`, in every search mode.
+
## [0.1.0]
### Added
diff --git a/companions/ai-memory-ts/docs/arguments.md b/companions/ai-memory-ts/docs/arguments.md
index feea3655..4c764020 100644
--- a/companions/ai-memory-ts/docs/arguments.md
+++ b/companions/ai-memory-ts/docs/arguments.md
@@ -71,6 +71,10 @@ Methods: `query`
| `as_of` | `asOf` |
| `answer` | `answer` |
| `reasoning` | `reasoning` |
+| `kind` | `kind` |
+| `tier` | `tier` |
+| `path_prefix` | `pathPrefix` |
+| `tag` | `tag` |
## `memory_status`
diff --git a/companions/ai-memory-ts/schema/tools.json b/companions/ai-memory-ts/schema/tools.json
index dfe581a1..5146a071 100644
--- a/companions/ai-memory-ts/schema/tools.json
+++ b/companions/ai-memory-ts/schema/tools.json
@@ -586,12 +586,24 @@
"null"
]
},
+ "kind": {
+ "type": [
+ "null",
+ "string"
+ ]
+ },
"limit": {
"type": [
"integer",
"null"
]
},
+ "path_prefix": {
+ "type": [
+ "null",
+ "string"
+ ]
+ },
"pin_first": {
"type": [
"boolean",
@@ -638,6 +650,18 @@
},
"type": "array"
},
+ "tag": {
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ "tier": {
+ "type": [
+ "null",
+ "string"
+ ]
+ },
"workspace": {
"type": [
"null",
diff --git a/companions/ai-memory-ts/src/client.ts b/companions/ai-memory-ts/src/client.ts
index 18b0dc2c..027c6d54 100644
--- a/companions/ai-memory-ts/src/client.ts
+++ b/companions/ai-memory-ts/src/client.ts
@@ -698,6 +698,10 @@ export class AiMemoryClient {
limit: a.limit,
include_expired: a.includeExpired === true ? true : undefined,
explain: a.explain === true ? true : undefined,
+ kind: a.kind,
+ tier: a.tier,
+ path_prefix: a.pathPrefix,
+ tag: a.tag,
};
let wireArgs: Record<string, unknown>;
const isGlobal = a.global === true;
diff --git a/companions/ai-memory-ts/src/coverage.ts b/companions/ai-memory-ts/src/coverage.ts
index 8d82f58a..944ef109 100644
--- a/companions/ai-memory-ts/src/coverage.ts
+++ b/companions/ai-memory-ts/src/coverage.ts
@@ -86,6 +86,10 @@ export const TOOL_COVERAGE: Readonly<Record<string, ToolClassification>> = {
"as_of",
"answer",
"reasoning",
+ "kind",
+ "tier",
+ "path_prefix",
+ "tag",
],
},
memory_status: { status: "wrapped", methods: ["status"], phase: 1, sends: [...SCOPE] },
diff --git a/companions/ai-memory-ts/src/types.ts b/companions/ai-memory-ts/src/types.ts
index 16dcc573..100e927f 100644
--- a/companions/ai-memory-ts/src/types.ts
+++ b/companions/ai-memory-ts/src/types.ts
@@ -213,6 +213,14 @@ interface QueryBase {
includeExpired?: boolean;
/** Attach score provenance to hits (diagnostics). */
explain?: boolean;
+ /** Keep only pages of this kind (ASCII case-insensitive; custom kinds allowed). */
+ kind?: string;
+ /** Keep only pages in this memory tier. */
+ tier?: Tier;
+ /** Keep only pages whose project-relative path starts with this literal prefix. */
+ pathPrefix?: string;
+ /** Keep only pages whose frontmatter `tags` contain this exact tag (ASCII case-insensitive). */
+ tag?: string;
}
/** Search one project: the call's `scope` or the client default. */
diff --git a/companions/ai-memory-ts/test/unit/client.test.ts b/companions/ai-memory-ts/test/unit/client.test.ts
index b83a9f95..c3329b13 100644
--- a/companions/ai-memory-ts/test/unit/client.test.ts
+++ b/companions/ai-memory-ts/test/unit/client.test.ts
@@ -532,6 +532,10 @@ describe("wire names", () => {
asOf: "2026-01-01T00:00:00Z",
answer: true,
reasoning: "low",
+ kind: "decision",
+ tier: "semantic",
+ pathPrefix: "decisions/",
+ tag: "t",
}),
memory.query({ query: "q", scopes: [SCOPE] }),
memory.query({ query: "q", global: true }),