coaiajs 0.4.3 → 0.5.1
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 +24 -5
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +13 -1
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/server.js +11 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/src/cli.js +62 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/narrative/argument-hygiene.d.ts +46 -0
- package/dist/src/narrative/argument-hygiene.d.ts.map +1 -0
- package/dist/src/narrative/argument-hygiene.js +155 -0
- package/dist/src/narrative/argument-hygiene.js.map +1 -0
- package/dist/src/narrative/contract.d.ts +200 -0
- package/dist/src/narrative/contract.d.ts.map +1 -0
- package/dist/src/narrative/contract.js +274 -0
- package/dist/src/narrative/contract.js.map +1 -0
- package/dist/src/narrative/github-bridge.d.ts +23 -0
- package/dist/src/narrative/github-bridge.d.ts.map +1 -0
- package/dist/src/narrative/github-bridge.js +320 -0
- package/dist/src/narrative/github-bridge.js.map +1 -0
- package/dist/src/narrative/graph-manager.d.ts +83 -2
- package/dist/src/narrative/graph-manager.d.ts.map +1 -1
- package/dist/src/narrative/graph-manager.js +444 -54
- package/dist/src/narrative/graph-manager.js.map +1 -1
- package/dist/src/narrative/index.d.ts +24 -3
- package/dist/src/narrative/index.d.ts.map +1 -1
- package/dist/src/narrative/index.js +36 -15
- package/dist/src/narrative/index.js.map +1 -1
- package/dist/src/narrative/jsonl-preservation.d.ts +26 -0
- package/dist/src/narrative/jsonl-preservation.d.ts.map +1 -0
- package/dist/src/narrative/jsonl-preservation.js +293 -0
- package/dist/src/narrative/jsonl-preservation.js.map +1 -0
- package/dist/src/narrative/jsonl-records.d.ts +31 -0
- package/dist/src/narrative/jsonl-records.d.ts.map +1 -0
- package/dist/src/narrative/jsonl-records.js +69 -0
- package/dist/src/narrative/jsonl-records.js.map +1 -0
- package/dist/src/narrative/tool-definitions.d.ts +2 -1
- package/dist/src/narrative/tool-definitions.d.ts.map +1 -1
- package/dist/src/narrative/tool-definitions.js +134 -1
- package/dist/src/narrative/tool-definitions.js.map +1 -1
- package/dist/src/narrative/tool-handlers.d.ts.map +1 -1
- package/dist/src/narrative/tool-handlers.js +203 -20
- package/dist/src/narrative/tool-handlers.js.map +1 -1
- package/dist/src/narrative/types.d.ts +1 -1
- package/dist/src/narrative/types.d.ts.map +1 -1
- package/dist/src/narrative/validation.d.ts +13 -2
- package/dist/src/narrative/validation.d.ts.map +1 -1
- package/dist/src/narrative/validation.js +19 -4
- package/dist/src/narrative/validation.js.map +1 -1
- package/dist/src/skill.d.ts +78 -0
- package/dist/src/skill.d.ts.map +1 -0
- package/dist/src/skill.js +341 -0
- package/dist/src/skill.js.map +1 -0
- package/dist/src/types.d.ts +189 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/version.d.ts +9 -0
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +30 -14
- package/dist/src/version.js.map +1 -1
- package/docs/LINEAGE-COAIA-NARRATIVE.md +150 -0
- package/llms-full.txt +93 -8
- package/llms.txt +6 -3
- package/package.json +11 -1
- package/skills/coaiajs/SKILL.md +151 -0
- package/skills/coaiajs/references/beyond-narrative.md +82 -0
- package/skills/coaiajs/references/creative-orientation.md +42 -0
- package/skills/coaiajs/references/delayed-resolution.md +48 -0
- package/skills/coaiajs/references/install-and-environment.md +85 -0
- package/skills/coaiajs/references/mcp-tools.md +83 -0
- package/skills/coaiajs/references/narrative-beats.md +44 -0
- package/skills/coaiajs/references/reading-the-store.md +66 -0
- package/skills/coaiajs/references/structural-tension-charting.md +71 -0
- package/skills/coaiajs/references/wampum-belts.md +72 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coaiajs
|
|
3
|
+
description: Use coaiajs to create and manage Structural Tension Charts, narrative beats, Wampum Belts, MMOT evaluations, PDE decompositions, action plans, and Langfuse-traced pipelines over a JSONL knowledge graph.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires the coaiajs package. CLI: coaia. MCP server: coaiajs-mcp.
|
|
6
|
+
metadata:
|
|
7
|
+
author: Guillaume D. Isabelle
|
|
8
|
+
package: coaiajs
|
|
9
|
+
packageVersion: "{{VERSION}}"
|
|
10
|
+
allowed-tools: Bash(coaia:*), Bash(coaiajs-mcp:*)
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# coaiajs
|
|
14
|
+
|
|
15
|
+
`coaiajs` is the structural tension surface of the COAIA family, consolidated into one
|
|
16
|
+
installable unit: a library, a CLI (`coaia`), and an MCP server (`coaiajs-mcp`). Use it when
|
|
17
|
+
an assistant should help create outcomes, hold current reality clearly, track strategic
|
|
18
|
+
secondary choices, archive significant learning, and keep that work traced.
|
|
19
|
+
|
|
20
|
+
The chart and knowledge-graph surface below is {{NARRATIVE_TOOL_COUNT}} tools. The same
|
|
21
|
+
server also serves Langfuse, PDE, and planning tools — see `references/beyond-narrative.md`.
|
|
22
|
+
|
|
23
|
+
Its core data model is the structural tension chart — desired outcome, current reality,
|
|
24
|
+
telescoping action steps — backed by a JSONL knowledge graph.
|
|
25
|
+
|
|
26
|
+
## Status
|
|
27
|
+
|
|
28
|
+
!`coaia --version 2>/dev/null || echo "Not installed: npm install -g coaiajs"`
|
|
29
|
+
|
|
30
|
+
## First Principles
|
|
31
|
+
|
|
32
|
+
- Work from creative orientation: ask what result the user wants to create, not what
|
|
33
|
+
problem should disappear.
|
|
34
|
+
- Hold desired outcome and current reality at the same time. Do not collapse the tension
|
|
35
|
+
with "ready to begin" defaults.
|
|
36
|
+
- Treat action steps as strategic secondary choices. They are not a to-do list.
|
|
37
|
+
- Every action step is also a telescoped chart with its own desired outcome and current
|
|
38
|
+
reality.
|
|
39
|
+
- Use narrative beats for significant learning moments, not routine task tracking.
|
|
40
|
+
- Use a Wampum Belt when the sequence is not linear and position carries meaning.
|
|
41
|
+
|
|
42
|
+
## MCP Setup
|
|
43
|
+
|
|
44
|
+
Use the MCP server when the assistant needs write access to chart memory:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"coaiajs": {
|
|
50
|
+
"command": "npx",
|
|
51
|
+
"args": ["-y", "coaiajs", "coaiajs-mcp", "--memory-path", "/absolute/path/to/memory.jsonl"],
|
|
52
|
+
"env": {
|
|
53
|
+
"COAIAJS_FEATURES": "STANDARD"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`--memory-path` must be a real, expanded path. A path still carrying `${VAR}` is refused
|
|
61
|
+
at startup rather than opened — see `references/install-and-environment.md` for why that
|
|
62
|
+
refusal is the kind answer.
|
|
63
|
+
|
|
64
|
+
When a new session connects, call `init_llm_guidance` first: `format: "full"` for first
|
|
65
|
+
use, `format: "quick"` for a refresh.
|
|
66
|
+
|
|
67
|
+
## CLI Inspection Flow
|
|
68
|
+
|
|
69
|
+
The CLI is for quick inspection, exports, and local chart context:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
coaia narrative list -M ./memory.jsonl
|
|
73
|
+
coaia narrative view <chartId> -M ./memory.jsonl
|
|
74
|
+
coaia narrative stats -M ./memory.jsonl
|
|
75
|
+
coaia narrative export <chartId> --output chart.md -M ./memory.jsonl
|
|
76
|
+
coaia narrative link-issue <chartId> owner/repo#123 -M ./memory.jsonl
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Core Workflow
|
|
80
|
+
|
|
81
|
+
1. Read chart state before writing anything:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
list_active_charts
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. Create a chart only when there is a new primary desired outcome:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"tool": "create_structural_tension_chart",
|
|
92
|
+
"arguments": {
|
|
93
|
+
"desiredOutcome": "A release process that runs the same way every time",
|
|
94
|
+
"currentReality": "Build and publish steps are manual and easy to miss",
|
|
95
|
+
"dueDate": "2027-06-01T00:00:00.000Z",
|
|
96
|
+
"actionSteps": ["Document release checks", "Verify npm package contents"],
|
|
97
|
+
"githubIssue": "jgwill/coaiajs#13"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`githubIssue` is optional and takes the FULL `owner/repo#number` path. A bare `#number`
|
|
103
|
+
is refused: charts travel between repositories, and a bare number cites the wrong project
|
|
104
|
+
as soon as the chart is read somewhere else.
|
|
105
|
+
|
|
106
|
+
3. Add or expand action steps with `manage_action_step`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"tool": "manage_action_step",
|
|
111
|
+
"arguments": {
|
|
112
|
+
"parentReference": "chart_123",
|
|
113
|
+
"actionDescription": "Verify npm package contents",
|
|
114
|
+
"currentReality": "No package dry-run has been inspected for this release"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
4. Track advancement without pretending completion:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
update_action_progress
|
|
123
|
+
update_current_reality
|
|
124
|
+
mark_action_complete
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
5. Move a date with `update_chart_due_date` rather than editing the JSONL by hand. Several
|
|
128
|
+
MCP instances can point at one store with no lock, which is how a hand-edit becomes a
|
|
129
|
+
lost write.
|
|
130
|
+
|
|
131
|
+
6. Use `perform_mmot_evaluation` when output and expected performance diverge, or when a
|
|
132
|
+
chart needs a truth-based review.
|
|
133
|
+
|
|
134
|
+
7. Create a narrative beat when the work produced a significant learning moment across
|
|
135
|
+
engineer-world, ceremony-world, and story-engine-world.
|
|
136
|
+
|
|
137
|
+
## Tool Map
|
|
138
|
+
|
|
139
|
+
{{TOOL_MAP}}
|
|
140
|
+
|
|
141
|
+
## References
|
|
142
|
+
|
|
143
|
+
- `references/creative-orientation.md` — the creation-vs-problem-solving distinction
|
|
144
|
+
- `references/structural-tension-charting.md` — chart and action-step rules
|
|
145
|
+
- `references/delayed-resolution.md` — current reality discipline
|
|
146
|
+
- `references/narrative-beats.md` — story archive usage
|
|
147
|
+
- `references/wampum-belts.md` — non-linear mnemonic sequencing
|
|
148
|
+
- `references/reading-the-store.md` — reading a chart store without re-deriving its shape
|
|
149
|
+
- `references/beyond-narrative.md` — PDE, planning, Langfuse, pipeline
|
|
150
|
+
- `references/mcp-tools.md` — feature levels and environment variables
|
|
151
|
+
- `references/install-and-environment.md` — install, run, and the refusals worth knowing
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Beyond Narrative
|
|
2
|
+
|
|
3
|
+
`coaiajs` consolidates four CoAIA sub-projects. The chart engine is the centre, but three
|
|
4
|
+
other surfaces feed it and one observes it.
|
|
5
|
+
|
|
6
|
+
## PDE — Prompt Decomposition Engine
|
|
7
|
+
|
|
8
|
+
Decomposes a complex prompt into an intent map — primary intent, secondary intents,
|
|
9
|
+
context requirements, expected outputs, and the four directions — then turns that map into
|
|
10
|
+
a chart.
|
|
11
|
+
|
|
12
|
+
| Tool | Use |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `import_pde_decomposition` | Bring a decomposition JSON into the session store |
|
|
15
|
+
| `create_stc_from_pde` | Turn a decomposition into a structural tension chart |
|
|
16
|
+
| `list_pde_decompositions` | See what has been imported |
|
|
17
|
+
| `get_session`, `list_sessions`, `complete_session` | Session lifecycle |
|
|
18
|
+
| `pde_update_action_progress`, `pde_mark_action_complete`, `pde_add_action_step`, `pde_update_current_reality` | The chart verbs, targeting the PDE session |
|
|
19
|
+
|
|
20
|
+
The last four carry a `pde_` prefix because their unprefixed names belong to the narrative
|
|
21
|
+
group. Calling `add_action_step` targets the narrative chart; `pde_add_action_step`
|
|
22
|
+
targets the PDE session. Getting this wrong writes to the wrong store and reports success.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
coaia pde --help
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Planning
|
|
29
|
+
|
|
30
|
+
Parses a structured plan file into structural tension form and keeps it in sync with a
|
|
31
|
+
chart store, in both directions.
|
|
32
|
+
|
|
33
|
+
| Tool | Use |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `parse_plan_structural` | Read a plan file into chart shape |
|
|
36
|
+
| `plan_to_stc` | Create charts from a plan |
|
|
37
|
+
| `sync_plan_to_chart` | Plan is authoritative |
|
|
38
|
+
| `sync_chart_to_plan` | Chart is authoritative |
|
|
39
|
+
| `create_plan_trace` | Emit a Langfuse trace for the plan |
|
|
40
|
+
| `pde_to_plan` | Turn a decomposition into a plan |
|
|
41
|
+
|
|
42
|
+
Choose the sync direction deliberately. Both write.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
coaia plan --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Langfuse
|
|
49
|
+
|
|
50
|
+
Traces, observations, scores, prompts, datasets, comments, and media, over the Langfuse
|
|
51
|
+
REST API. Use it to make the chart work observable rather than to store it — the JSONL
|
|
52
|
+
store remains the record.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
coaia fuse traces list
|
|
56
|
+
coaia fuse trace view <traceId>
|
|
57
|
+
coaia fuse prompts get <name>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `coaia_fuse_*` MCP tools mirror these. Media tools are `FULL`-level only.
|
|
61
|
+
|
|
62
|
+
## Pipeline
|
|
63
|
+
|
|
64
|
+
A Jinja2-style template engine for prompt pipelines, exposed as the `coaia://templates/`
|
|
65
|
+
MCP resources and the `coaia pipeline` commands.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
coaia pipeline list
|
|
69
|
+
coaia pipeline run <name>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Redis shorthand
|
|
73
|
+
|
|
74
|
+
`tash` / `fetch` are the COAIA SET/GET shorthand, used for stashing plan perspectives and
|
|
75
|
+
intermediate content:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
coaia tash mykey "value"
|
|
79
|
+
coaia fetch mykey
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Prefer the CLI over the MCP tool for these — it is the more reliable path.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Creative Orientation
|
|
2
|
+
|
|
3
|
+
Creative orientation focuses on bringing desired results into being. Reactive orientation
|
|
4
|
+
focuses on removing unwanted conditions. `coaiajs` biases toward creation.
|
|
5
|
+
|
|
6
|
+
Ask: "What do you want to create?" Then define current reality in relation to that
|
|
7
|
+
desired outcome.
|
|
8
|
+
|
|
9
|
+
Structural tension is not a gap to bridge. It is the active disequilibrium created by
|
|
10
|
+
holding desired outcome and current reality clearly at the same time.
|
|
11
|
+
|
|
12
|
+
Use this language:
|
|
13
|
+
|
|
14
|
+
| Avoid | Prefer |
|
|
15
|
+
|---|---|
|
|
16
|
+
| bridge the gap | resolve the tension |
|
|
17
|
+
| close the gap | advance toward the desired outcome |
|
|
18
|
+
| tasks to fix the problem | strategic secondary choices |
|
|
19
|
+
| ready to begin | factual current reality |
|
|
20
|
+
|
|
21
|
+
A useful chart advances toward a created result. It does not merely remove a discomfort.
|
|
22
|
+
|
|
23
|
+
## The guard, and what it does not do
|
|
24
|
+
|
|
25
|
+
`create_structural_tension_chart` refuses a desired outcome containing `fix`, `solve`,
|
|
26
|
+
`eliminate`, `prevent`, `stop`, `avoid`, `reduce`, or `remove`, and answers with the
|
|
27
|
+
teaching above.
|
|
28
|
+
|
|
29
|
+
It matches on **word boundaries**, not substrings. This matters: an earlier version used
|
|
30
|
+
`.includes()` and so read the letters of those words inside longer ones. Two measured
|
|
31
|
+
refusals, on outcomes already written in creative orientation:
|
|
32
|
+
|
|
33
|
+
- "a fixed ladder of named rungs" — refused for `fix`
|
|
34
|
+
- "carry one to completion or resolve it" — refused for `solve`
|
|
35
|
+
|
|
36
|
+
Both authors rephrased around the error without asking why, which is the quiet cost: a
|
|
37
|
+
guard that fires on innocent text teaches the caller to edit for the checker rather than
|
|
38
|
+
for the reader. Sharper still, the second example is the phrasing the COAIA guidance
|
|
39
|
+
itself prescribes.
|
|
40
|
+
|
|
41
|
+
The word list is unchanged. An outcome that genuinely says "eliminate" or "reduce" should
|
|
42
|
+
still be met with the teaching. Only the matching was corrected.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Delayed Resolution
|
|
2
|
+
|
|
3
|
+
Tolerate discrepancy and delayed resolution. Do not smooth over the contradiction between
|
|
4
|
+
desired outcome and current reality.
|
|
5
|
+
|
|
6
|
+
When information is missing, ask for current reality or name the missing reality
|
|
7
|
+
explicitly. Do not invent readiness.
|
|
8
|
+
|
|
9
|
+
`create_structural_tension_chart` refuses a current reality containing "ready to",
|
|
10
|
+
"prepared to", "all set", "ready for", or "set to", and answers with the principle. That
|
|
11
|
+
refusal exists because a readiness assumption prematurely resolves the tension the chart
|
|
12
|
+
was created to hold.
|
|
13
|
+
|
|
14
|
+
## MMOT — the Managerial Moment of Truth
|
|
15
|
+
|
|
16
|
+
Run `perform_mmot_evaluation` when output and expected performance diverge. Four phases,
|
|
17
|
+
in order:
|
|
18
|
+
|
|
19
|
+
1. **Acknowledge** the difference between expected and delivered.
|
|
20
|
+
2. **Analyze** how it came to pass.
|
|
21
|
+
3. **Update** the chart and current reality.
|
|
22
|
+
4. **Recommit** or redirect based on what is now true.
|
|
23
|
+
|
|
24
|
+
Call with `phase` set to one of those, or omit it for `full`.
|
|
25
|
+
|
|
26
|
+
## What `updateReality` governs
|
|
27
|
+
|
|
28
|
+
`updateReality` controls **one** record: the append into current reality. The chart's own
|
|
29
|
+
`metadata.mmotEvaluations[]` trail is a separate record and is written whenever an
|
|
30
|
+
assessment was made.
|
|
31
|
+
|
|
32
|
+
An earlier version gated both on that one flag, so a caller who only asked to leave
|
|
33
|
+
current reality alone lost the evaluation entirely — while still being handed a full
|
|
34
|
+
phase response that read like a success. The response line now names which records were
|
|
35
|
+
actually written:
|
|
36
|
+
|
|
37
|
+
- `✅ Evaluation stored: chart MMOT trail + current reality.`
|
|
38
|
+
- `✅ Evaluation stored: chart MMOT trail (current reality left untouched, as requested).`
|
|
39
|
+
|
|
40
|
+
Read that line. A success line that names the wrong record is the same failure class as a
|
|
41
|
+
success line over zero bytes.
|
|
42
|
+
|
|
43
|
+
## Elements of Performance
|
|
44
|
+
|
|
45
|
+
Pass `elementsOfPerformance` when creating a chart to define what the MMOT will evaluate
|
|
46
|
+
against. Each is `{ description, type }` where `type` is `DESIGN` (structural intent,
|
|
47
|
+
architecture) or `EXECUTION` (delivery, implementation quality). Without them, MMOT still
|
|
48
|
+
runs, but it has nothing concrete to compare the work to.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Install And Environment
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g coaiajs
|
|
7
|
+
coaia --version
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## The skill
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
coaia skill show # print the packaged SKILL.md
|
|
14
|
+
coaia skill install # write ./.agents/skills/coaiajs
|
|
15
|
+
coaia skill install --global # write ~/.agents/skills/coaiajs
|
|
16
|
+
coaia skill install --yes # also create the .claude/skills/coaiajs symlink
|
|
17
|
+
coaia skill install --force # replace an existing install
|
|
18
|
+
coaia skill check # is the installed skill current?
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`coaia skill check` compares an installed skill against the packaged one and reports
|
|
22
|
+
`current`, `stale`, or `missing`. Run it after upgrading `coaiajs`: a skill installed by an
|
|
23
|
+
older version describes an older tool surface, and nothing else will tell you.
|
|
24
|
+
|
|
25
|
+
The tool map inside `SKILL.md` is generated from the server's own tool definitions at
|
|
26
|
+
install time, so an installed skill cannot advertise a tool this package does not serve.
|
|
27
|
+
The version it was generated from is recorded in the frontmatter as `packageVersion`.
|
|
28
|
+
|
|
29
|
+
## Run the MCP server
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
coaiajs-mcp --memory-path ./memory.jsonl
|
|
33
|
+
COAIAJS_FEATURES=FULL coaiajs-mcp --memory-path ./memory.jsonl
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Inspect from the CLI
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
coaia narrative list -M ./memory.jsonl
|
|
40
|
+
coaia narrative view <chartId> -M ./memory.jsonl
|
|
41
|
+
coaia narrative stats -M ./memory.jsonl
|
|
42
|
+
coaia narrative progress <chartId> -M ./memory.jsonl
|
|
43
|
+
coaia narrative export <chartId> --output chart.md -M ./memory.jsonl
|
|
44
|
+
coaia narrative set-date <chartId> 2027-06-01T00:00:00Z --redistribute -M ./memory.jsonl
|
|
45
|
+
coaia narrative link-issue <chartId> owner/repo#123 -M ./memory.jsonl
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Refusals worth knowing about
|
|
49
|
+
|
|
50
|
+
### A memory path carrying an unexpanded shell variable
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Refusing to open memory store: the path contains an unexpanded shell variable.
|
|
54
|
+
got: ${MIADI_CHART_MEMORY_PATH}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A seat once booted with that variable unset, so its `.mcp.json` handed the process the
|
|
58
|
+
placeholder verbatim. The server started happily and wrote live charts into a file
|
|
59
|
+
literally named `${MIADI_CHART_MEMORY_PATH}`. Nothing failed — the charts were simply
|
|
60
|
+
somewhere nobody would look, and another seat auditing the boot found them.
|
|
61
|
+
|
|
62
|
+
The sibling failure is worse and is why this is fatal rather than a warning: had the
|
|
63
|
+
variable been set to a path that does not exist, the server would have started **clean and
|
|
64
|
+
empty**, and the seat would have reported its whole store lost. A store is the one input
|
|
65
|
+
where "start anyway" is never the kind answer.
|
|
66
|
+
|
|
67
|
+
`$` is legal in a filename, so a path containing `$` alone is fine. Only `${` is refused —
|
|
68
|
+
a caller writing that is quoting a shell it expected to have run.
|
|
69
|
+
|
|
70
|
+
### A bare GitHub issue number
|
|
71
|
+
|
|
72
|
+
`githubIssue` and `link_chart_to_github_issue` require the full `owner/repo#number` path.
|
|
73
|
+
A bare `#42` resolves against whichever repository the reader happens to be in, which is
|
|
74
|
+
how an issue from one project ends up cited as another project's.
|
|
75
|
+
|
|
76
|
+
### A malformed tool call
|
|
77
|
+
|
|
78
|
+
See `mcp-tools.md`. Nothing is written and the offending fragment is quoted back.
|
|
79
|
+
|
|
80
|
+
## What this package does not lock
|
|
81
|
+
|
|
82
|
+
Writes are atomic — temp file, then rename — so a reader never sees a torn store. That
|
|
83
|
+
removes torn **reads**; it does not provide compare-and-swap. Two processes that both
|
|
84
|
+
load, then both write, still lose the earlier update, and both report success. If several
|
|
85
|
+
MCP instances point at one store, keep their write windows apart.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# MCP Tools And Environment
|
|
2
|
+
|
|
3
|
+
The MCP server is `coaiajs-mcp`. It speaks stdio and serves tools, prompts, and resources.
|
|
4
|
+
|
|
5
|
+
## Feature levels
|
|
6
|
+
|
|
7
|
+
`COAIAJS_FEATURES` selects the tool set. Default is `STANDARD`.
|
|
8
|
+
|
|
9
|
+
| Level | Serves |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `MINIMAL` | Redis shorthand and the core Langfuse read/write tools |
|
|
12
|
+
| `STANDARD` | Default — everything except the media tools |
|
|
13
|
+
| `OBSERVABILITY` | Langfuse-focused |
|
|
14
|
+
| `FULL` | Everything, including media upload/get |
|
|
15
|
+
|
|
16
|
+
Pass `--features <LEVEL>` on the command line to override the environment.
|
|
17
|
+
|
|
18
|
+
## Tool groups (library-side)
|
|
19
|
+
|
|
20
|
+
`coaiajs/narrative` exports these name lists so a caller can gate its own surface:
|
|
21
|
+
|
|
22
|
+
| Group | Contents |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `CORE_TOOLS` | The minimal list / create / add / complete workflow |
|
|
25
|
+
| `STC_TOOLS` | Chart creation, action steps, progress, reality, outcome, due date, GitHub link, MMOT |
|
|
26
|
+
| `NARRATIVE_TOOLS` | Narrative beat creation, telescoping, listing |
|
|
27
|
+
| `WAMPUM_TOOLS` | Belt creation, bead placement, belt reading |
|
|
28
|
+
| `KG_TOOLS` | Lower-level knowledge graph entities and relations |
|
|
29
|
+
|
|
30
|
+
Prefer STC tools for chart work. Use KG tools only when deliberately managing generic
|
|
31
|
+
entities and relations — they bypass the chart-shaped validation.
|
|
32
|
+
|
|
33
|
+
## Environment variables
|
|
34
|
+
|
|
35
|
+
| Variable | Purpose |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `COAIAJS_FEATURES` | Feature level: `MINIMAL` / `STANDARD` / `OBSERVABILITY` / `FULL` |
|
|
38
|
+
| `COAIAJS_MEMORY_PATH` | Default JSONL store path for CLI and MCP server |
|
|
39
|
+
| `COAIA_CURRENT_CHART_ID` | Chart the CLI treats as current (`coaia narrative current`) |
|
|
40
|
+
| `REDIS_URL` / `REDIS_HOST` etc. | Redis endpoint for `tash` / `fetch` |
|
|
41
|
+
| `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, `LANGFUSE_HOST` | Langfuse credentials |
|
|
42
|
+
| `OPENAI_API_KEY` | LLM and transcription calls |
|
|
43
|
+
|
|
44
|
+
Config resolution order is: environment variables, then `.env`, then `coaia.json`.
|
|
45
|
+
|
|
46
|
+
## Arguments this server will tell you about
|
|
47
|
+
|
|
48
|
+
Two behaviours worth relying on:
|
|
49
|
+
|
|
50
|
+
**Unknown arguments are named, not swallowed.** A tool call carrying a key the schema does
|
|
51
|
+
not know still succeeds, but the result appends:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
⚠️ Ignored unrecognised argument(s): dueDte. They were NOT applied — check the tool's inputSchema for the accepted names.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A dropped argument is otherwise invisible from the caller's side — the call succeeds, the
|
|
58
|
+
record is written, and the ignored part looks exactly like an honoured one.
|
|
59
|
+
|
|
60
|
+
**Every validation problem is reported at once.** Two missing required fields come back in
|
|
61
|
+
one message rather than costing a round trip each.
|
|
62
|
+
|
|
63
|
+
**`telescope_action_step` accepts `actionSteps`** as an alias for `initialActionSteps`,
|
|
64
|
+
because its sibling `create_structural_tension_chart` names the same concept `actionSteps`
|
|
65
|
+
and callers reach for that name.
|
|
66
|
+
|
|
67
|
+
## Refusals
|
|
68
|
+
|
|
69
|
+
A call whose argument tags did not parse arrives with its own raw text inside a value.
|
|
70
|
+
That is refused at the write boundary, with the fragment quoted and nothing written:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Malformed call refused — nothing was written.
|
|
74
|
+
|
|
75
|
+
`currentReality` carries unparsed call syntax, not prose:
|
|
76
|
+
</currentReality>
|
|
77
|
+
That is a closing tag for the 'currentReality' argument.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The refusal exists because that text used to persist verbatim: a live store was found
|
|
81
|
+
carrying seven observations ending in `</currentReality>` followed by a parameter block,
|
|
82
|
+
rendered as prose by every consumer since. A read-side filter arrives too late — anything
|
|
83
|
+
that reaches the JSONL is already in every reader's render.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Narrative Beats
|
|
2
|
+
|
|
3
|
+
Narrative beats document significant learning moments. They are not replacements for
|
|
4
|
+
charts or action steps, and they are not routine task tracking.
|
|
5
|
+
|
|
6
|
+
Create a beat when a moment matters across multiple perspectives:
|
|
7
|
+
|
|
8
|
+
- **engineer-world** — technical structure and consequences
|
|
9
|
+
- **ceremony-world** — relational protocol and accountability
|
|
10
|
+
- **story-engine-world** — narrative progression and meaning
|
|
11
|
+
|
|
12
|
+
A useful beat carries title, act, dramatic type, universes, description, prose, and
|
|
13
|
+
lessons. Use beats after a real transition, discovery, crisis, MMOT, or integration
|
|
14
|
+
moment.
|
|
15
|
+
|
|
16
|
+
## Tools
|
|
17
|
+
|
|
18
|
+
| Tool | Use |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `create_narrative_beat` | Archive a significant multi-universe learning moment |
|
|
21
|
+
| `telescope_narrative_beat` | Break a beat into sub-beats with their own current reality |
|
|
22
|
+
| `list_narrative_beats` | Review the archive, optionally filtered by parent chart |
|
|
23
|
+
|
|
24
|
+
## Beat-level session context
|
|
25
|
+
|
|
26
|
+
`metadata.sessionContext` records the embodied condition of the session a beat came from:
|
|
27
|
+
`mode` (voice / terminal / mixed), `setting` (desk / walking / land-based / transit),
|
|
28
|
+
`landBasedLearning`, `environmentNotes`, `captureQuality`, and whether a public summary is
|
|
29
|
+
allowed. Use it when the conditions of the work are part of what the beat means.
|
|
30
|
+
|
|
31
|
+
`metadata.sessionLineage` records conversation branching — parent chart, source beat,
|
|
32
|
+
original and branch session ids, branch purpose, and handoff state — so a branch map can
|
|
33
|
+
be reconstructed later.
|
|
34
|
+
|
|
35
|
+
## The legacy on-disk dialect
|
|
36
|
+
|
|
37
|
+
Some live stores hold beats written with a top-level `type: "narrative_beat"` rather than
|
|
38
|
+
`type: "entity"` with `entityType: "narrative_beat"`. Both are read, both round-trip as
|
|
39
|
+
themselves, and a writer never flattens one into the other.
|
|
40
|
+
|
|
41
|
+
This matters to anyone reading the store directly: a reader that does not know the legacy
|
|
42
|
+
dialect renders **fewer beats than exist** and may report the difference as corruption.
|
|
43
|
+
Use `coaiajs/narrative/contract` rather than classifying records by hand — see
|
|
44
|
+
`reading-the-store.md`.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Reading the Store
|
|
2
|
+
|
|
3
|
+
`coaiajs` owns the writes. Anything that renders a chart store — a dashboard, a report, a
|
|
4
|
+
Twine promotion, another agent — needs the store's shape, and re-deriving that shape by
|
|
5
|
+
hand is where readers quietly go wrong.
|
|
6
|
+
|
|
7
|
+
It is not a style problem. When a hand-rolled reader drifts from the writer, it does not
|
|
8
|
+
break: it renders **less**. A chart holding real work looks identical to an empty one.
|
|
9
|
+
|
|
10
|
+
## Use the contract
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { parseStore, getWork, getChartEntity } from 'coaiajs/narrative/contract';
|
|
14
|
+
import { readFile } from 'node:fs/promises';
|
|
15
|
+
|
|
16
|
+
const store = parseStore(await readFile('./memory.jsonl', 'utf8'));
|
|
17
|
+
const chart = getChartEntity(store, 'chart_1757200000000');
|
|
18
|
+
const work = getWork(store, 'chart_1757200000000');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The contract keeps three rules:
|
|
22
|
+
|
|
23
|
+
1. **Zero I/O.** No `fs`, no `process`, no network. The caller owns reading; this owns
|
|
24
|
+
shape.
|
|
25
|
+
2. **Never imports the server.** The package root is safe to import, but the contract
|
|
26
|
+
lives behind its own subpath so a renderer pulls nothing it does not need.
|
|
27
|
+
3. **Tolerant by construction, honest about what it skipped.** One unparseable line is
|
|
28
|
+
skipped and counted in `skipped`, where `parseJsonlMemory` — correctly, for a writer —
|
|
29
|
+
throws.
|
|
30
|
+
|
|
31
|
+
Classification is **not** defined in the contract. `jsonl-records.ts` holds the single
|
|
32
|
+
definition, and both the writer and the contract import it. The first draft of the
|
|
33
|
+
contract re-implemented classification by hand and a review measured it returning 73
|
|
34
|
+
entities where the writer returned 76: it dropped the legacy `type:"narrative_beat"`
|
|
35
|
+
dialect and reported the losses as corruption. Duplication relocated rather than removed.
|
|
36
|
+
|
|
37
|
+
## What it gives you
|
|
38
|
+
|
|
39
|
+
| Export | Use |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `parseStore(raw)` | `{ entities: Map, relations: [], skipped: number }` |
|
|
42
|
+
| `ENTITY_TYPES` | Every entity kind the writer writes |
|
|
43
|
+
| `MMOT_PHASES`, `CREATING_PHASES` | The vocabularies, including `full` |
|
|
44
|
+
| `chartEntityName`, `desiredOutcomeName`, `currentRealityName` | The naming scheme, once |
|
|
45
|
+
| `getChartEntity`, `getDesiredOutcome`, `getCurrentReality` | Chart parts by id |
|
|
46
|
+
| `getFlatActionSteps`, `getChildCharts`, `getWork` | The two shapes work takes, counted once |
|
|
47
|
+
| `getMmotBeats`, `getMmotEvaluations` | The MMOT trail |
|
|
48
|
+
| `storeRevision`, `revisionOf` | Cheap change detection between reads |
|
|
49
|
+
|
|
50
|
+
## What `skipped` cannot tell you
|
|
51
|
+
|
|
52
|
+
Writes are temp-file-plus-rename, so a reader should never see a torn file and
|
|
53
|
+
`skipped > 0` genuinely suggests a foreign or damaged line.
|
|
54
|
+
|
|
55
|
+
But a store truncated by something *other* than this package can still be a syntactically
|
|
56
|
+
perfect prefix: every whole line parses, and the result is simply a smaller store with
|
|
57
|
+
`skipped === 0`. No reader can detect that from content alone. If it matters, compare
|
|
58
|
+
entity counts across reads.
|
|
59
|
+
|
|
60
|
+
## Writing from outside
|
|
61
|
+
|
|
62
|
+
If you must write, go through `KnowledgeGraphManager` or
|
|
63
|
+
`readJsonlMemoryFile` / `writeJsonlMemoryFile`. They preserve fields this package does not
|
|
64
|
+
model — another consumer's metadata survives — and they write atomically. A bare
|
|
65
|
+
`writeFile` over the store truncates first, and a reader landing in that window gets a
|
|
66
|
+
valid partial store.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Structural Tension Charting
|
|
2
|
+
|
|
3
|
+
A chart has three core parts:
|
|
4
|
+
|
|
5
|
+
1. **Desired Outcome** — what the user wants to create.
|
|
6
|
+
2. **Current Reality** — the honest present state in relation to that outcome.
|
|
7
|
+
3. **Action Steps** — strategic secondary choices that support the primary choice.
|
|
8
|
+
|
|
9
|
+
Action steps are not independent checklist items. They must make sense together as an
|
|
10
|
+
overview strategy. Test them with: "If these steps were taken, would the desired outcome
|
|
11
|
+
likely be created?"
|
|
12
|
+
|
|
13
|
+
Each action step is a telescoped chart. Its title becomes the desired outcome of the child
|
|
14
|
+
chart, and it needs its own current reality. Never use "ready to begin" as that reality.
|
|
15
|
+
|
|
16
|
+
Good current reality examples:
|
|
17
|
+
|
|
18
|
+
- "No Django experience."
|
|
19
|
+
- "Package builds locally, publish dry-run not inspected."
|
|
20
|
+
- "Budget: $5000."
|
|
21
|
+
- "Completed models section, struggling with views."
|
|
22
|
+
|
|
23
|
+
Poor current reality examples:
|
|
24
|
+
|
|
25
|
+
- "Ready to begin."
|
|
26
|
+
- "Need to retrieve the notes."
|
|
27
|
+
- "Excited to start."
|
|
28
|
+
- "Prepared to tackle the action step."
|
|
29
|
+
|
|
30
|
+
## How a chart is laid out in the store
|
|
31
|
+
|
|
32
|
+
For a chart with id `chart_1757200000000`:
|
|
33
|
+
|
|
34
|
+
| Entity | `entityType` |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `chart_1757200000000_chart` | `structural_tension_chart` |
|
|
37
|
+
| `chart_1757200000000_desired_outcome` | `desired_outcome` |
|
|
38
|
+
| `chart_1757200000000_current_reality` | `current_reality` |
|
|
39
|
+
| `chart_1757200000000_action_1` … `_action_N` | `action_step` |
|
|
40
|
+
|
|
41
|
+
A telescoped child chart is a full chart of its own, carrying `metadata.parentChart` and,
|
|
42
|
+
when it grew out of a specific step, `metadata.parentActionStep`.
|
|
43
|
+
|
|
44
|
+
## The two shapes work takes
|
|
45
|
+
|
|
46
|
+
This is the single most common source of a wrong reading. A chart holds its work in **two**
|
|
47
|
+
shapes:
|
|
48
|
+
|
|
49
|
+
1. `action_step` entities that live on the chart itself.
|
|
50
|
+
2. Telescoped child charts, which is what `add_action_step` produces.
|
|
51
|
+
|
|
52
|
+
Counting or rendering only one of them under-reports. A chart built entirely with
|
|
53
|
+
`add_action_step` used to report `0/0` progress while holding real work, and a chart
|
|
54
|
+
holding eight of its own steps used to render as "(No action steps yet)".
|
|
55
|
+
|
|
56
|
+
A child telescoped out of one of the chart's own steps is that same result seen closer up.
|
|
57
|
+
It counts **once**, through the step — not twice.
|
|
58
|
+
|
|
59
|
+
`getChartProgress`, `listActiveCharts`, `updateChartDueDate`, and
|
|
60
|
+
`coaiajs/narrative/contract`'s `getWork()` all apply that rule. Prefer them over walking
|
|
61
|
+
the graph by hand.
|
|
62
|
+
|
|
63
|
+
## Moving a date
|
|
64
|
+
|
|
65
|
+
Use `update_chart_due_date`. It moves the chart and its desired outcome together, records
|
|
66
|
+
the move as an observation on the chart, and reports how many open steps still fall after
|
|
67
|
+
the new date. Pass `redistributeActionSteps: true` to spread those open steps evenly
|
|
68
|
+
between now and the new date.
|
|
69
|
+
|
|
70
|
+
Do not hand-edit the JSONL to change a date. Several MCP instances can point at one store
|
|
71
|
+
with no lock; a hand-edit races every one of them.
|