bikky 0.3.1 → 0.3.3
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 +124 -35
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +22 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +61 -6
- package/dist/config.js.map +1 -1
- package/dist/config.test.js +17 -9
- package/dist/config.test.js.map +1 -1
- package/dist/daemon/capture-policy.d.ts +95 -0
- package/dist/daemon/capture-policy.d.ts.map +1 -0
- package/dist/daemon/capture-policy.js +139 -0
- package/dist/daemon/capture-policy.js.map +1 -0
- package/dist/daemon/capture-policy.test.d.ts +2 -0
- package/dist/daemon/capture-policy.test.d.ts.map +1 -0
- package/dist/daemon/capture-policy.test.js +46 -0
- package/dist/daemon/capture-policy.test.js.map +1 -0
- package/dist/daemon/consolidation.d.ts.map +1 -1
- package/dist/daemon/consolidation.js +84 -98
- package/dist/daemon/consolidation.js.map +1 -1
- package/dist/daemon/episode-summary.d.ts +72 -0
- package/dist/daemon/episode-summary.d.ts.map +1 -0
- package/dist/daemon/episode-summary.js +208 -0
- package/dist/daemon/episode-summary.js.map +1 -0
- package/dist/daemon/episode-summary.test.d.ts +2 -0
- package/dist/daemon/episode-summary.test.d.ts.map +1 -0
- package/dist/daemon/episode-summary.test.js +101 -0
- package/dist/daemon/episode-summary.test.js.map +1 -0
- package/dist/daemon/extraction.d.ts +25 -0
- package/dist/daemon/extraction.d.ts.map +1 -1
- package/dist/daemon/extraction.js +244 -124
- package/dist/daemon/extraction.js.map +1 -1
- package/dist/daemon/extraction.test.d.ts +2 -0
- package/dist/daemon/extraction.test.d.ts.map +1 -0
- package/dist/daemon/extraction.test.js +106 -0
- package/dist/daemon/extraction.test.js.map +1 -0
- package/dist/daemon/loop.d.ts.map +1 -1
- package/dist/daemon/loop.js +8 -6
- package/dist/daemon/loop.js.map +1 -1
- package/dist/daemon/qdrant.d.ts +59 -8
- package/dist/daemon/qdrant.d.ts.map +1 -1
- package/dist/daemon/qdrant.js +74 -23
- package/dist/daemon/qdrant.js.map +1 -1
- package/dist/daemon/qdrant.test.js +2 -2
- package/dist/daemon/qdrant.test.js.map +1 -1
- package/dist/daemon/relations.d.ts +6 -1
- package/dist/daemon/relations.d.ts.map +1 -1
- package/dist/daemon/relations.js +44 -63
- package/dist/daemon/relations.js.map +1 -1
- package/dist/daemon/session-index.d.ts +60 -0
- package/dist/daemon/session-index.d.ts.map +1 -0
- package/dist/daemon/session-index.js +136 -0
- package/dist/daemon/session-index.js.map +1 -0
- package/dist/daemon/session-index.test.d.ts +2 -0
- package/dist/daemon/session-index.test.d.ts.map +1 -0
- package/dist/daemon/session-index.test.js +54 -0
- package/dist/daemon/session-index.test.js.map +1 -0
- package/dist/daemon/session-summary.d.ts +69 -0
- package/dist/daemon/session-summary.d.ts.map +1 -0
- package/dist/daemon/session-summary.js +200 -0
- package/dist/daemon/session-summary.js.map +1 -0
- package/dist/daemon/session-summary.test.d.ts +2 -0
- package/dist/daemon/session-summary.test.d.ts.map +1 -0
- package/dist/daemon/session-summary.test.js +160 -0
- package/dist/daemon/session-summary.test.js.map +1 -0
- package/dist/daemon/staleness.test.d.ts +7 -0
- package/dist/daemon/staleness.test.d.ts.map +1 -0
- package/dist/daemon/staleness.test.js +128 -0
- package/dist/daemon/staleness.test.js.map +1 -0
- package/dist/daemon/workstream-summary.d.ts +61 -0
- package/dist/daemon/workstream-summary.d.ts.map +1 -0
- package/dist/daemon/workstream-summary.js +220 -0
- package/dist/daemon/workstream-summary.js.map +1 -0
- package/dist/daemon/workstream-summary.test.d.ts +2 -0
- package/dist/daemon/workstream-summary.test.d.ts.map +1 -0
- package/dist/daemon/workstream-summary.test.js +86 -0
- package/dist/daemon/workstream-summary.test.js.map +1 -0
- package/dist/lib/qdrant-client.d.ts +6 -1
- package/dist/lib/qdrant-client.d.ts.map +1 -1
- package/dist/lib/qdrant-client.js +3 -4
- package/dist/lib/qdrant-client.js.map +1 -1
- package/dist/lib/qdrant-client.test.js +21 -2
- package/dist/lib/qdrant-client.test.js.map +1 -1
- package/dist/lifecycle.test.d.ts +8 -0
- package/dist/lifecycle.test.d.ts.map +1 -0
- package/dist/lifecycle.test.js +74 -0
- package/dist/lifecycle.test.js.map +1 -0
- package/dist/llm/embedding/index.d.ts +42 -0
- package/dist/llm/embedding/index.d.ts.map +1 -0
- package/dist/llm/embedding/index.js +78 -0
- package/dist/llm/embedding/index.js.map +1 -0
- package/dist/llm/embedding/index.test.d.ts +8 -0
- package/dist/llm/embedding/index.test.d.ts.map +1 -0
- package/dist/llm/embedding/index.test.js +100 -0
- package/dist/llm/embedding/index.test.js.map +1 -0
- package/dist/llm/embedding/providers/bedrock.d.ts +16 -0
- package/dist/llm/embedding/providers/bedrock.d.ts.map +1 -0
- package/dist/llm/embedding/providers/bedrock.js +90 -0
- package/dist/llm/embedding/providers/bedrock.js.map +1 -0
- package/dist/llm/embedding/providers/bedrock.test.d.ts +2 -0
- package/dist/llm/embedding/providers/bedrock.test.d.ts.map +1 -0
- package/dist/llm/embedding/providers/bedrock.test.js +24 -0
- package/dist/llm/embedding/providers/bedrock.test.js.map +1 -0
- package/dist/llm/embedding/providers/index.d.ts +9 -0
- package/dist/llm/embedding/providers/index.d.ts.map +1 -0
- package/dist/llm/embedding/providers/index.js +9 -0
- package/dist/llm/embedding/providers/index.js.map +1 -0
- package/dist/llm/embedding/providers/ollama.d.ts +6 -0
- package/dist/llm/embedding/providers/ollama.d.ts.map +1 -0
- package/dist/llm/embedding/providers/ollama.js +39 -0
- package/dist/llm/embedding/providers/ollama.js.map +1 -0
- package/dist/llm/embedding/providers/ollama.test.d.ts +2 -0
- package/dist/llm/embedding/providers/ollama.test.d.ts.map +1 -0
- package/dist/llm/embedding/providers/ollama.test.js +54 -0
- package/dist/llm/embedding/providers/ollama.test.js.map +1 -0
- package/dist/llm/embedding/providers/openai.d.ts +6 -0
- package/dist/llm/embedding/providers/openai.d.ts.map +1 -0
- package/dist/llm/embedding/providers/openai.js +44 -0
- package/dist/llm/embedding/providers/openai.js.map +1 -0
- package/dist/llm/embedding/providers/openai.test.d.ts +2 -0
- package/dist/llm/embedding/providers/openai.test.d.ts.map +1 -0
- package/dist/llm/embedding/providers/openai.test.js +48 -0
- package/dist/llm/embedding/providers/openai.test.js.map +1 -0
- package/dist/llm/embedding/providers/portkey.d.ts +15 -0
- package/dist/llm/embedding/providers/portkey.d.ts.map +1 -0
- package/dist/llm/embedding/providers/portkey.js +58 -0
- package/dist/llm/embedding/providers/portkey.js.map +1 -0
- package/dist/llm/embedding/providers/portkey.test.d.ts +2 -0
- package/dist/llm/embedding/providers/portkey.test.d.ts.map +1 -0
- package/dist/llm/embedding/providers/portkey.test.js +56 -0
- package/dist/llm/embedding/providers/portkey.test.js.map +1 -0
- package/dist/llm/embedding/registry.d.ts +14 -0
- package/dist/llm/embedding/registry.d.ts.map +1 -0
- package/dist/llm/embedding/registry.js +27 -0
- package/dist/llm/embedding/registry.js.map +1 -0
- package/dist/llm/embedding/registry.test.d.ts +7 -0
- package/dist/llm/embedding/registry.test.d.ts.map +1 -0
- package/dist/llm/embedding/registry.test.js +68 -0
- package/dist/llm/embedding/registry.test.js.map +1 -0
- package/dist/llm/embedding/types.d.ts +55 -0
- package/dist/llm/embedding/types.d.ts.map +1 -0
- package/dist/llm/embedding/types.js +12 -0
- package/dist/llm/embedding/types.js.map +1 -0
- package/dist/llm/errors.d.ts +95 -0
- package/dist/llm/errors.d.ts.map +1 -0
- package/dist/llm/errors.js +164 -0
- package/dist/llm/errors.js.map +1 -0
- package/dist/llm/errors.test.d.ts +2 -0
- package/dist/llm/errors.test.d.ts.map +1 -0
- package/dist/llm/errors.test.js +103 -0
- package/dist/llm/errors.test.js.map +1 -0
- package/dist/llm/fetch.d.ts +39 -0
- package/dist/llm/fetch.d.ts.map +1 -0
- package/dist/llm/fetch.js +52 -0
- package/dist/llm/fetch.js.map +1 -0
- package/dist/llm/index.d.ts +6 -3
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +2 -2
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/inference/index.d.ts +39 -0
- package/dist/llm/inference/index.d.ts.map +1 -0
- package/dist/llm/inference/index.js +118 -0
- package/dist/llm/inference/index.js.map +1 -0
- package/dist/llm/inference/index.test.d.ts +6 -0
- package/dist/llm/inference/index.test.d.ts.map +1 -0
- package/dist/llm/inference/index.test.js +109 -0
- package/dist/llm/inference/index.test.js.map +1 -0
- package/dist/llm/inference/providers/bedrock.d.ts +18 -0
- package/dist/llm/inference/providers/bedrock.d.ts.map +1 -0
- package/dist/llm/inference/providers/bedrock.js +105 -0
- package/dist/llm/inference/providers/bedrock.js.map +1 -0
- package/dist/llm/inference/providers/bedrock.test.d.ts +2 -0
- package/dist/llm/inference/providers/bedrock.test.d.ts.map +1 -0
- package/dist/llm/inference/providers/bedrock.test.js +21 -0
- package/dist/llm/inference/providers/bedrock.test.js.map +1 -0
- package/dist/llm/inference/providers/index.d.ts +10 -0
- package/dist/llm/inference/providers/index.d.ts.map +1 -0
- package/dist/llm/inference/providers/index.js +10 -0
- package/dist/llm/inference/providers/index.js.map +1 -0
- package/dist/llm/inference/providers/ollama.d.ts +8 -0
- package/dist/llm/inference/providers/ollama.d.ts.map +1 -0
- package/dist/llm/inference/providers/ollama.js +63 -0
- package/dist/llm/inference/providers/ollama.js.map +1 -0
- package/dist/llm/inference/providers/ollama.test.d.ts +2 -0
- package/dist/llm/inference/providers/ollama.test.d.ts.map +1 -0
- package/dist/llm/inference/providers/ollama.test.js +57 -0
- package/dist/llm/inference/providers/ollama.test.js.map +1 -0
- package/dist/llm/inference/providers/openai.d.ts +11 -0
- package/dist/llm/inference/providers/openai.d.ts.map +1 -0
- package/dist/llm/inference/providers/openai.js +73 -0
- package/dist/llm/inference/providers/openai.js.map +1 -0
- package/dist/llm/inference/providers/openai.test.d.ts +2 -0
- package/dist/llm/inference/providers/openai.test.d.ts.map +1 -0
- package/dist/llm/inference/providers/openai.test.js +46 -0
- package/dist/llm/inference/providers/openai.test.js.map +1 -0
- package/dist/llm/inference/providers/portkey.d.ts +13 -0
- package/dist/llm/inference/providers/portkey.d.ts.map +1 -0
- package/dist/llm/inference/providers/portkey.js +80 -0
- package/dist/llm/inference/providers/portkey.js.map +1 -0
- package/dist/llm/inference/providers/portkey.test.d.ts +2 -0
- package/dist/llm/inference/providers/portkey.test.d.ts.map +1 -0
- package/dist/llm/inference/providers/portkey.test.js +48 -0
- package/dist/llm/inference/providers/portkey.test.js.map +1 -0
- package/dist/llm/inference/registry.d.ts +15 -0
- package/dist/llm/inference/registry.d.ts.map +1 -0
- package/dist/llm/inference/registry.js +28 -0
- package/dist/llm/inference/registry.js.map +1 -0
- package/dist/llm/inference/registry.test.d.ts +6 -0
- package/dist/llm/inference/registry.test.d.ts.map +1 -0
- package/dist/llm/inference/registry.test.js +63 -0
- package/dist/llm/inference/registry.test.js.map +1 -0
- package/dist/llm/inference/types.d.ts +84 -0
- package/dist/llm/inference/types.d.ts.map +1 -0
- package/dist/llm/inference/types.js +9 -0
- package/dist/llm/inference/types.js.map +1 -0
- package/dist/llm/telemetry.d.ts +25 -0
- package/dist/llm/telemetry.d.ts.map +1 -0
- package/dist/llm/telemetry.js +43 -0
- package/dist/llm/telemetry.js.map +1 -0
- package/dist/llm/telemetry.test.d.ts +5 -0
- package/dist/llm/telemetry.test.d.ts.map +1 -0
- package/dist/llm/telemetry.test.js +89 -0
- package/dist/llm/telemetry.test.js.map +1 -0
- package/dist/llm/types.d.ts +4 -37
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +4 -1
- package/dist/llm/types.js.map +1 -1
- package/dist/logger.d.ts +18 -3
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +102 -20
- package/dist/logger.js.map +1 -1
- package/dist/logger.test.d.ts +5 -0
- package/dist/logger.test.d.ts.map +1 -0
- package/dist/logger.test.js +103 -0
- package/dist/logger.test.js.map +1 -0
- package/dist/mcp/api.d.ts +15 -1
- package/dist/mcp/api.d.ts.map +1 -1
- package/dist/mcp/api.js +44 -19
- package/dist/mcp/api.js.map +1 -1
- package/dist/mcp/api.test.d.ts +6 -0
- package/dist/mcp/api.test.d.ts.map +1 -0
- package/dist/mcp/api.test.js +130 -0
- package/dist/mcp/api.test.js.map +1 -0
- package/dist/mcp/helpers.d.ts +1 -0
- package/dist/mcp/helpers.d.ts.map +1 -1
- package/dist/mcp/helpers.js +62 -6
- package/dist/mcp/helpers.js.map +1 -1
- package/dist/mcp/helpers.test.js +71 -10
- package/dist/mcp/helpers.test.js.map +1 -1
- package/dist/mcp/index.d.ts +7 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +46 -21
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/taxonomy.d.ts +251 -31
- package/dist/mcp/taxonomy.d.ts.map +1 -1
- package/dist/mcp/taxonomy.js +603 -171
- package/dist/mcp/taxonomy.js.map +1 -1
- package/dist/mcp/taxonomy.test.d.ts +1 -1
- package/dist/mcp/taxonomy.test.js +141 -302
- package/dist/mcp/taxonomy.test.js.map +1 -1
- package/dist/mcp/tools.d.ts +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.integration.itest.d.ts +23 -0
- package/dist/mcp/tools.integration.itest.d.ts.map +1 -0
- package/dist/mcp/tools.integration.itest.js +172 -0
- package/dist/mcp/tools.integration.itest.js.map +1 -0
- package/dist/mcp/tools.js +422 -357
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/tools.test.d.ts +16 -0
- package/dist/mcp/tools.test.d.ts.map +1 -0
- package/dist/mcp/tools.test.js +472 -0
- package/dist/mcp/tools.test.js.map +1 -0
- package/dist/mcp/types.d.ts +63 -8
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/prompts/brief.d.ts +19 -0
- package/dist/prompts/brief.d.ts.map +1 -0
- package/dist/prompts/brief.js +67 -0
- package/dist/prompts/brief.js.map +1 -0
- package/dist/prompts/contradiction.d.ts +24 -0
- package/dist/prompts/contradiction.d.ts.map +1 -0
- package/dist/prompts/contradiction.js +73 -0
- package/dist/prompts/contradiction.js.map +1 -0
- package/dist/prompts/distill.d.ts +21 -0
- package/dist/prompts/distill.d.ts.map +1 -0
- package/dist/prompts/distill.js +92 -0
- package/dist/prompts/distill.js.map +1 -0
- package/dist/prompts/episode-summary.d.ts +15 -0
- package/dist/prompts/episode-summary.d.ts.map +1 -0
- package/dist/prompts/episode-summary.js +60 -0
- package/dist/prompts/episode-summary.js.map +1 -0
- package/dist/prompts/extraction.d.ts +14 -0
- package/dist/prompts/extraction.d.ts.map +1 -0
- package/dist/prompts/extraction.js +110 -0
- package/dist/prompts/extraction.js.map +1 -0
- package/dist/prompts/index.d.ts +52 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +104 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/prompts.test.d.ts +8 -0
- package/dist/prompts/prompts.test.d.ts.map +1 -0
- package/dist/prompts/prompts.test.js +140 -0
- package/dist/prompts/prompts.test.js.map +1 -0
- package/dist/prompts/relations.d.ts +17 -0
- package/dist/prompts/relations.d.ts.map +1 -0
- package/dist/prompts/relations.js +72 -0
- package/dist/prompts/relations.js.map +1 -0
- package/dist/prompts/workstream-summary.d.ts +17 -0
- package/dist/prompts/workstream-summary.d.ts.map +1 -0
- package/dist/prompts/workstream-summary.js +72 -0
- package/dist/prompts/workstream-summary.js.map +1 -0
- package/dist/render.d.ts +41 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +185 -0
- package/dist/render.js.map +1 -0
- package/dist/render.test.d.ts +8 -0
- package/dist/render.test.d.ts.map +1 -0
- package/dist/render.test.js +243 -0
- package/dist/render.test.js.map +1 -0
- package/docs/diagrams/architecture.svg +87 -0
- package/docs/diagrams/team-memory.svg +250 -0
- package/docs/screenshots/dashboard.png +0 -0
- package/docs/screenshots/graph.png +0 -0
- package/docs/screenshots/memory.png +0 -0
- package/package.json +12 -3
- package/dist/llm/embedding.d.ts +0 -13
- package/dist/llm/embedding.d.ts.map +0 -1
- package/dist/llm/embedding.js +0 -127
- package/dist/llm/embedding.js.map +0 -1
- package/dist/llm/embedding.test.d.ts +0 -8
- package/dist/llm/embedding.test.d.ts.map +0 -1
- package/dist/llm/embedding.test.js +0 -117
- package/dist/llm/embedding.test.js.map +0 -1
- package/dist/llm/inference.d.ts +0 -12
- package/dist/llm/inference.d.ts.map +0 -1
- package/dist/llm/inference.js +0 -146
- package/dist/llm/inference.js.map +0 -1
- package/dist/llm/inference.test.d.ts +0 -8
- package/dist/llm/inference.test.d.ts.map +0 -1
- package/dist/llm/inference.test.js +0 -117
- package/dist/llm/inference.test.js.map +0 -1
package/dist/mcp/taxonomy.js
CHANGED
|
@@ -1,223 +1,655 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Bikky memory ontology.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* domain — life scope (work vs personal context)
|
|
7
|
-
* kind — epistemic type (how the knowledge exists)
|
|
8
|
-
* source — provenance (who/what created this fact)
|
|
4
|
+
* Ontology v2 separates ownership boundaries from semantic meaning:
|
|
5
|
+
* workspace -> domain -> repo/project/surface -> workstream -> episode -> memory objects.
|
|
9
6
|
*/
|
|
10
|
-
//
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Categories: subject matter
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
11
10
|
export const CATEGORIES = {
|
|
11
|
+
codebase: {
|
|
12
|
+
description: "Repository structure, modules, important files, APIs, build/test commands, and code navigation knowledge.",
|
|
13
|
+
examples: [
|
|
14
|
+
"The auth middleware lives in src/server/auth.ts.",
|
|
15
|
+
"Run npm test -- --runInBand for flaky integration tests.",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
12
18
|
infrastructure: {
|
|
13
|
-
description: "
|
|
14
|
-
extractionHint: "Look for: service names, ports, hosts, connection strings, database engines, cluster details, deployment targets, environment variables, config values",
|
|
19
|
+
description: "Cloud, deployment, runtime, secrets, queues, databases, CI/CD, and environment topology.",
|
|
15
20
|
examples: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{ content: "Redis cache is on redis-prod.internal:6379 with 30-min TTL", entities: ["redis"], confidence: 0.9, importance: 0.8 },
|
|
21
|
+
"Production runs on a Qdrant cluster (Cloud or self-hosted) for vector storage.",
|
|
22
|
+
"Deployments are promoted through GitHub Actions.",
|
|
19
23
|
],
|
|
20
24
|
},
|
|
21
|
-
|
|
22
|
-
description: "
|
|
23
|
-
extractionHint: "Look for: 'decided', 'chose', 'went with', 'instead of', 'because', trade-off discussions, architecture choices, technology selections",
|
|
25
|
+
operations: {
|
|
26
|
+
description: "Runbooks, incident handling, maintenance procedures, debugging steps, and operational gotchas.",
|
|
24
27
|
examples: [
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
"Restart the worker after changing queue visibility timeout.",
|
|
29
|
+
"If migrations hang, check the advisory lock table first.",
|
|
27
30
|
],
|
|
28
31
|
},
|
|
29
|
-
|
|
30
|
-
description: "
|
|
31
|
-
extractionHint: "Look for: error messages, debugging steps, 'turns out', 'the issue was', workarounds, unexpected behavior, gotchas, caveats",
|
|
32
|
+
decisions: {
|
|
33
|
+
description: "Architecture, product, process, and technical decisions with durable rationale.",
|
|
32
34
|
examples: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
"Use workspace_id as the access boundary instead of overloading domain.",
|
|
36
|
+
"Keep telemetry out of normal semantic recall.",
|
|
35
37
|
],
|
|
36
38
|
},
|
|
37
|
-
|
|
38
|
-
description: "
|
|
39
|
-
extractionHint: "Look for: 'prefer', 'like', 'want', 'always use', conventions, style guides, opinions, personal choices, hobbies, interests",
|
|
39
|
+
product_domain: {
|
|
40
|
+
description: "Product concepts, business rules, user workflows, domain vocabulary, and market assumptions.",
|
|
40
41
|
examples: [
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
"A workstream is the durable continuity unit for long-running tasks.",
|
|
43
|
+
"Recall quality should be measured by downstream usefulness, not just similarity.",
|
|
43
44
|
],
|
|
44
45
|
},
|
|
45
46
|
projects: {
|
|
46
|
-
description: "
|
|
47
|
-
|
|
47
|
+
description: "Project goals, milestones, current state, open questions, blockers, and active workstreams.",
|
|
48
|
+
examples: [
|
|
49
|
+
"The capture-policy RPI is implementing ontology v2 first.",
|
|
50
|
+
"The UI smoke suite is tracked in bikky-dev/bikky#13.",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
people: {
|
|
54
|
+
description: "Ownership, roles, collaboration patterns, responsibilities, and team preferences.",
|
|
55
|
+
examples: [
|
|
56
|
+
"Saber prefers concise implementation plans before code changes.",
|
|
57
|
+
"The platform team owns the deploy workflow.",
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
preferences: {
|
|
61
|
+
description: "User, team, or workspace preferences about style, tooling, defaults, and interaction patterns.",
|
|
48
62
|
examples: [
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
"Prefer Node's built-in test runner for this repo.",
|
|
64
|
+
"Default new memory captures to software_engineering.",
|
|
51
65
|
],
|
|
52
66
|
},
|
|
53
|
-
|
|
54
|
-
description: "
|
|
55
|
-
extractionHint: "Look for: names, titles, roles, reporting lines, team membership, expertise areas, contact details, who owns what",
|
|
67
|
+
observations: {
|
|
68
|
+
description: "Validated observations, troubleshooting evidence, behavioral notes, and learned facts that do not fit a narrower category.",
|
|
56
69
|
examples: [
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
"The current ESLint config is incompatible with ESLint v9.",
|
|
71
|
+
"The dashboard shows stale facts separately from verified current facts.",
|
|
59
72
|
],
|
|
60
73
|
},
|
|
61
74
|
};
|
|
62
|
-
|
|
75
|
+
export const DEFAULT_CATEGORY = "observations";
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Domains: activity / knowledge profiles
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
63
79
|
export const DOMAINS = {
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
software_engineering: {
|
|
81
|
+
description: "Coding-agent work: repositories, code changes, architecture, infrastructure, debugging, tests, CI, and developer workflow.",
|
|
82
|
+
defaultCategories: [
|
|
83
|
+
"codebase",
|
|
84
|
+
"infrastructure",
|
|
85
|
+
"operations",
|
|
86
|
+
"decisions",
|
|
87
|
+
"projects",
|
|
88
|
+
"preferences",
|
|
89
|
+
"observations",
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
product_strategy: {
|
|
93
|
+
description: "Product direction, positioning, roadmap tradeoffs, customer problems, metrics, and market learning.",
|
|
94
|
+
defaultCategories: [
|
|
95
|
+
"product_domain",
|
|
96
|
+
"decisions",
|
|
97
|
+
"projects",
|
|
98
|
+
"people",
|
|
99
|
+
"preferences",
|
|
100
|
+
"observations",
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
business_operations: {
|
|
104
|
+
description: "Business process, vendors, finance, legal/admin operations, recurring procedures, and ownership.",
|
|
105
|
+
defaultCategories: [
|
|
106
|
+
"operations",
|
|
107
|
+
"decisions",
|
|
108
|
+
"projects",
|
|
109
|
+
"people",
|
|
110
|
+
"preferences",
|
|
111
|
+
"observations",
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
research: {
|
|
115
|
+
description: "Research questions, sources, hypotheses, experiment findings, synthesis, and reusable insights.",
|
|
116
|
+
defaultCategories: [
|
|
117
|
+
"product_domain",
|
|
118
|
+
"decisions",
|
|
119
|
+
"projects",
|
|
120
|
+
"preferences",
|
|
121
|
+
"observations",
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
personal_productivity: {
|
|
125
|
+
description: "Individual productivity, habits, planning preferences, reminders, and personal operating context.",
|
|
126
|
+
defaultCategories: [
|
|
127
|
+
"operations",
|
|
128
|
+
"projects",
|
|
129
|
+
"people",
|
|
130
|
+
"preferences",
|
|
131
|
+
"observations",
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
export const DEFAULT_DOMAIN = "software_engineering";
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// Layers: hierarchy placement
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
export const LAYERS = {
|
|
140
|
+
workspace: {
|
|
141
|
+
description: "Ownership, tenancy, access policy, sharing, redaction, retention, and quotas.",
|
|
142
|
+
},
|
|
143
|
+
domain: {
|
|
144
|
+
description: "Semantic profile that controls vocabulary, prompts, categories, ranking, and capture policy.",
|
|
145
|
+
},
|
|
146
|
+
surface: {
|
|
147
|
+
description: "Concrete operating surface such as a repo, project, package, service, branch, or channel.",
|
|
148
|
+
},
|
|
149
|
+
workstream: {
|
|
150
|
+
description: "Primary durable continuity key for a long-running objective or task.",
|
|
151
|
+
},
|
|
152
|
+
episode: {
|
|
153
|
+
description: "Coherent segment of activity within a session or transcript.",
|
|
154
|
+
},
|
|
155
|
+
memory_object: {
|
|
156
|
+
description: "A fact, summary, distilled learning, relation, or telemetry object.",
|
|
157
|
+
},
|
|
66
158
|
};
|
|
67
|
-
|
|
68
|
-
//
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
// Kinds and subtypes: object shape
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
69
162
|
export const KINDS = {
|
|
70
|
-
fact: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
163
|
+
fact: {
|
|
164
|
+
description: "Atomic, durable memory that should be retrievable independently.",
|
|
165
|
+
examples: [
|
|
166
|
+
"The daemon stores extracted coding-agent observations in Qdrant.",
|
|
167
|
+
"The UI package uses Vite and Node's built-in test runner.",
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
summary: {
|
|
171
|
+
description: "Compressed representation of a session index, coherent episode, or current workstream state.",
|
|
172
|
+
examples: [
|
|
173
|
+
"Episode summary of a coherent implementation task.",
|
|
174
|
+
"Current-state summary for a workstream.",
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
distilled: {
|
|
178
|
+
description: "Pattern, convention, failure mode, or reusable learning synthesized from multiple memories.",
|
|
179
|
+
examples: [
|
|
180
|
+
"Prefer explicit workspace filters for scoped team memory.",
|
|
181
|
+
"Missing Qdrant payload indexes surface as query failures.",
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
relation: {
|
|
185
|
+
description: "Typed edge between entities; relation_type carries the edge label.",
|
|
186
|
+
examples: [
|
|
187
|
+
"bikky -> uses -> qdrant",
|
|
188
|
+
"workspace_id -> represents -> access boundary",
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
telemetry: {
|
|
192
|
+
description: "Memory-use, feedback, or outcome metadata used for product quality and operations; excluded from normal semantic recall.",
|
|
193
|
+
examples: [
|
|
194
|
+
"A recall event returned three facts for session abc.",
|
|
195
|
+
"A user marked a fact useful.",
|
|
196
|
+
],
|
|
197
|
+
},
|
|
74
198
|
};
|
|
75
|
-
export const
|
|
76
|
-
|
|
199
|
+
export const MEMORY_SUBTYPES = {
|
|
200
|
+
fact: [
|
|
201
|
+
"codebase_map",
|
|
202
|
+
"architecture_decision",
|
|
203
|
+
"infra_topology",
|
|
204
|
+
"access_pattern",
|
|
205
|
+
"deployment_procedure",
|
|
206
|
+
"operational_procedure",
|
|
207
|
+
"domain_rule",
|
|
208
|
+
"troubleshooting_gotcha",
|
|
209
|
+
"preference",
|
|
210
|
+
"ownership",
|
|
211
|
+
],
|
|
212
|
+
summary: ["session_index", "episode", "workstream"],
|
|
213
|
+
distilled: [
|
|
214
|
+
"runbook_candidate",
|
|
215
|
+
"failure_mode",
|
|
216
|
+
"convention",
|
|
217
|
+
"architecture_pattern",
|
|
218
|
+
"product_insight",
|
|
219
|
+
],
|
|
220
|
+
relation: [],
|
|
221
|
+
telemetry: ["recall_event", "feedback_event", "outcome_event", "aggregate_rollup"],
|
|
222
|
+
};
|
|
223
|
+
export const DEFAULT_MEMORY_SUBTYPE_BY_KIND = {
|
|
224
|
+
fact: "codebase_map",
|
|
225
|
+
summary: "episode",
|
|
226
|
+
distilled: "convention",
|
|
227
|
+
relation: null,
|
|
228
|
+
telemetry: "recall_event",
|
|
229
|
+
};
|
|
230
|
+
export const MEMORY_SUBTYPE_DEFAULT_CATEGORY = {
|
|
231
|
+
codebase_map: "codebase",
|
|
232
|
+
architecture_decision: "decisions",
|
|
233
|
+
infra_topology: "infrastructure",
|
|
234
|
+
access_pattern: "infrastructure",
|
|
235
|
+
deployment_procedure: "operations",
|
|
236
|
+
operational_procedure: "operations",
|
|
237
|
+
domain_rule: "product_domain",
|
|
238
|
+
troubleshooting_gotcha: "operations",
|
|
239
|
+
preference: "preferences",
|
|
240
|
+
ownership: "people",
|
|
241
|
+
session_index: "projects",
|
|
242
|
+
episode: "projects",
|
|
243
|
+
workstream: "projects",
|
|
244
|
+
runbook_candidate: "operations",
|
|
245
|
+
failure_mode: "operations",
|
|
246
|
+
convention: "observations",
|
|
247
|
+
architecture_pattern: "decisions",
|
|
248
|
+
product_insight: "product_domain",
|
|
249
|
+
recall_event: "observations",
|
|
250
|
+
feedback_event: "observations",
|
|
251
|
+
outcome_event: "observations",
|
|
252
|
+
aggregate_rollup: "observations",
|
|
253
|
+
};
|
|
254
|
+
export const MEMORY_SUBTYPE_DEFAULT_LAYER = {
|
|
255
|
+
codebase_map: "surface",
|
|
256
|
+
architecture_decision: "surface",
|
|
257
|
+
infra_topology: "surface",
|
|
258
|
+
access_pattern: "surface",
|
|
259
|
+
deployment_procedure: "surface",
|
|
260
|
+
operational_procedure: "surface",
|
|
261
|
+
domain_rule: "domain",
|
|
262
|
+
troubleshooting_gotcha: "surface",
|
|
263
|
+
preference: "domain",
|
|
264
|
+
ownership: "surface",
|
|
265
|
+
session_index: "episode",
|
|
266
|
+
episode: "episode",
|
|
267
|
+
workstream: "workstream",
|
|
268
|
+
runbook_candidate: "workstream",
|
|
269
|
+
failure_mode: "workstream",
|
|
270
|
+
convention: "domain",
|
|
271
|
+
architecture_pattern: "domain",
|
|
272
|
+
product_insight: "domain",
|
|
273
|
+
recall_event: "memory_object",
|
|
274
|
+
feedback_event: "memory_object",
|
|
275
|
+
outcome_event: "memory_object",
|
|
276
|
+
aggregate_rollup: "workspace",
|
|
277
|
+
};
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
// Provenance
|
|
280
|
+
// ---------------------------------------------------------------------------
|
|
77
281
|
export const SOURCES = {
|
|
78
|
-
agent: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
282
|
+
agent: {
|
|
283
|
+
description: "Captured from an interactive agent tool call.",
|
|
284
|
+
},
|
|
285
|
+
daemon: {
|
|
286
|
+
description: "Captured automatically by the local Bikky daemon.",
|
|
287
|
+
},
|
|
288
|
+
system: {
|
|
289
|
+
description: "Generated by Bikky maintenance, migration, or lifecycle code.",
|
|
290
|
+
},
|
|
291
|
+
user: {
|
|
292
|
+
description: "Created or corrected directly by a user.",
|
|
293
|
+
},
|
|
294
|
+
docs: {
|
|
295
|
+
description: "Imported from documentation or explicit source material.",
|
|
296
|
+
},
|
|
83
297
|
};
|
|
298
|
+
export const DEFAULT_KIND = "fact";
|
|
84
299
|
export const DEFAULT_SOURCE = "agent";
|
|
85
|
-
|
|
86
|
-
const FACT_DECAY = {
|
|
87
|
-
"observation.work": 45,
|
|
88
|
-
"observation.personal": 180,
|
|
89
|
-
"infrastructure.work": 60,
|
|
90
|
-
"infrastructure.personal": 180,
|
|
91
|
-
"decisions.*": 120,
|
|
92
|
-
"preferences.*": 365,
|
|
93
|
-
"projects.work": 90,
|
|
94
|
-
"projects.personal": 180,
|
|
95
|
-
"team.*": 365,
|
|
96
|
-
};
|
|
300
|
+
export const STALENESS_DAYS = 30;
|
|
97
301
|
export const DECAY_DEFAULT_HALF_LIFE = 90;
|
|
98
|
-
export
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return 180;
|
|
104
|
-
const key = `${category ?? "observation"}.${domain ?? DEFAULT_DOMAIN}`;
|
|
105
|
-
const keyVal = FACT_DECAY[key];
|
|
106
|
-
if (keyVal !== undefined)
|
|
107
|
-
return keyVal;
|
|
108
|
-
const catKey = `${category ?? "observation"}.*`;
|
|
109
|
-
const catVal = FACT_DECAY[catKey];
|
|
110
|
-
if (catVal !== undefined)
|
|
111
|
-
return catVal;
|
|
112
|
-
return DECAY_DEFAULT_HALF_LIFE;
|
|
113
|
-
}
|
|
114
|
-
// Legacy flat map for old code paths
|
|
302
|
+
export const THRESHOLD_DUPLICATE = 0.92;
|
|
303
|
+
export const THRESHOLD_RELATED = 0.8;
|
|
304
|
+
// ---------------------------------------------------------------------------
|
|
305
|
+
// Decay policy: half-life in days by category + domain profile
|
|
306
|
+
// ---------------------------------------------------------------------------
|
|
115
307
|
export const DECAY_HALF_LIFE = {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
308
|
+
// Software-engineering defaults.
|
|
309
|
+
"codebase.software_engineering": 120,
|
|
310
|
+
"infrastructure.software_engineering": 60,
|
|
311
|
+
"operations.software_engineering": 60,
|
|
312
|
+
"decisions.software_engineering": 180,
|
|
313
|
+
"product_domain.software_engineering": 120,
|
|
314
|
+
"projects.software_engineering": 45,
|
|
315
|
+
"people.software_engineering": 120,
|
|
316
|
+
"preferences.software_engineering": 180,
|
|
317
|
+
"observations.software_engineering": 45,
|
|
318
|
+
// Other domain profiles.
|
|
319
|
+
"product_domain.product_strategy": 120,
|
|
320
|
+
"decisions.product_strategy": 180,
|
|
321
|
+
"projects.product_strategy": 60,
|
|
322
|
+
"people.product_strategy": 120,
|
|
323
|
+
"preferences.product_strategy": 180,
|
|
324
|
+
"observations.product_strategy": 60,
|
|
325
|
+
"operations.business_operations": 120,
|
|
326
|
+
"decisions.business_operations": 180,
|
|
327
|
+
"projects.business_operations": 60,
|
|
328
|
+
"people.business_operations": 180,
|
|
329
|
+
"preferences.business_operations": 180,
|
|
330
|
+
"observations.business_operations": 90,
|
|
331
|
+
"product_domain.research": 120,
|
|
332
|
+
"decisions.research": 180,
|
|
333
|
+
"projects.research": 60,
|
|
334
|
+
"preferences.research": 180,
|
|
335
|
+
"observations.research": 90,
|
|
336
|
+
"operations.personal_productivity": 90,
|
|
337
|
+
"projects.personal_productivity": 45,
|
|
338
|
+
"people.personal_productivity": 180,
|
|
339
|
+
"preferences.personal_productivity": 180,
|
|
340
|
+
"observations.personal_productivity": 45,
|
|
126
341
|
};
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
//
|
|
130
|
-
export const THRESHOLD_DUPLICATE = 0.92;
|
|
131
|
-
export const THRESHOLD_RELATED = 0.80;
|
|
132
|
-
// ─── Qdrant indexes ────────────────────────────────────────────────────────
|
|
342
|
+
// ---------------------------------------------------------------------------
|
|
343
|
+
// Qdrant payload indexes
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
133
345
|
export const QDRANT_INDEXES = [
|
|
134
346
|
{ field_name: "category", field_schema: "keyword" },
|
|
135
347
|
{ field_name: "domain", field_schema: "keyword" },
|
|
136
348
|
{ field_name: "kind", field_schema: "keyword" },
|
|
349
|
+
{ field_name: "memory_subtype", field_schema: "keyword" },
|
|
137
350
|
{ field_name: "source", field_schema: "keyword" },
|
|
138
|
-
{ field_name: "
|
|
139
|
-
{ field_name: "
|
|
140
|
-
{ field_name: "
|
|
141
|
-
{ field_name: "
|
|
142
|
-
{ field_name: "
|
|
143
|
-
{ field_name: "
|
|
351
|
+
{ field_name: "workspace_id", field_schema: "keyword" },
|
|
352
|
+
{ field_name: "actor_id", field_schema: "keyword" },
|
|
353
|
+
{ field_name: "review_status", field_schema: "keyword" },
|
|
354
|
+
{ field_name: "created_at", field_schema: "datetime" },
|
|
355
|
+
{ field_name: "updated_at", field_schema: "datetime" },
|
|
356
|
+
{ field_name: "last_seen_at", field_schema: "datetime" },
|
|
357
|
+
{ field_name: "stale_after", field_schema: "datetime" },
|
|
144
358
|
{ field_name: "session_id", field_schema: "keyword" },
|
|
145
|
-
{ field_name: "
|
|
146
|
-
{ field_name: "
|
|
359
|
+
{ field_name: "episode_id", field_schema: "keyword" },
|
|
360
|
+
{ field_name: "workstream_key", field_schema: "keyword" },
|
|
361
|
+
{ field_name: "task_key", field_schema: "keyword" },
|
|
362
|
+
{ field_name: "repo", field_schema: "keyword" },
|
|
363
|
+
{ field_name: "branch", field_schema: "keyword" },
|
|
364
|
+
{ field_name: "reviewed", field_schema: "bool" },
|
|
365
|
+
{ field_name: "verified", field_schema: "bool" },
|
|
366
|
+
{ field_name: "superseded", field_schema: "bool" },
|
|
367
|
+
{ field_name: "useful_feedback_count", field_schema: "integer" },
|
|
368
|
+
{ field_name: "not_useful_feedback_count", field_schema: "integer" },
|
|
369
|
+
{ field_name: "recall_count", field_schema: "integer" },
|
|
370
|
+
{ field_name: "last_recalled_at", field_schema: "datetime" },
|
|
147
371
|
];
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export function normalizeCategory(
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (lower === "session_summary")
|
|
164
|
-
return "projects";
|
|
165
|
-
if (lower === "distilled")
|
|
166
|
-
return "observation";
|
|
167
|
-
if (lower === "relation")
|
|
168
|
-
return "team";
|
|
169
|
-
if (lower.includes("infra"))
|
|
372
|
+
function normalizeToken(value) {
|
|
373
|
+
return String(value ?? "")
|
|
374
|
+
.trim()
|
|
375
|
+
.toLowerCase()
|
|
376
|
+
.replace(/[\s-]+/g, "_");
|
|
377
|
+
}
|
|
378
|
+
export function normalizeText(text) {
|
|
379
|
+
return text.trim().replace(/\s+/g, " ");
|
|
380
|
+
}
|
|
381
|
+
export function normalizeCategory(category) {
|
|
382
|
+
const normalized = normalizeToken(category);
|
|
383
|
+
if (normalized in CATEGORIES) {
|
|
384
|
+
return normalized;
|
|
385
|
+
}
|
|
386
|
+
if (normalized.includes("infra"))
|
|
170
387
|
return "infrastructure";
|
|
171
|
-
if (
|
|
388
|
+
if (normalized.includes("decision"))
|
|
172
389
|
return "decisions";
|
|
173
|
-
if (
|
|
174
|
-
return "
|
|
175
|
-
if (
|
|
176
|
-
return "
|
|
177
|
-
if (
|
|
178
|
-
return "
|
|
179
|
-
if (
|
|
180
|
-
return "
|
|
181
|
-
return
|
|
182
|
-
}
|
|
183
|
-
export function normalizeDomain(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return lower;
|
|
189
|
-
if (lower.includes("personal") || lower.includes("life") || lower.includes("home"))
|
|
190
|
-
return "personal";
|
|
390
|
+
if (normalized.includes("operation") || normalized.includes("runbook"))
|
|
391
|
+
return "operations";
|
|
392
|
+
if (normalized.includes("owner") || normalized.includes("people"))
|
|
393
|
+
return "people";
|
|
394
|
+
if (normalized.includes("product") || normalized.includes("domain"))
|
|
395
|
+
return "product_domain";
|
|
396
|
+
if (normalized.includes("repo") || normalized.includes("code"))
|
|
397
|
+
return "codebase";
|
|
398
|
+
return DEFAULT_CATEGORY;
|
|
399
|
+
}
|
|
400
|
+
export function normalizeDomain(domain) {
|
|
401
|
+
const normalized = normalizeToken(domain);
|
|
402
|
+
if (normalized in DOMAINS) {
|
|
403
|
+
return normalized;
|
|
404
|
+
}
|
|
191
405
|
return DEFAULT_DOMAIN;
|
|
192
406
|
}
|
|
193
|
-
export function normalizeKind(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (lower.includes("summar"))
|
|
407
|
+
export function normalizeKind(kind) {
|
|
408
|
+
const normalized = normalizeToken(kind);
|
|
409
|
+
if (normalized in KINDS) {
|
|
410
|
+
return normalized;
|
|
411
|
+
}
|
|
412
|
+
if (normalized.includes("summar"))
|
|
200
413
|
return "summary";
|
|
201
|
-
if (
|
|
414
|
+
if (normalized.includes("distill"))
|
|
202
415
|
return "distilled";
|
|
203
|
-
if (
|
|
416
|
+
if (normalized.includes("relation") || normalized.includes("edge"))
|
|
204
417
|
return "relation";
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
return
|
|
213
|
-
|
|
214
|
-
if (migrated)
|
|
215
|
-
return migrated;
|
|
418
|
+
if (normalized.includes("telemetry") || normalized.includes("feedback_event"))
|
|
419
|
+
return "telemetry";
|
|
420
|
+
return "fact";
|
|
421
|
+
}
|
|
422
|
+
export function normalizeSource(source) {
|
|
423
|
+
const normalized = normalizeToken(source);
|
|
424
|
+
if (normalized in SOURCES) {
|
|
425
|
+
return normalized;
|
|
426
|
+
}
|
|
216
427
|
return DEFAULT_SOURCE;
|
|
217
428
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
429
|
+
export function normalizeLayer(layer) {
|
|
430
|
+
const normalized = normalizeToken(layer);
|
|
431
|
+
if (normalized in LAYERS) {
|
|
432
|
+
return normalized;
|
|
433
|
+
}
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
export function normalizeMemorySubtype(kind, subtype) {
|
|
437
|
+
const normalizedKind = normalizeKind(kind);
|
|
438
|
+
const normalizedSubtype = normalizeToken(subtype);
|
|
439
|
+
if (!normalizedSubtype)
|
|
440
|
+
return null;
|
|
441
|
+
const allowed = MEMORY_SUBTYPES[normalizedKind];
|
|
442
|
+
if (allowed.includes(normalizedSubtype)) {
|
|
443
|
+
return normalizedSubtype;
|
|
444
|
+
}
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
export function validateMemorySubtype(kind, subtype) {
|
|
448
|
+
if (!subtype)
|
|
449
|
+
return null;
|
|
450
|
+
const normalized = normalizeMemorySubtype(kind, subtype);
|
|
451
|
+
if (normalized)
|
|
452
|
+
return normalized;
|
|
453
|
+
const normalizedKind = normalizeKind(kind);
|
|
454
|
+
const allowed = MEMORY_SUBTYPES[normalizedKind];
|
|
455
|
+
const allowedText = allowed.length > 0 ? allowed.join(", ") : "none";
|
|
456
|
+
throw new Error(`Invalid memory_subtype "${subtype}" for kind "${normalizedKind}". Allowed subtypes: ${allowedText}.`);
|
|
457
|
+
}
|
|
458
|
+
export function defaultMemorySubtypeForKind(kind) {
|
|
459
|
+
return DEFAULT_MEMORY_SUBTYPE_BY_KIND[normalizeKind(kind)];
|
|
460
|
+
}
|
|
461
|
+
export function categoryForMemorySubtype(subtype) {
|
|
462
|
+
const normalized = normalizeToken(subtype);
|
|
463
|
+
if (normalized in MEMORY_SUBTYPE_DEFAULT_CATEGORY) {
|
|
464
|
+
return MEMORY_SUBTYPE_DEFAULT_CATEGORY[normalized];
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
export function layerForMemorySubtype(subtype) {
|
|
469
|
+
const normalized = normalizeToken(subtype);
|
|
470
|
+
if (normalized in MEMORY_SUBTYPE_DEFAULT_LAYER) {
|
|
471
|
+
return MEMORY_SUBTYPE_DEFAULT_LAYER[normalized];
|
|
472
|
+
}
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
export function normalizeEntities(entities) {
|
|
476
|
+
const seen = new Set();
|
|
477
|
+
const result = [];
|
|
478
|
+
for (const entity of entities) {
|
|
479
|
+
const normalized = entity.trim().toLowerCase();
|
|
480
|
+
if (normalized && !seen.has(normalized)) {
|
|
481
|
+
seen.add(normalized);
|
|
482
|
+
result.push(normalized);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return result;
|
|
486
|
+
}
|
|
487
|
+
export function inferEntities(content) {
|
|
488
|
+
const entities = [];
|
|
489
|
+
// Backtick code refs
|
|
490
|
+
const codeRefs = content.match(/`([^`]+)`/g);
|
|
491
|
+
if (codeRefs) {
|
|
492
|
+
for (const ref of codeRefs) {
|
|
493
|
+
entities.push(ref.slice(1, -1));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// Package-like names: qdrant, postgres, react, etc.
|
|
497
|
+
const techTerms = content.match(/\b(qdrant|postgres|postgresql|redis|docker|kubernetes|k8s|react|typescript|node|python|aws|gcp|azure|github|gitlab|notion|slack)\b/gi);
|
|
498
|
+
if (techTerms) {
|
|
499
|
+
entities.push(...techTerms);
|
|
500
|
+
}
|
|
501
|
+
return normalizeEntities(entities).slice(0, 10);
|
|
502
|
+
}
|
|
503
|
+
export function getDecayHalfLife(input) {
|
|
504
|
+
const kind = normalizeKind(input.kind);
|
|
505
|
+
if (kind === "relation" || kind === "telemetry")
|
|
506
|
+
return null;
|
|
507
|
+
const rawCategory = normalizeToken(input.category);
|
|
508
|
+
const rawDomain = normalizeToken(input.domain);
|
|
509
|
+
const categoryWasProvided = rawCategory.length > 0;
|
|
510
|
+
const categoryIsKnown = rawCategory in CATEGORIES ||
|
|
511
|
+
rawCategory.includes("infra") ||
|
|
512
|
+
rawCategory.includes("decision") ||
|
|
513
|
+
rawCategory.includes("operation") ||
|
|
514
|
+
rawCategory.includes("runbook") ||
|
|
515
|
+
rawCategory.includes("owner") ||
|
|
516
|
+
rawCategory.includes("people") ||
|
|
517
|
+
rawCategory.includes("product") ||
|
|
518
|
+
rawCategory.includes("domain") ||
|
|
519
|
+
rawCategory.includes("repo") ||
|
|
520
|
+
rawCategory.includes("code");
|
|
521
|
+
if (categoryWasProvided && !categoryIsKnown) {
|
|
522
|
+
return DECAY_DEFAULT_HALF_LIFE;
|
|
523
|
+
}
|
|
524
|
+
const canonicalCategory = normalizeCategory(input.category);
|
|
525
|
+
const canonicalDomain = normalizeDomain(input.domain);
|
|
526
|
+
return (DECAY_HALF_LIFE[`${canonicalCategory}.${canonicalDomain}`] ??
|
|
527
|
+
DECAY_HALF_LIFE[`${canonicalCategory}.${DEFAULT_DOMAIN}`] ??
|
|
528
|
+
DECAY_DEFAULT_HALF_LIFE);
|
|
529
|
+
}
|
|
530
|
+
// ---------------------------------------------------------------------------
|
|
531
|
+
// Validation helpers for tool schemas
|
|
532
|
+
// ---------------------------------------------------------------------------
|
|
533
|
+
export function categoryValues() {
|
|
534
|
+
return Object.keys(CATEGORIES);
|
|
535
|
+
}
|
|
536
|
+
export function canonicalCategoryValues() {
|
|
537
|
+
return Object.keys(CATEGORIES);
|
|
538
|
+
}
|
|
539
|
+
export function domainValues() {
|
|
540
|
+
return Object.keys(DOMAINS);
|
|
541
|
+
}
|
|
542
|
+
export function canonicalDomainValues() {
|
|
543
|
+
return Object.keys(DOMAINS);
|
|
544
|
+
}
|
|
545
|
+
export function kindValues() {
|
|
546
|
+
return Object.keys(KINDS);
|
|
547
|
+
}
|
|
548
|
+
export function layerValues() {
|
|
549
|
+
return Object.keys(LAYERS);
|
|
550
|
+
}
|
|
551
|
+
// ---------------------------------------------------------------------------
|
|
552
|
+
// Prompt rendering helpers — single source of truth shared with src/prompts/*
|
|
553
|
+
// ---------------------------------------------------------------------------
|
|
554
|
+
/**
|
|
555
|
+
* Render the documentation block for a single category — used inside LLM prompts
|
|
556
|
+
* so the model sees the same description and examples that taxonomy.ts declares
|
|
557
|
+
* as canonical. Keeps prompts and code in sync.
|
|
558
|
+
*/
|
|
559
|
+
export function categoryPromptSection(category) {
|
|
560
|
+
const def = CATEGORIES[category];
|
|
561
|
+
if (!def)
|
|
562
|
+
return `### ${category}\n(unknown category)`;
|
|
563
|
+
const examples = (def.examples ?? []).map((ex) => ` • ${ex}`).join("\n");
|
|
564
|
+
return [
|
|
565
|
+
`### ${category}`,
|
|
566
|
+
def.description ?? "",
|
|
567
|
+
examples ? `Examples:\n${examples}` : "",
|
|
568
|
+
]
|
|
569
|
+
.filter(Boolean)
|
|
570
|
+
.join("\n");
|
|
571
|
+
}
|
|
572
|
+
/** Render every category section back-to-back. */
|
|
573
|
+
export function allCategoryPromptSections() {
|
|
574
|
+
return Object.keys(CATEGORIES).map(categoryPromptSection).join("\n\n");
|
|
575
|
+
}
|
|
576
|
+
// ---------------------------------------------------------------------------
|
|
577
|
+
// MCP enum descriptions — single source of truth shared with src/mcp/tools.ts
|
|
578
|
+
// ---------------------------------------------------------------------------
|
|
579
|
+
//
|
|
580
|
+
// These render the canonical CATEGORIES / DOMAINS / KINDS / MEMORY_SUBTYPES /
|
|
581
|
+
// SOURCES tables into the multiline strings agents see when they inspect a
|
|
582
|
+
// tool schema. Keeping them here means tool descriptions never drift from
|
|
583
|
+
// the ontology definitions above.
|
|
584
|
+
function shortenDescription(text) {
|
|
585
|
+
// Collapse any whitespace and clip to the first sentence so per-value
|
|
586
|
+
// blurbs stay readable inside a tool schema description.
|
|
587
|
+
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
588
|
+
const firstPeriod = collapsed.indexOf(". ");
|
|
589
|
+
if (firstPeriod > 0)
|
|
590
|
+
return collapsed.slice(0, firstPeriod + 1);
|
|
591
|
+
return collapsed;
|
|
592
|
+
}
|
|
593
|
+
/** Render the `category` enum description for memory_store / memory_recall. */
|
|
594
|
+
export function categoryEnumDescription() {
|
|
595
|
+
const lines = Object.entries(CATEGORIES).map(([name, def]) => ` • ${name} — ${shortenDescription(def.description)}`);
|
|
596
|
+
return [
|
|
597
|
+
"Subject matter of the fact. One of:",
|
|
598
|
+
...lines,
|
|
599
|
+
`Default when omitted: ${DEFAULT_CATEGORY}.`,
|
|
600
|
+
].join("\n");
|
|
601
|
+
}
|
|
602
|
+
/** Render the `domain` enum description. */
|
|
603
|
+
export function domainEnumDescription() {
|
|
604
|
+
const lines = Object.entries(DOMAINS).map(([name, def]) => ` • ${name} — ${shortenDescription(def.description)}`);
|
|
605
|
+
return [
|
|
606
|
+
"Activity profile that controls vocabulary and ranking. One of:",
|
|
607
|
+
...lines,
|
|
608
|
+
`Default when omitted: ${DEFAULT_DOMAIN}.`,
|
|
609
|
+
].join("\n");
|
|
610
|
+
}
|
|
611
|
+
/** Render the `kind` enum description. Telemetry is daemon-only — excluded. */
|
|
612
|
+
export function kindEnumDescription() {
|
|
613
|
+
const lines = Object.entries(KINDS)
|
|
614
|
+
.filter(([name]) => name !== "telemetry")
|
|
615
|
+
.map(([name, def]) => ` • ${name} — ${shortenDescription(def.description)}`);
|
|
616
|
+
return [
|
|
617
|
+
"Knowledge form of the memory object. One of:",
|
|
618
|
+
...lines,
|
|
619
|
+
`Default when omitted: ${DEFAULT_KIND}. (telemetry is reserved for the daemon.)`,
|
|
620
|
+
].join("\n");
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Render the `memory_subtype` enum description, grouped by kind so the agent
|
|
624
|
+
* knows which subtypes pair with which kind (the runtime enforces this via
|
|
625
|
+
* validateMemorySubtype).
|
|
626
|
+
*/
|
|
627
|
+
export function memorySubtypeEnumDescription() {
|
|
628
|
+
const groups = Object.entries(MEMORY_SUBTYPES)
|
|
629
|
+
.filter(([, subtypes]) => subtypes.length > 0)
|
|
630
|
+
.map(([kind, subtypes]) => ` • kind=${kind}: ${subtypes.join(", ")}`);
|
|
631
|
+
return [
|
|
632
|
+
"Optional finer-grained type within the kind. Only set when one of these clearly applies — otherwise leave blank.",
|
|
633
|
+
"Subtype must match the kind (validated server-side):",
|
|
634
|
+
...groups,
|
|
635
|
+
].join("\n");
|
|
636
|
+
}
|
|
637
|
+
/** Render the `source` enum description for memory_store. */
|
|
638
|
+
export function sourceEnumDescription() {
|
|
639
|
+
const lines = Object.entries(SOURCES).map(([name, def]) => ` • ${name} — ${shortenDescription(def.description)}`);
|
|
640
|
+
return [
|
|
641
|
+
"Who created this memory. One of:",
|
|
642
|
+
...lines,
|
|
643
|
+
`Default when omitted: ${DEFAULT_SOURCE}. Only override when the human explicitly asked you to remember this (use 'user').`,
|
|
644
|
+
].join("\n");
|
|
645
|
+
}
|
|
646
|
+
export function memorySubtypeValues() {
|
|
647
|
+
return Object.values(MEMORY_SUBTYPES).flat();
|
|
648
|
+
}
|
|
649
|
+
export function memorySubtypeValuesForKind(kind) {
|
|
650
|
+
return [...MEMORY_SUBTYPES[normalizeKind(kind)]];
|
|
651
|
+
}
|
|
652
|
+
export function sourceValues() {
|
|
653
|
+
return Object.keys(SOURCES);
|
|
654
|
+
}
|
|
223
655
|
//# sourceMappingURL=taxonomy.js.map
|