coaiajs 0.1.0 → 0.1.2
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 +7 -3
- package/dist/mcp/config.d.ts +4 -0
- package/dist/mcp/config.d.ts.map +1 -0
- package/dist/mcp/config.js +52 -26
- package/dist/mcp/config.js.map +1 -0
- package/dist/mcp/prompts.d.ts +19 -0
- package/dist/mcp/prompts.d.ts.map +1 -0
- package/dist/mcp/prompts.js +111 -0
- package/dist/mcp/prompts.js.map +1 -0
- package/dist/mcp/resources.d.ts +5 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +77 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +167 -75
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/coaiapy-tools.d.ts.map +1 -0
- package/dist/mcp/tools/coaiapy-tools.js +1 -0
- package/dist/mcp/tools/coaiapy-tools.js.map +1 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/src/audio.d.ts.map +1 -0
- package/dist/src/audio.js.map +1 -0
- package/dist/src/cli-helpers.d.ts.map +1 -0
- package/dist/src/cli-helpers.js.map +1 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +4 -4
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +2 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +44 -14
- package/dist/src/config.js.map +1 -0
- package/dist/src/environment.d.ts.map +1 -0
- package/dist/src/environment.js.map +1 -0
- package/dist/src/github.d.ts.map +1 -0
- package/dist/src/github.js.map +1 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +13 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/langfuse/client.d.ts.map +1 -0
- package/dist/src/langfuse/client.js.map +1 -0
- package/dist/src/langfuse/comments.d.ts.map +1 -0
- package/dist/src/langfuse/comments.js.map +1 -0
- package/dist/src/langfuse/datasets.d.ts.map +1 -0
- package/dist/src/langfuse/datasets.js.map +1 -0
- package/dist/src/langfuse/index.d.ts.map +1 -0
- package/dist/src/langfuse/index.js.map +1 -0
- package/dist/src/langfuse/media.d.ts.map +1 -0
- package/dist/src/langfuse/media.js.map +1 -0
- package/dist/src/langfuse/observations.d.ts.map +1 -0
- package/dist/src/langfuse/observations.js.map +1 -0
- package/dist/src/langfuse/prompts.d.ts.map +1 -0
- package/dist/src/langfuse/prompts.js.map +1 -0
- package/dist/src/langfuse/scores.d.ts.map +1 -0
- package/dist/src/langfuse/scores.js.map +1 -0
- package/dist/src/langfuse/traces.d.ts.map +1 -0
- package/dist/src/langfuse/traces.js.map +1 -0
- package/dist/src/llm.d.ts.map +1 -0
- package/dist/src/llm.js.map +1 -0
- package/dist/src/narrative/graph-manager.d.ts.map +1 -0
- package/dist/src/narrative/graph-manager.js.map +1 -0
- package/dist/src/narrative/index.d.ts +32 -1
- package/dist/src/narrative/index.d.ts.map +1 -0
- package/dist/src/narrative/index.js +97 -1
- package/dist/src/narrative/index.js.map +1 -0
- package/dist/src/narrative/markdown-export.d.ts.map +1 -0
- package/dist/src/narrative/markdown-export.js.map +1 -0
- package/dist/src/narrative/tool-definitions.d.ts.map +1 -0
- package/dist/src/narrative/tool-definitions.js.map +1 -0
- package/dist/src/narrative/tool-handlers.d.ts.map +1 -0
- package/dist/src/narrative/tool-handlers.js.map +1 -0
- package/dist/src/narrative/types.d.ts.map +1 -0
- package/dist/src/narrative/types.js.map +1 -0
- package/dist/src/narrative/validation.d.ts.map +1 -0
- package/dist/src/narrative/validation.js.map +1 -0
- package/dist/src/pde/index.d.ts +4 -0
- package/dist/src/pde/index.d.ts.map +1 -0
- package/dist/src/pde/index.js +19 -0
- package/dist/src/pde/index.js.map +1 -0
- package/dist/src/pde/mcp-handlers.d.ts.map +1 -0
- package/dist/src/pde/mcp-handlers.js.map +1 -0
- package/dist/src/pde/mcp-tools.d.ts.map +1 -0
- package/dist/src/pde/mcp-tools.js.map +1 -0
- package/dist/src/pde/session-manager.d.ts.map +1 -0
- package/dist/src/pde/session-manager.js.map +1 -0
- package/dist/src/pde/stc-mapper.d.ts.map +1 -0
- package/dist/src/pde/stc-mapper.js.map +1 -0
- package/dist/src/pipeline/index.d.ts.map +1 -0
- package/dist/src/pipeline/index.js.map +1 -0
- package/dist/src/pipeline/template-engine.d.ts.map +1 -0
- package/dist/src/pipeline/template-engine.js.map +1 -0
- package/dist/src/planning/index.d.ts +3 -0
- package/dist/src/planning/index.d.ts.map +1 -0
- package/dist/src/planning/index.js +13 -0
- package/dist/src/planning/index.js.map +1 -0
- package/dist/src/planning/mcp-handlers.d.ts.map +1 -0
- package/dist/src/planning/mcp-handlers.js.map +1 -0
- package/dist/src/planning/mcp-tools.d.ts.map +1 -0
- package/dist/src/planning/mcp-tools.js.map +1 -0
- package/dist/src/planning/plan-parser.d.ts.map +1 -0
- package/dist/src/planning/plan-parser.js.map +1 -0
- package/dist/src/redis.d.ts.map +1 -0
- package/dist/src/redis.js +20 -8
- package/dist/src/redis.js.map +1 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +67 -2
- package/rispecs/00-coaiajs-platform.spec.md +23 -10
- package/rispecs/01-core-config.spec.md +7 -37
- package/rispecs/02-redis-module.spec.md +2 -1
- package/rispecs/03-langfuse-module.spec.md +7 -5
- package/rispecs/04-narrative-engine.spec.md +9 -9
- package/rispecs/05-pde-engine.spec.md +23 -23
- package/rispecs/06-planning-engine.spec.md +14 -13
- package/rispecs/07-pipeline-templates.spec.md +7 -7
- package/rispecs/08-cli-interface.spec.md +13 -25
- package/rispecs/09-mcp-server.spec.md +57 -62
- package/rispecs/10-audio-module.spec.md +3 -3
- package/rispecs/KINSHIP.md +4 -4
- package/rispecs/README.md +33 -7
- package/articles/academic/creative-orientation-vs-problem-solving.md +0 -177
- package/articles/academic/jsonl-knowledge-graphs-agent-memory.md +0 -142
- package/articles/academic/langfuse-observability-llm-pipelines.md +0 -144
- package/articles/academic/medicine-wheel-software-architecture.md +0 -163
- package/articles/academic/mmot-autonomous-agents.md +0 -156
- package/articles/academic/model-context-protocol-interagent.md +0 -161
- package/articles/academic/pde-prompt-decomposition.md +0 -186
- package/articles/academic/structural-tension-in-ai-agents.md +0 -134
- package/articles/reviews/mcp-protocol-design-review.md +0 -170
- package/articles/reviews/observability-ai-systems-review.md +0 -176
- package/articles/reviews/prompt-engineering-decomposition-review.md +0 -184
- package/articles/surveys/agent-orchestration-survey.md +0 -186
- package/articles/surveys/knowledge-graph-storage-survey.md +0 -204
- package/articles/surveys/structural-tension-methodology-survey.md +0 -154
- package/articles/technical/aws-sdk-v3-polly.md +0 -270
- package/articles/technical/commander-cli-framework.md +0 -262
- package/articles/technical/dotenv-config-patterns.md +0 -360
- package/articles/technical/ioredis-vs-redis.md +0 -142
- package/articles/technical/langfuse-js-sdk-vs-rest.md +0 -191
- package/articles/technical/mcp-sdk-typescript.md +0 -291
- package/articles/technical/octokit-github-api.md +0 -293
- package/articles/technical/openai-sdk-modern.md +0 -231
- package/articles/technical/yaml-parsing-node.md +0 -266
- package/articles/technical/zod-runtime-validation.md +0 -212
- package/mcp/config.ts +0 -196
- package/mcp/server.ts +0 -402
- package/mcp/tools/coaiapy-tools.ts +0 -364
- package/mcp/tools/index.ts +0 -4
- package/src/audio.ts +0 -76
- package/src/cli-helpers.ts +0 -86
- package/src/cli.ts +0 -1223
- package/src/config.ts +0 -172
- package/src/environment.ts +0 -171
- package/src/github.ts +0 -143
- package/src/langfuse/client.ts +0 -105
- package/src/langfuse/comments.ts +0 -52
- package/src/langfuse/datasets.ts +0 -178
- package/src/langfuse/index.ts +0 -33
- package/src/langfuse/media.ts +0 -193
- package/src/langfuse/observations.ts +0 -131
- package/src/langfuse/prompts.ts +0 -157
- package/src/langfuse/scores.ts +0 -456
- package/src/langfuse/traces.ts +0 -276
- package/src/llm.ts +0 -106
- package/src/narrative/graph-manager.ts +0 -1358
- package/src/narrative/index.ts +0 -32
- package/src/narrative/markdown-export.ts +0 -535
- package/src/narrative/tool-definitions.ts +0 -635
- package/src/narrative/tool-handlers.ts +0 -528
- package/src/narrative/types.ts +0 -9
- package/src/narrative/validation.ts +0 -179
- package/src/pde/index.ts +0 -8
- package/src/pde/mcp-handlers.ts +0 -359
- package/src/pde/mcp-tools.ts +0 -201
- package/src/pde/session-manager.ts +0 -248
- package/src/pde/stc-mapper.ts +0 -298
- package/src/pipeline/index.ts +0 -7
- package/src/pipeline/template-engine.ts +0 -398
- package/src/planning/index.ts +0 -13
- package/src/planning/mcp-handlers.ts +0 -369
- package/src/planning/mcp-tools.ts +0 -155
- package/src/planning/plan-parser.ts +0 -587
- package/src/redis.ts +0 -97
- package/src/types.ts +0 -280
- package/tsconfig.json +0 -26
|
@@ -9,62 +9,60 @@ A single MCP server (`coaiajs-mcp`) that consolidates the 44 tools from coaia-na
|
|
|
9
9
|
## Structural Tension
|
|
10
10
|
|
|
11
11
|
**Current Reality:**
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
- Users currently need 3 MCP server entries in their config to access all tools
|
|
12
|
+
- [`package.json`](../package.json) defines `"coaiajs-mcp": "./dist/mcp/server.js"`.
|
|
13
|
+
- [`mcp/server.ts`](../mcp/server.ts) implements stdio MCP transport using `@modelcontextprotocol/sdk`.
|
|
14
|
+
- [`mcp/config.ts`](../mcp/config.ts) implements `MINIMAL`, `STANDARD`, `OBSERVABILITY`, and `FULL` feature sets via `COAIAJS_FEATURES` or `--features`.
|
|
15
|
+
- [`mcp/tools/coaiapy-tools.ts`](../mcp/tools/coaiapy-tools.ts) defines coaiapy-compatible Redis and Langfuse tool schemas.
|
|
16
|
+
- [`mcp/resources.ts`](../mcp/resources.ts) implements `coaia://templates/` resources backed by the pipeline template loader.
|
|
17
|
+
- [`mcp/prompts.ts`](../mcp/prompts.ts) implements the three coaiapy-mcp prompt templates.
|
|
18
|
+
- `npx coaiajs-mcp` starts successfully from an installed package tarball and reports `STANDARD: 64 tools, 3 prompts, 3 resources`.
|
|
19
|
+
- Remaining gap: several desired package-native tool groups (audio and pipeline execution tools) are not exposed as standalone MCP tools yet; pipeline templates are currently exposed as resources.
|
|
21
20
|
|
|
22
21
|
**Desired Outcome:**
|
|
23
22
|
Single MCP server at `mcp/server.ts` providing:
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- Feature gating via `
|
|
23
|
+
- Parent and coaiapy-compatible tools through one stdio server
|
|
24
|
+
- Template resources and workflow prompts from coaiapy-mcp
|
|
25
|
+
- Feature gating via `COAIAJS_FEATURES` or `--features`
|
|
27
26
|
- Single server entry in MCP client config
|
|
28
27
|
|
|
29
28
|
## Feature Gating
|
|
30
29
|
|
|
31
30
|
```typescript
|
|
32
|
-
type
|
|
31
|
+
type FeatureLevel = 'MINIMAL' | 'STANDARD' | 'OBSERVABILITY' | 'FULL';
|
|
33
32
|
```
|
|
34
33
|
|
|
35
34
|
| Mode | Tools loaded | Use case |
|
|
36
35
|
|------|-------------|----------|
|
|
37
|
-
| **MINIMAL** |
|
|
38
|
-
| **STANDARD** | MINIMAL +
|
|
39
|
-
| **
|
|
36
|
+
| **MINIMAL** | Redis + Langfuse observability core tools | Observability-only sessions |
|
|
37
|
+
| **STANDARD** | MINIMAL + narrative + PDE + planning tools | Standard development sessions |
|
|
38
|
+
| **OBSERVABILITY** | Alias of STANDARD in current implementation | Compatibility mode |
|
|
39
|
+
| **FULL** | All registered tools, including media tools | Full-featured agent sessions |
|
|
40
40
|
|
|
41
|
-
Default
|
|
41
|
+
Default feature level: `STANDARD`.
|
|
42
42
|
|
|
43
43
|
## Server Architecture
|
|
44
44
|
|
|
45
45
|
```typescript
|
|
46
46
|
// mcp/server.ts
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const server = new McpServer({
|
|
47
|
+
const featureConfig = new FeatureConfig(cliArgs.featureLevel);
|
|
48
|
+
const server = new Server({
|
|
51
49
|
name: 'coaiajs-mcp',
|
|
52
|
-
version:
|
|
50
|
+
version: '0.1.1',
|
|
51
|
+
}, {
|
|
52
|
+
capabilities: {
|
|
53
|
+
tools: {},
|
|
54
|
+
resources: {},
|
|
55
|
+
prompts: {},
|
|
56
|
+
},
|
|
53
57
|
});
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (mode === 'FULL') {
|
|
64
|
-
registerLangfuseTools(server);
|
|
65
|
-
registerPipelineTools(server);
|
|
66
|
-
registerAudioTools(server);
|
|
67
|
-
}
|
|
59
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
60
|
+
tools: allTools.filter((tool) => featureConfig.isToolEnabled(tool.name)),
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
64
|
+
return handleToolCall(request.params.name, request.params.arguments ?? {});
|
|
65
|
+
});
|
|
68
66
|
|
|
69
67
|
const transport = new StdioServerTransport();
|
|
70
68
|
await server.connect(transport);
|
|
@@ -82,47 +80,44 @@ Narrative Beats: `create_narrative_beat`, `telescope_narrative_beat`, `list_narr
|
|
|
82
80
|
|
|
83
81
|
MMOT: `perform_mmot_evaluation`, `init_llm_guidance`
|
|
84
82
|
|
|
85
|
-
### PDE Engine (
|
|
83
|
+
### PDE Engine (10 tools — STANDARD+)
|
|
86
84
|
|
|
87
|
-
`
|
|
85
|
+
`import_pde_decomposition`, `create_stc_from_pde`, `list_pde_decompositions`, `get_session`, `list_sessions`, `pde_update_action_progress`, `pde_mark_action_complete`, `pde_add_action_step`, `pde_update_current_reality`, `complete_session`
|
|
88
86
|
|
|
89
87
|
### Planning Engine (6 tools — STANDARD+)
|
|
90
88
|
|
|
91
|
-
`
|
|
89
|
+
`parse_plan_structural`, `plan_to_stc`, `sync_plan_to_chart`, `sync_chart_to_plan`, `create_plan_trace`, `pde_to_plan`
|
|
92
90
|
|
|
93
|
-
### Redis
|
|
91
|
+
### Redis
|
|
94
92
|
|
|
95
|
-
`
|
|
93
|
+
`coaia_tash`, `coaia_fetch`
|
|
96
94
|
|
|
97
|
-
### Langfuse
|
|
95
|
+
### Langfuse
|
|
98
96
|
|
|
99
|
-
`
|
|
97
|
+
`coaia_fuse_trace_create`, `coaia_fuse_add_observation`, `coaia_fuse_trace_patch_output`, `coaia_fuse_trace_get`, `coaia_fuse_trace_view`, `coaia_fuse_observation_get`, `coaia_fuse_traces_list`, `coaia_fuse_traces_session_view`, comments, prompts, datasets, score configs, score application, and media tools.
|
|
100
98
|
|
|
101
|
-
###
|
|
99
|
+
### Resources
|
|
102
100
|
|
|
103
|
-
`
|
|
101
|
+
`coaia://templates/`, `coaia://templates/{name}`, `coaia://templates/{name}/variables`
|
|
104
102
|
|
|
105
|
-
###
|
|
103
|
+
### Prompts
|
|
106
104
|
|
|
107
|
-
`
|
|
105
|
+
`mia_miette_duo`, `create_observability_pipeline`, `analyze_audio_workflow`
|
|
108
106
|
|
|
109
107
|
## Tool Registration Pattern
|
|
110
108
|
|
|
111
|
-
|
|
109
|
+
The current server uses plain tool definition arrays plus dispatch handlers:
|
|
112
110
|
|
|
113
111
|
```typescript
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
// ... more tools
|
|
125
|
-
}
|
|
112
|
+
const allToolDefs = [
|
|
113
|
+
...getCoaiapyToolDefinitions(featureConfig),
|
|
114
|
+
...getNarrativeToolDefinitions(featureConfig),
|
|
115
|
+
...getPdeToolDefinitions(featureConfig),
|
|
116
|
+
...getPlanningToolDefinitions(featureConfig),
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: allToolDefs }));
|
|
120
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => routeToolCall(request.params));
|
|
126
121
|
```
|
|
127
122
|
|
|
128
123
|
## Transport
|
|
@@ -132,9 +127,9 @@ stdio transport only (standard MCP pattern). Server reads JSON-RPC from stdin, w
|
|
|
132
127
|
## Quality Criteria
|
|
133
128
|
|
|
134
129
|
- ✅ Single MCP config entry replaces three separate servers
|
|
135
|
-
- ✅
|
|
130
|
+
- ✅ Implemented parent tools route to TypeScript handlers instead of placeholders
|
|
136
131
|
- ✅ Feature gating reduces tool count without breaking functionality
|
|
137
|
-
- ✅ `
|
|
138
|
-
- ✅ Server starts
|
|
132
|
+
- ✅ `COAIAJS_FEATURES` and `--features` select feature level
|
|
133
|
+
- ✅ Server starts from installed tarball with `npx coaiajs-mcp`
|
|
139
134
|
- ✅ Tool descriptions are self-documenting (LLMs understand usage without external docs)
|
|
140
135
|
- ✅ Error responses include actionable information
|
|
@@ -9,11 +9,11 @@ An audio module providing speech-to-text transcription via OpenAI Whisper and te
|
|
|
9
9
|
## Structural Tension
|
|
10
10
|
|
|
11
11
|
**Current Reality:**
|
|
12
|
-
- `src/audio.ts`
|
|
13
|
-
- `src/llm.ts`
|
|
12
|
+
- [`src/audio.ts`](../src/audio.ts) implements `synthesize()` with AWS Polly and lazy client initialization.
|
|
13
|
+
- [`src/llm.ts`](../src/llm.ts) implements `transcribeAudio()` with OpenAI Whisper and exposes `llm()`, `generateImage()`, and `abstractProcess()`.
|
|
14
14
|
- Both use lazy client initialization
|
|
15
15
|
- coaiapy's `syntation.py` provides the same functionality via boto3 and openai Python packages
|
|
16
|
-
-
|
|
16
|
+
- Remaining gap: audio is available through the library and CLI transcription path, but standalone MCP audio tools are not wired yet.
|
|
17
17
|
|
|
18
18
|
**Desired Outcome:**
|
|
19
19
|
Audio module consolidating transcription and synthesis in one place:
|
package/rispecs/KINSHIP.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Name:** coaiajs rispecs
|
|
6
6
|
**Role:** RISE-based structural specifications for the coaiajs platform
|
|
7
|
-
**Status:**
|
|
7
|
+
**Status:** Maintained implementation-linked specs (updated 2026-05-07)
|
|
8
8
|
|
|
9
9
|
## Lineage
|
|
10
10
|
|
|
@@ -34,10 +34,10 @@ These specifications synthesize the creative intent, structural patterns, and be
|
|
|
34
34
|
## Accountabilities
|
|
35
35
|
|
|
36
36
|
1. **Completeness** — These specs are sufficient for another LLM to re-implement the entire coaiajs platform from scratch
|
|
37
|
-
2. **Accuracy** — Current reality assessments are honest and factual, reflecting actual implementation state as of 2026-
|
|
37
|
+
2. **Accuracy** — Current reality assessments are honest and factual, reflecting actual implementation state as of 2026-05-07
|
|
38
38
|
3. **Creative orientation** — All desired outcomes use creation language, not problem-solving language
|
|
39
39
|
4. **Backward compatibility** — Specs preserve behavioral compatibility with parent projects
|
|
40
|
-
5. **
|
|
40
|
+
5. **Traceability** — Specs link to the code files that carry current behavior
|
|
41
41
|
|
|
42
42
|
## Consumers
|
|
43
43
|
|
|
@@ -53,4 +53,4 @@ These specifications synthesize the creative intent, structural patterns, and be
|
|
|
53
53
|
|
|
54
54
|
**Desired Outcome:** These rispecs serve as the single source of truth for what coaiajs should become — complete enough for autonomous re-implementation, accurate enough for MMOT self-evaluation.
|
|
55
55
|
|
|
56
|
-
**Current Reality:** 13 spec files covering the full platform. Parent project rispecs remain authoritative for deep behavioral details (especially coaia-narrative's 15 specs). These specs
|
|
56
|
+
**Current Reality:** 13 spec files covering the full platform. Parent project rispecs remain authoritative for deep behavioral details (especially coaia-narrative's 15 specs). These specs now include implementation links for `src/`, `mcp/`, and package metadata so evaluators can trace desired behavior to current code.
|
package/rispecs/README.md
CHANGED
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
These rispecs define the structural specifications for **coaiajs** — the unified TypeScript platform that consolidates `coaiapy`, `coaia-narrative`, `coaia-pde`, and `coaia-planning` into a single modern Node.js package.
|
|
9
9
|
|
|
10
|
+
## RISE Framework Source
|
|
11
|
+
|
|
12
|
+
These specs use the RISE Framework at `/src/llms/llms-rise-framework.txt` as the governing method:
|
|
13
|
+
|
|
14
|
+
- **Reverse-engineer** parent package behavior from `coaiapy`, `coaia-narrative`, `coaia-pde`, and `coaia-planning`.
|
|
15
|
+
- **Intent-extract** the creative outcome each module makes possible.
|
|
16
|
+
- **Specify** the structural tension between current implementation and desired package behavior.
|
|
17
|
+
- **Export** enough code-linked detail for an evaluator or implementation agent to act without rediscovery.
|
|
18
|
+
|
|
10
19
|
## Specification Index
|
|
11
20
|
|
|
12
21
|
### Platform
|
|
@@ -73,6 +82,22 @@ These rispecs define the structural specifications for **coaiajs** — the unifi
|
|
|
73
82
|
└─────────────────────────────────────────────────────┘
|
|
74
83
|
```
|
|
75
84
|
|
|
85
|
+
## Implementation Map
|
|
86
|
+
|
|
87
|
+
| Spec | Primary implementation |
|
|
88
|
+
|------|------------------------|
|
|
89
|
+
| 00 platform | [`package.json`](../package.json), [`src/index.ts`](../src/index.ts) |
|
|
90
|
+
| 01 config | [`src/config.ts`](../src/config.ts), [`src/types.ts`](../src/types.ts) |
|
|
91
|
+
| 02 redis | [`src/redis.ts`](../src/redis.ts), [`mcp/tools/coaiapy-tools.ts`](../mcp/tools/coaiapy-tools.ts) |
|
|
92
|
+
| 03 langfuse | [`src/langfuse/`](../src/langfuse/), [`mcp/server.ts`](../mcp/server.ts) |
|
|
93
|
+
| 04 narrative | [`src/narrative/`](../src/narrative/), [`src/narrative/index.ts`](../src/narrative/index.ts) |
|
|
94
|
+
| 05 PDE | [`src/pde/`](../src/pde/), [`src/pde/mcp-tools.ts`](../src/pde/mcp-tools.ts) |
|
|
95
|
+
| 06 planning | [`src/planning/`](../src/planning/), [`src/planning/mcp-tools.ts`](../src/planning/mcp-tools.ts) |
|
|
96
|
+
| 07 pipeline | [`src/pipeline/`](../src/pipeline/), [`mcp/resources.ts`](../mcp/resources.ts) |
|
|
97
|
+
| 08 CLI | [`src/cli.ts`](../src/cli.ts), [`package.json`](../package.json) `bin.coaia` |
|
|
98
|
+
| 09 MCP | [`mcp/server.ts`](../mcp/server.ts), [`mcp/config.ts`](../mcp/config.ts), [`mcp/prompts.ts`](../mcp/prompts.ts) |
|
|
99
|
+
| 10 audio | [`src/audio.ts`](../src/audio.ts), [`src/llm.ts`](../src/llm.ts) |
|
|
100
|
+
|
|
76
101
|
## Conventions
|
|
77
102
|
|
|
78
103
|
- **Creative orientation**: Desired Outcome describes what IS CREATED, not what is fixed
|
|
@@ -80,7 +105,7 @@ These rispecs define the structural specifications for **coaiajs** — the unifi
|
|
|
80
105
|
- **Structural tension**: The gap between current and desired that drives advancement
|
|
81
106
|
- **Variable detail**: Broad for obvious patterns, precise for critical behavior
|
|
82
107
|
- **Naming**: `NN-kebab-case.spec.md`
|
|
83
|
-
- **
|
|
108
|
+
- **Code-linked**: Specs describe behavior and link to the implementation files that currently carry it
|
|
84
109
|
|
|
85
110
|
## Relationship to Parent Rispecs
|
|
86
111
|
|
|
@@ -91,10 +116,11 @@ These rispecs define the structural specifications for **coaiajs** — the unifi
|
|
|
91
116
|
| coaia-planning | — | No rispecs yet — spec 06 here is the first |
|
|
92
117
|
| coaiapy | — | No rispecs — specs 01-03, 07, 10 here are the first |
|
|
93
118
|
|
|
94
|
-
##
|
|
119
|
+
## Maintenance Protocol
|
|
120
|
+
|
|
121
|
+
When code changes, update the relevant spec in the same pass:
|
|
95
122
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
- **E**xport: Produce specs sufficient for autonomous re-implementation
|
|
123
|
+
1. Adjust **Current Reality** to match implemented files and verified behavior.
|
|
124
|
+
2. Add or revise implementation links in the local spec and this README map.
|
|
125
|
+
3. Keep **Desired Outcome** forward-looking only where a gap remains.
|
|
126
|
+
4. Re-run `npm run build`, `npm test`, and `npm pack --dry-run` before handing off.
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# Creative Orientation vs. Problem-Solving in AI Agent Design
|
|
2
|
-
|
|
3
|
-
> Academic brief for the CoAiA.js project — Why Robert Fritz's distinction between creative orientation (advancing toward desired outcomes) and problem-solving orientation (retreating from problems) is foundational for AI agent architecture.
|
|
4
|
-
|
|
5
|
-
## Abstract
|
|
6
|
-
|
|
7
|
-
AI agent architectures predominantly operate from what Robert Fritz terms "problem-solving orientation"—systems designed to detect undesirable states and take corrective action to eliminate them. This paper argues that problem-solving orientation produces structurally oscillatory agents: as problems diminish, the energy driving correction also diminishes, leading to cyclical regression. We present Fritz's alternative—creative orientation, where agents are structured to advance toward clearly articulated desired outcomes—and analyze its implications for AI agent design. Creative orientation produces advancing rather than oscillating dynamics by maintaining structural tension between a constant vision and an evolving reality. We examine how this distinction manifests in agent goal management, reward design, evaluation criteria, and long-term behavioral patterns. The analysis provides the theoretical foundation for CoAiA.js's creative-orientation-first architecture.
|
|
8
|
-
|
|
9
|
-
## Introduction
|
|
10
|
-
|
|
11
|
-
Consider two agents given the same objective—"improve code quality in this repository."
|
|
12
|
-
|
|
13
|
-
**Agent A (Problem-Solving)** scans for problems: lint errors, security vulnerabilities, code smells, missing tests. It fixes each issue found. As the issue count drops from 200 to 20, its rate of productive activity slows—there are fewer problems to find. When a team member introduces new issues, Agent A reactivates. It oscillates between "fixing problems" and "waiting for problems."
|
|
14
|
-
|
|
15
|
-
**Agent B (Creative Orientation)** begins by articulating a desired outcome: "A codebase with consistent architecture patterns, comprehensive test coverage, clear documentation, and proactive error handling." It then honestly assesses current reality. The structural tension between vision and reality drives sustained action—not just fixing what's wrong, but creating what's desired. When the issue count drops from 200 to 20, Agent B's energy does not diminish: the vision includes positive qualities (clarity, consistency, comprehensiveness) that have not yet been fully realized [1].
|
|
16
|
-
|
|
17
|
-
This distinction—between agents that react to problems and agents that create toward visions—is the central contribution of Robert Fritz's work to AI agent design.
|
|
18
|
-
|
|
19
|
-
## Background
|
|
20
|
-
|
|
21
|
-
### Fritz's Structural Dynamics
|
|
22
|
-
|
|
23
|
-
Robert Fritz, in *The Path of Least Resistance* (1989) and subsequent works, identified two fundamental orientations toward action:
|
|
24
|
-
|
|
25
|
-
**Problem-Solving Orientation (Reactive-Responsive):**
|
|
26
|
-
- Motivation comes from what you don't want
|
|
27
|
-
- Energy is generated by the presence of a problem
|
|
28
|
-
- As the problem diminishes, energy for action also diminishes
|
|
29
|
-
- This creates oscillating structures: action → problem reduced → motivation reduced → problem returns → action resumes
|
|
30
|
-
- The system perpetually returns to a baseline state
|
|
31
|
-
|
|
32
|
-
**Creative Orientation (Generative):**
|
|
33
|
-
- Motivation comes from what you want to create
|
|
34
|
-
- Energy is generated by the vision of a desired outcome
|
|
35
|
-
- As current reality advances toward the vision, new aspects of the vision become relevant
|
|
36
|
-
- This creates advancing structures: action → reality improves → new creative possibilities emerge → further action
|
|
37
|
-
- The system progressively builds upon prior achievements [2][3]
|
|
38
|
-
|
|
39
|
-
Fritz demonstrated this pattern across domains: personal development, organizational leadership, artistic creation, and strategic planning. The key insight is that these are **structural** properties—not motivational or psychological ones. The underlying structure of the goal system determines whether it oscillates or advances, regardless of the effort or intention of the agents operating within it.
|
|
40
|
-
|
|
41
|
-
### Problem-Solving in Traditional AI
|
|
42
|
-
|
|
43
|
-
The dominant paradigms in AI agent design are structurally problem-solving:
|
|
44
|
-
|
|
45
|
-
**Reinforcement Learning:** An agent receives negative reward (penalty) for undesirable states and learns to avoid them. The reward signal is fundamentally reactive—it measures distance from problems, not proximity to creative vision. Reward shaping can approximate creative orientation, but the underlying structure remains problem-reactive.
|
|
46
|
-
|
|
47
|
-
**Loss Minimization:** Neural networks are trained to minimize a loss function—the gap between predicted and target outputs. This is structurally identical to problem-solving: the "problem" (high loss) drives action, and as loss approaches zero, gradient magnitude diminishes.
|
|
48
|
-
|
|
49
|
-
**Error Correction:** Agent architectures that detect errors and trigger correction routines (retry logic, fallback strategies, error handlers) are purely reactive—they activate only when problems occur.
|
|
50
|
-
|
|
51
|
-
**Goal Satisfaction:** STRIPS-style planning treats goals as conditions to satisfy. Once satisfied, no further action occurs—there is no mechanism for ongoing creative advancement [4].
|
|
52
|
-
|
|
53
|
-
## Analysis
|
|
54
|
-
|
|
55
|
-
### Structural Properties of Oscillation
|
|
56
|
-
|
|
57
|
-
Oscillation in problem-solving systems follows a predictable pattern:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
Problem Detected → High Energy → Action → Problem Reduced →
|
|
61
|
-
Low Energy → Inaction → Problem Returns → High Energy → Action...
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
In AI agent terms:
|
|
65
|
-
1. Agent detects high error rate in generated code
|
|
66
|
-
2. Agent focuses energy on fixing errors
|
|
67
|
-
3. Error rate drops to acceptable level
|
|
68
|
-
4. Agent shifts attention away (to other tasks or enters idle state)
|
|
69
|
-
5. Without ongoing attention, new errors accumulate or latent issues surface
|
|
70
|
-
6. Agent re-detects high error rate
|
|
71
|
-
7. Cycle repeats
|
|
72
|
-
|
|
73
|
-
The oscillation is not a failure of the agent's capabilities—it is a structural property of the problem-solving architecture. The more capable the agent, the faster it oscillates, but oscillation remains.
|
|
74
|
-
|
|
75
|
-
### Structural Properties of Advancement
|
|
76
|
-
|
|
77
|
-
Creative orientation produces a different dynamic:
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
Vision Articulated → Structural Tension → Action → Reality Advances →
|
|
81
|
-
New Aspects of Vision Become Relevant → Renewed Tension → Further Action...
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
In AI agent terms:
|
|
85
|
-
1. Agent articulates desired outcome: "A robust, well-documented API with comprehensive error handling, 95% test coverage, and clear usage examples"
|
|
86
|
-
2. Agent assesses current reality: "API has 12 endpoints, 4 undocumented, 62% test coverage, no error handling pattern"
|
|
87
|
-
3. Structural tension drives action toward the vision
|
|
88
|
-
4. After improving documentation and adding tests: current reality is now "12 endpoints, all documented, 78% test coverage, basic error handling"
|
|
89
|
-
5. The vision hasn't changed—new aspects (usage examples, comprehensive error handling, 95% coverage) maintain tension
|
|
90
|
-
6. Agent continues advancing rather than oscillating
|
|
91
|
-
|
|
92
|
-
### Design Implications for AI Agents
|
|
93
|
-
|
|
94
|
-
#### Goal Representation
|
|
95
|
-
|
|
96
|
-
Problem-solving agents encode goals as conditions to eliminate:
|
|
97
|
-
```json
|
|
98
|
-
{"goal": "reduce_lint_errors", "target": 0, "current": 47}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Creative-orientation agents encode goals as outcomes to create:
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
"desiredOutcome": "A codebase with consistent naming conventions, modular architecture, and clear documentation at every public interface",
|
|
105
|
-
"currentReality": "Mixed naming conventions across 3 historical styles. 40% of modules have circular dependencies. 12 of 45 public functions undocumented."
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
The creative-orientation representation is richer, more nuanced, and maintains tension even when any single metric improves.
|
|
110
|
-
|
|
111
|
-
#### Evaluation Criteria
|
|
112
|
-
|
|
113
|
-
Problem-solving evaluation asks: "Is the problem gone?"
|
|
114
|
-
Creative-orientation evaluation asks: "How does the current state compare to the desired creation?"
|
|
115
|
-
|
|
116
|
-
The MMOT (Managerial Moment of Truth) cycle is inherently creative-orientation: it evaluates against Elements of Performance derived from the desired outcome, not against a problem checklist.
|
|
117
|
-
|
|
118
|
-
#### Energy Management
|
|
119
|
-
|
|
120
|
-
Problem-solving agents need external triggers (error events, threshold violations) to activate. Creative-orientation agents generate their own energy through structural tension—the gap between vision and reality is an intrinsic motivator that doesn't require external events.
|
|
121
|
-
|
|
122
|
-
This has practical implications for agent scheduling: problem-solving agents need polling loops or event subscriptions; creative-orientation agents can self-schedule based on tension assessment.
|
|
123
|
-
|
|
124
|
-
#### Long-Term Behavioral Patterns
|
|
125
|
-
|
|
126
|
-
Over extended operation:
|
|
127
|
-
- **Problem-solving agents** produce a sawtooth pattern: rapid improvement followed by plateau and regression
|
|
128
|
-
- **Creative-orientation agents** produce a staircase pattern: sustained improvement with each step building on the previous one
|
|
129
|
-
|
|
130
|
-
This is because creative-orientation agents "lock in" progress by updating their current reality assessment. Once a capability is created, it becomes part of the new baseline—the agent doesn't need to re-create it, and can build further upon it.
|
|
131
|
-
|
|
132
|
-
### The Hybrid Case: Creative Orientation with Problem Awareness
|
|
133
|
-
|
|
134
|
-
Fritz does not argue that problem-solving is always wrong—sometimes urgent problems require immediate reactive response. The key insight is that problem-solving should be *subordinate to* creative orientation, not the primary driver:
|
|
135
|
-
|
|
136
|
-
1. **Primary:** Maintain structural tension toward the desired outcome
|
|
137
|
-
2. **Secondary:** Address problems that arise as obstacles to advancement
|
|
138
|
-
3. **Never:** Let problem-solving become the primary orientation
|
|
139
|
-
|
|
140
|
-
In agent architecture terms: the structural tension chart defines the creative frame; error handlers and correction routines address specific problems within that frame; but the frame itself is creative, not reactive [5].
|
|
141
|
-
|
|
142
|
-
### Fritz's Insight Applied to Reward Engineering
|
|
143
|
-
|
|
144
|
-
In reinforcement learning, reward design is notoriously difficult—reward hacking, sparse rewards, and reward misspecification are persistent challenges. Fritz's creative/problem-solving distinction suggests a fundamental issue: most reward functions are problem-solving in structure (penalizing bad states) rather than creative (describing desired creations).
|
|
145
|
-
|
|
146
|
-
A creative-orientation reward function would:
|
|
147
|
-
- Describe the desired state in positive, compositional terms
|
|
148
|
-
- Maintain its value even as the agent approaches the goal (because the description is rich enough to reveal new aspects)
|
|
149
|
-
- Not diminish as specific problems are resolved
|
|
150
|
-
- Be evaluated holistically (how does reality compare to the full vision?) rather than componentally (which problems remain?)
|
|
151
|
-
|
|
152
|
-
## Implications for CoAiA.js
|
|
153
|
-
|
|
154
|
-
Creative orientation is the architectural foundation of CoAiA.js:
|
|
155
|
-
|
|
156
|
-
1. **All agent sessions begin with vision articulation.** Before any action, agents define what they want to create—not what problems they want to solve.
|
|
157
|
-
2. **Structural tension charts, not task lists.** The primary data structure is the STC (desired outcome + current reality), not a problem backlog.
|
|
158
|
-
3. **MMOT evaluates against creative criteria.** Self-evaluation measures advancement toward the desired outcome, not merely problem elimination.
|
|
159
|
-
4. **Reality assessment is continuous and honest.** Agents regularly update their current reality assessment, maintaining the tension that drives creative advancement.
|
|
160
|
-
5. **Problem-solving is subordinate.** Error handlers and correction routines operate within the creative frame, addressing obstacles to advancement without becoming the primary orientation.
|
|
161
|
-
|
|
162
|
-
## Conclusion
|
|
163
|
-
|
|
164
|
-
The distinction between creative orientation and problem-solving is not philosophical decoration—it is a structural property with measurable behavioral consequences. Agents designed around problem-solving oscillate; agents designed around creative orientation advance. CoAiA.js implements this insight at the architectural level, producing agents that create toward visions rather than merely react to problems. The result is sustained forward momentum, resistance to oscillation, and the capacity for genuine creative advancement in autonomous AI systems.
|
|
165
|
-
|
|
166
|
-
## References
|
|
167
|
-
|
|
168
|
-
1. Fritz, R. (1989). *The Path of Least Resistance: Learning to Become the Creative Force in Your Own Life*. Fawcett Columbine.
|
|
169
|
-
2. Fritz, R. "The Creative Process." Robert Fritz Inc. https://www.robertfritz.com/wp/the-creative-process/
|
|
170
|
-
3. Fritz, R. "Thinking in Structures." Robert Fritz Inc. https://www.robertfritz.com/wp/thinking-in-structures/
|
|
171
|
-
4. Systems Field Book. "Creative Orientation." https://www.systemsfieldbook.org/creative-orientation
|
|
172
|
-
5. jgwill/llms-txt. "Creative Orientation Documentation." https://github.com/jgwill/llms-txt/blob/main/docs/creative-orientation.md
|
|
173
|
-
6. Fritz, R. "Writings." Robert Fritz Inc. https://www.robertfritz.com/wp/writings/
|
|
174
|
-
7. Senge, P. (1990). *The Fifth Discipline: The Art & Practice of the Learning Organization*. Doubleday.
|
|
175
|
-
8. Sutton, R. S., & Barto, A. G. (2018). *Reinforcement Learning: An Introduction*. 2nd ed. MIT Press.
|
|
176
|
-
9. Think-2-Thrive. (2024). "Leading with Creative Tension." https://think-2-thrive.com/2024/12/02/blog-55-leading-with-creative-tension/
|
|
177
|
-
10. Springer. (2024). "A TRIZ and Socratic AI-Based Problem-Solving Framework." https://link.springer.com/chapter/10.1007/978-3-032-08847-5_20
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
# JSONL as Lightweight Knowledge Graph Storage for AI Agent Memory
|
|
2
|
-
|
|
3
|
-
> Academic brief for the CoAiA.js project — Append-only line-delimited JSON as a knowledge graph substrate for agent state, compared with Neo4j, SQLite, and vector databases.
|
|
4
|
-
|
|
5
|
-
## Abstract
|
|
6
|
-
|
|
7
|
-
AI agent systems require persistent memory that balances expressiveness, queryability, and operational simplicity. This paper evaluates JSON Lines (JSONL)—an append-only, line-delimited JSON format—as a lightweight knowledge graph storage mechanism for agent memory. We compare JSONL entity-relation storage against established alternatives: Neo4j (property graphs), SQLite (relational), and vector databases (embedding-based retrieval). Our analysis demonstrates that JSONL offers unique advantages for agent memory workloads: zero-dependency deployment, natural append-only semantics aligned with temporal agent state, human-readable audit trails, and sufficient query performance for single-agent session contexts. We formalize the JSONL entity-relation model used in CoAiA.js, analyze its trade-offs against richer graph storage, and identify the operational sweet spot where JSONL-backed knowledge graphs outperform heavier alternatives.
|
|
8
|
-
|
|
9
|
-
## Introduction
|
|
10
|
-
|
|
11
|
-
The rise of autonomous AI agents—systems that maintain state across interactions, learn from observations, and pursue multi-step goals—has created an urgent need for agent memory architectures that are both expressive and operationally lightweight. An agent's memory must encode entities (concepts, observations, decisions), relations between entities (causal links, dependencies, temporal orderings), and evolving state (current reality assessments, progress markers) [1].
|
|
12
|
-
|
|
13
|
-
The knowledge graph community has traditionally addressed such requirements through property graph databases (Neo4j, Memgraph), RDF triple stores (GraphDB, Fuseki), or more recently, vector databases (Pinecone, Weaviate, Chroma). Each brings significant capabilities but also operational overhead: server processes, schema management, connection pooling, and deployment complexity [2][3].
|
|
14
|
-
|
|
15
|
-
For many agent memory workloads—particularly single-agent sessions, development environments, and edge deployments—this overhead is disproportionate to the actual storage and query requirements. This paper argues that JSONL, combined with in-memory indexing, provides a knowledge graph storage substrate that is adequate for the majority of agent memory use cases while dramatically reducing operational complexity.
|
|
16
|
-
|
|
17
|
-
## Background
|
|
18
|
-
|
|
19
|
-
### JSON Lines (JSONL) Format
|
|
20
|
-
|
|
21
|
-
JSONL (also called newline-delimited JSON or NDJSON) is a text format where each line is a valid JSON object, separated by newline characters. The format has several properties relevant to knowledge graph storage:
|
|
22
|
-
|
|
23
|
-
1. **Append-only by nature.** New records are written by appending lines; existing records are never modified in place.
|
|
24
|
-
2. **Streamable.** Files can be processed line-by-line without loading the entire dataset into memory.
|
|
25
|
-
3. **Human-readable.** Records are inspectable with standard text tools (cat, grep, head, tail).
|
|
26
|
-
4. **Schema-flexible.** Each line can have a different structure, enabling heterogeneous entity types in a single file.
|
|
27
|
-
5. **Zero-dependency.** No server process, no driver library, no connection management [4].
|
|
28
|
-
|
|
29
|
-
### Knowledge Graph Storage Models
|
|
30
|
-
|
|
31
|
-
The landscape of knowledge graph storage can be categorized into four primary models:
|
|
32
|
-
|
|
33
|
-
- **Property Graphs (Neo4j, Memgraph, KuzuDB):** Nodes and edges with key-value properties; Cypher query language; optimized for traversals and path queries.
|
|
34
|
-
- **RDF Triple Stores (GraphDB, Fuseki, Blazegraph):** Subject-predicate-object triples with URI-based identification; SPARQL query language; strong semantic reasoning.
|
|
35
|
-
- **Relational (SQLite, PostgreSQL):** Tables with foreign key relationships; SQL query language; mature tooling but impedance mismatch with graph structures.
|
|
36
|
-
- **Vector Databases (Pinecone, Weaviate, Chroma):** Embedding-based storage optimized for similarity search; excellent for semantic retrieval but lacking explicit relational structure [5][6].
|
|
37
|
-
|
|
38
|
-
## Analysis
|
|
39
|
-
|
|
40
|
-
### The JSONL Entity-Relation Model
|
|
41
|
-
|
|
42
|
-
In the CoAiA.js implementation, knowledge graphs are stored as typed JSONL records with the following schema:
|
|
43
|
-
|
|
44
|
-
```jsonl
|
|
45
|
-
{"type":"entity","name":"mcp_server","entityType":"component","observations":["Handles tool dispatch","Uses stdio transport"]}
|
|
46
|
-
{"type":"entity","name":"langfuse_integration","entityType":"service","observations":["Traces LLM generations","MIT licensed"]}
|
|
47
|
-
{"type":"relation","from":"mcp_server","to":"langfuse_integration","relationType":"depends_on"}
|
|
48
|
-
{"type":"observation","entityName":"mcp_server","content":"Added error handling for malformed JSON-RPC requests","timestamp":"2026-03-10T14:00:00Z"}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This model encodes:
|
|
52
|
-
- **Entities** with typed classifications and evolving observation lists
|
|
53
|
-
- **Relations** between entities with typed edges
|
|
54
|
-
- **Temporal observations** that append new knowledge without modifying existing records
|
|
55
|
-
|
|
56
|
-
The append-only semantics are not a limitation but a feature: they naturally encode the temporal evolution of agent knowledge, enabling queries like "what did the agent know at time T?" without requiring event sourcing or temporal tables.
|
|
57
|
-
|
|
58
|
-
### Comparative Analysis
|
|
59
|
-
|
|
60
|
-
#### JSONL vs. Neo4j
|
|
61
|
-
|
|
62
|
-
Neo4j provides mature graph traversal capabilities, Cypher query language, and ACID transactions. For agent memory workloads, the key trade-offs are:
|
|
63
|
-
|
|
64
|
-
| Dimension | JSONL | Neo4j |
|
|
65
|
-
|-----------|-------|-------|
|
|
66
|
-
| Deployment | Zero-config file | JVM server process |
|
|
67
|
-
| Query Language | In-memory JavaScript/grep | Cypher |
|
|
68
|
-
| Path Queries | O(n) scan or in-memory index | Optimized native |
|
|
69
|
-
| Write Pattern | Append line | Transaction commit |
|
|
70
|
-
| Concurrent Access | Single-writer safe | Multi-writer ACID |
|
|
71
|
-
| Portability | Copy file | Export/import pipeline |
|
|
72
|
-
| Cost | Zero | Community/Enterprise licensing |
|
|
73
|
-
|
|
74
|
-
For single-agent sessions with knowledge graphs under 100,000 entities—which covers the vast majority of agent session workloads—JSONL with in-memory indexing provides sub-millisecond query times with zero operational overhead. Neo4j becomes necessary only when path query complexity or multi-user concurrency demands it.
|
|
75
|
-
|
|
76
|
-
#### JSONL vs. SQLite
|
|
77
|
-
|
|
78
|
-
SQLite offers a compelling middle ground: embedded, zero-config, yet supporting SQL queries and ACID transactions. However, SQLite's relational model creates impedance mismatch with graph structures:
|
|
79
|
-
|
|
80
|
-
- Graph traversals require recursive CTEs, which are syntactically complex and performance-limited.
|
|
81
|
-
- Schema changes (new entity types, new relation types) require ALTER TABLE operations.
|
|
82
|
-
- The append-only temporal model must be explicitly implemented rather than arising naturally from the storage format.
|
|
83
|
-
|
|
84
|
-
JSONL's schema flexibility and natural append semantics make it better suited to the evolving, heterogeneous nature of agent knowledge.
|
|
85
|
-
|
|
86
|
-
#### JSONL vs. Vector Databases
|
|
87
|
-
|
|
88
|
-
Vector databases excel at semantic similarity search—finding entities "similar to" a query embedding. However, they fundamentally lack explicit relational structure:
|
|
89
|
-
|
|
90
|
-
- Relations between entities must be encoded implicitly through embedding proximity or metadata filters.
|
|
91
|
-
- Temporal ordering is not native; timestamps must be stored as metadata and filtered externally.
|
|
92
|
-
- The retrieval model (top-k nearest neighbors) does not naturally support the "desired outcome vs. current reality" structural tension queries that drive agent behavior.
|
|
93
|
-
|
|
94
|
-
JSONL and vector databases are complementary rather than competing: JSONL provides the relational graph structure while vector embeddings (stored as entity properties) enable semantic retrieval within that structure.
|
|
95
|
-
|
|
96
|
-
### Performance Characteristics
|
|
97
|
-
|
|
98
|
-
For typical agent memory workloads (1,000–50,000 records per session), JSONL with in-memory indexing provides:
|
|
99
|
-
|
|
100
|
-
- **Write latency:** <1ms (file append)
|
|
101
|
-
- **Entity lookup:** <1ms (hash map)
|
|
102
|
-
- **Relation traversal:** <5ms (adjacency list)
|
|
103
|
-
- **Full scan:** <50ms for 50K records
|
|
104
|
-
- **File size:** ~5MB for 50K records (highly compressible)
|
|
105
|
-
|
|
106
|
-
These characteristics are more than adequate for interactive agent sessions where the bottleneck is LLM inference (typically 1-30 seconds per generation), not memory access.
|
|
107
|
-
|
|
108
|
-
### Limitations and Mitigations
|
|
109
|
-
|
|
110
|
-
JSONL-backed knowledge graphs have real limitations:
|
|
111
|
-
|
|
112
|
-
1. **No native query language.** Queries must be implemented in application code or via streaming filters. *Mitigation:* CoAiA.js provides a query API that loads JSONL into an in-memory graph structure on startup.
|
|
113
|
-
2. **No concurrent write safety.** Multiple writers can corrupt the file. *Mitigation:* Agent sessions are single-writer by design; file locking can be added for multi-agent scenarios.
|
|
114
|
-
3. **Linear scan for complex queries.** Path queries and graph algorithms require full load into memory. *Mitigation:* Agent session graphs are small enough for full in-memory operation.
|
|
115
|
-
4. **No built-in indexing.** Unlike databases, JSONL files have no persistent index structures. *Mitigation:* In-memory indexes are rebuilt on load, which takes <100ms for typical session sizes.
|
|
116
|
-
|
|
117
|
-
## Implications for CoAiA.js
|
|
118
|
-
|
|
119
|
-
CoAiA.js adopts JSONL as its primary knowledge graph storage format based on the analysis above. The implications are:
|
|
120
|
-
|
|
121
|
-
1. **Zero-dependency memory.** Agent sessions can persist state without any external service, enabling deployment in constrained environments (edge, CI/CD, development workstations).
|
|
122
|
-
2. **Full audit trail.** Every observation, entity, and relation ever created is preserved in temporal order, enabling complete reconstruction of agent reasoning.
|
|
123
|
-
3. **Git-friendly storage.** JSONL files produce clean diffs, enabling version control of agent memory—a critical capability for reproducible agent behavior.
|
|
124
|
-
4. **Composable with richer stores.** When workloads demand it, JSONL can be batch-imported into Neo4j or vector databases for advanced analysis without changing the write-time format.
|
|
125
|
-
5. **Human-debuggable.** Developers can inspect agent memory with `cat`, `grep`, and `jq`—no specialized tooling required.
|
|
126
|
-
|
|
127
|
-
## Conclusion
|
|
128
|
-
|
|
129
|
-
JSONL-backed knowledge graphs represent an underappreciated sweet spot in the agent memory design space. For single-agent session workloads—the dominant pattern in current AI agent architectures—JSONL provides the expressiveness of a knowledge graph with the operational simplicity of a log file. By embracing append-only semantics as a feature rather than a limitation, and by leveraging in-memory indexing for query performance, CoAiA.js demonstrates that lightweight storage can be adequate without being simplistic.
|
|
130
|
-
|
|
131
|
-
## References
|
|
132
|
-
|
|
133
|
-
1. Graphlit Blog. (2024). "Survey of AI Agent Memory Frameworks." https://www.graphlit.com/blog/survey-of-ai-agent-memory-frameworks
|
|
134
|
-
2. Neo4j Labs. (2025). "Agent Memory: A Graph-Native Memory System for AI." https://github.com/neo4j-labs/agent-memory
|
|
135
|
-
3. Vela Partners. (2025). "KuzuDB for Production AI Agents." https://www.vela.partners/blog/kuzudb-ai-agent-memory-graph-database
|
|
136
|
-
4. NDJSON Specification. https://github.com/ndjson/ndjson-spec
|
|
137
|
-
5. Enterprise Knowledge. (2024). "Cutting Through the Noise: An Introduction to RDF & LPG Graphs." https://enterprise-knowledge.com/cutting-through-the-noise-an-introduction-to-rdf-lpg-graphs/
|
|
138
|
-
6. Neo4j. (2024). "RDF Triple Stores vs. Property Graphs." https://neo4j.com/blog/knowledge-graph/rdf-vs-property-graphs-knowledge-graphs/
|
|
139
|
-
7. FuturesSmart AI. (2024). "Building AI Knowledge Graph Using Graphiti and Neo4j." https://blog.futuresmart.ai/building-ai-knowledge-graph-using-graphiti-and-neo4j
|
|
140
|
-
8. Memento MCP. (2024). "A Knowledge Graph Memory System for LLMs." https://github.com/gannonh/memento-mcp
|
|
141
|
-
9. Ontotext. (2024). "Choosing A Graph Data Model to Best Serve Your Use Case." https://www.ontotext.com/blog/choosing-a-graph-data-model-to-best-serve-your-use-case/
|
|
142
|
-
10. SAP Community. (2025). "Choosing Between Knowledge Graphs and Property Graphs in SAP HANA Cloud." https://community.sap.com/t5/technology-blog-posts-by-sap/choosing-between-knowledge-graphs-and-property-graphs-in-sap-hana-cloud-and/ba-p/14074575
|