flowscript-core 1.0.0
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/LICENSE +21 -0
- package/README.md +386 -0
- package/bin/flowscript +12 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +463 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors/indentation-error.d.ts +11 -0
- package/dist/errors/indentation-error.d.ts.map +1 -0
- package/dist/errors/indentation-error.js +22 -0
- package/dist/errors/indentation-error.js.map +1 -0
- package/dist/grammar.ohm +132 -0
- package/dist/hash.d.ts +21 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +82 -0
- package/dist/hash.js.map +1 -0
- package/dist/indentation-scanner.d.ts +81 -0
- package/dist/indentation-scanner.d.ts.map +1 -0
- package/dist/indentation-scanner.js +290 -0
- package/dist/indentation-scanner.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/linter.d.ts +71 -0
- package/dist/linter.d.ts.map +1 -0
- package/dist/linter.js +122 -0
- package/dist/linter.js.map +1 -0
- package/dist/memory.d.ts +506 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +1802 -0
- package/dist/memory.js.map +1 -0
- package/dist/parser.d.ts +53 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +1184 -0
- package/dist/parser.js.map +1 -0
- package/dist/query-engine.d.ts +320 -0
- package/dist/query-engine.d.ts.map +1 -0
- package/dist/query-engine.js +884 -0
- package/dist/query-engine.js.map +1 -0
- package/dist/rules/alternatives-without-decision.d.ts +24 -0
- package/dist/rules/alternatives-without-decision.d.ts.map +1 -0
- package/dist/rules/alternatives-without-decision.js +58 -0
- package/dist/rules/alternatives-without-decision.js.map +1 -0
- package/dist/rules/causal-cycles.d.ts +23 -0
- package/dist/rules/causal-cycles.d.ts.map +1 -0
- package/dist/rules/causal-cycles.js +83 -0
- package/dist/rules/causal-cycles.js.map +1 -0
- package/dist/rules/deep-nesting.d.ts +23 -0
- package/dist/rules/deep-nesting.d.ts.map +1 -0
- package/dist/rules/deep-nesting.js +55 -0
- package/dist/rules/deep-nesting.js.map +1 -0
- package/dist/rules/index.d.ts +15 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +29 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/invalid-syntax.d.ts +22 -0
- package/dist/rules/invalid-syntax.d.ts.map +1 -0
- package/dist/rules/invalid-syntax.js +52 -0
- package/dist/rules/invalid-syntax.js.map +1 -0
- package/dist/rules/long-causal-chains.d.ts +25 -0
- package/dist/rules/long-causal-chains.d.ts.map +1 -0
- package/dist/rules/long-causal-chains.js +75 -0
- package/dist/rules/long-causal-chains.js.map +1 -0
- package/dist/rules/missing-recommended-fields.d.ts +21 -0
- package/dist/rules/missing-recommended-fields.d.ts.map +1 -0
- package/dist/rules/missing-recommended-fields.js +45 -0
- package/dist/rules/missing-recommended-fields.js.map +1 -0
- package/dist/rules/missing-required-fields.d.ts +22 -0
- package/dist/rules/missing-required-fields.d.ts.map +1 -0
- package/dist/rules/missing-required-fields.js +46 -0
- package/dist/rules/missing-required-fields.js.map +1 -0
- package/dist/rules/orphaned-nodes.d.ts +22 -0
- package/dist/rules/orphaned-nodes.d.ts.map +1 -0
- package/dist/rules/orphaned-nodes.js +76 -0
- package/dist/rules/orphaned-nodes.js.map +1 -0
- package/dist/rules/unlabeled-tension.d.ts +20 -0
- package/dist/rules/unlabeled-tension.d.ts.map +1 -0
- package/dist/rules/unlabeled-tension.js +37 -0
- package/dist/rules/unlabeled-tension.js.map +1 -0
- package/dist/serializer.d.ts +40 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +368 -0
- package/dist/serializer.js.map +1 -0
- package/dist/tokenizer.d.ts +26 -0
- package/dist/tokenizer.d.ts.map +1 -0
- package/dist/tokenizer.js +213 -0
- package/dist/tokenizer.js.map +1 -0
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +50 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +18 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +68 -0
- package/dist/validate.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Phillip Clapham
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# FlowScript
|
|
2
|
+
|
|
3
|
+
**Decision intelligence for AI agents.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/phillipclapham/flowscript) [](https://www.npmjs.com/package/flowscript-core) [](LICENSE) [](https://flowscript.org)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Problem
|
|
10
|
+
|
|
11
|
+
Your agent made a decision. Your PM asks "why?" You dig through chat logs and JSON blobs. Good luck.
|
|
12
|
+
|
|
13
|
+
Agent memory today is either opaque embeddings you can't inspect, expensive LLM self-editing you can't audit, or untyped state dicts with no structure. They store tokens. FlowScript stores *reasoning* — structured, typed, queryable in <1ms.
|
|
14
|
+
|
|
15
|
+
**Mem0, Zep, Letta, LangGraph — those solve retrieval. FlowScript solves reasoning.** They're not mutually exclusive. Use an embedding store for "find similar memories" and FlowScript for "why did we decide that?"
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install flowscript-core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Hello World
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { Memory } from 'flowscript-core';
|
|
31
|
+
|
|
32
|
+
const mem = new Memory();
|
|
33
|
+
|
|
34
|
+
const q = mem.question("Which database for agent memory?");
|
|
35
|
+
mem.alternative(q, "Redis").decide({ rationale: "speed critical for real-time agents" });
|
|
36
|
+
mem.alternative(q, "SQLite").block({ reason: "no concurrent write support" });
|
|
37
|
+
mem.tension(
|
|
38
|
+
mem.thought("Redis gives sub-ms reads"),
|
|
39
|
+
mem.thought("cluster costs $200/mo"),
|
|
40
|
+
"performance vs cost"
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
console.log(mem.query.blocked()); // structured blockers + downstream impact
|
|
44
|
+
console.log(mem.query.tensions()); // tradeoffs with named axes
|
|
45
|
+
mem.save("./memory.fs"); // human-readable, PM-reviewable
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Three lines of output, three things no other memory system gives you: typed blockers with impact chains, named-axis tensions, and a `.fs` file a human can actually read.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## The Complete Developer Loop
|
|
53
|
+
|
|
54
|
+
This is what v1.0 delivers. Persistent, evolving agent memory in 10 minutes.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { Memory } from 'flowscript-core';
|
|
58
|
+
|
|
59
|
+
// 1. Load or create persistent memory (zero-friction first run)
|
|
60
|
+
const mem = Memory.loadOrCreate('./agent-memory.json');
|
|
61
|
+
|
|
62
|
+
// 2. Wire to your agent framework (12 tools, OpenAI function calling format)
|
|
63
|
+
const tools = mem.asTools();
|
|
64
|
+
// → add_node, relate_nodes, set_state, remove_state,
|
|
65
|
+
// query_why, query_what_if, query_tensions, query_blocked, query_alternatives,
|
|
66
|
+
// get_memory, search_nodes, add_alternative
|
|
67
|
+
|
|
68
|
+
// 3. Your agent builds reasoning in real-time via tool calls
|
|
69
|
+
// (no FlowScript syntax knowledge needed — the tools handle it)
|
|
70
|
+
|
|
71
|
+
// 4. Inject memory into agent prompt (respects token budget)
|
|
72
|
+
const context = mem.toFlowScript({
|
|
73
|
+
maxTokens: 4000,
|
|
74
|
+
strategy: 'tier-priority' // proven+foundation always included
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// 5. End of session: housekeep + save
|
|
78
|
+
mem.prune(); // dormant nodes → .audit.jsonl (append-only, crash-safe)
|
|
79
|
+
mem.save(); // no-arg save to stored path
|
|
80
|
+
|
|
81
|
+
// 6. Next session: load → memory has evolved
|
|
82
|
+
// Growing nodes (recent), resting (few days), dormant (auto-prunable)
|
|
83
|
+
// Patterns graduate: current → developing → proven → foundation
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Three Ways In
|
|
89
|
+
|
|
90
|
+
**1. Agent tools** (zero learning curve — wire and go)
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const mem = Memory.loadOrCreate('./memory.json');
|
|
94
|
+
const tools = mem.asTools();
|
|
95
|
+
|
|
96
|
+
// Pass tools to any OpenAI-compatible agent framework.
|
|
97
|
+
// The agent builds structured reasoning via tool calls —
|
|
98
|
+
// no FlowScript syntax knowledge needed.
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**2. From agent transcripts** (extract reasoning from existing conversations)
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const mem = await Memory.fromTranscript(agentLog, {
|
|
105
|
+
extract: async (prompt) => await yourLLM(prompt) // any LLM
|
|
106
|
+
});
|
|
107
|
+
console.log(mem.query.tensions());
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Paste an existing agent conversation. The LLM extracts structured reasoning. You get queryable decision intelligence back. LLM-agnostic — bring your own model.
|
|
111
|
+
|
|
112
|
+
**3. Builder API** (programmatic construction)
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const mem = new Memory();
|
|
116
|
+
const t = mem.thought("caching improves latency");
|
|
117
|
+
t.causes(mem.thought("higher memory usage"));
|
|
118
|
+
mem.tension(
|
|
119
|
+
mem.thought("speed matters"),
|
|
120
|
+
mem.thought("cost constraints"),
|
|
121
|
+
"performance vs budget"
|
|
122
|
+
);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Fluent chaining, type-safe, auto-generates the reasoning graph.
|
|
126
|
+
|
|
127
|
+
**4. Parse `.fs` directly** (power users)
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const mem = Memory.parse(`
|
|
131
|
+
? which database for sessions
|
|
132
|
+
|| Redis <- speed critical
|
|
133
|
+
|| Postgres <- better durability
|
|
134
|
+
speed >< durability
|
|
135
|
+
`);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
21 markers, human-readable, works in any text editor. [Full syntax spec](FLOWSCRIPT_SYNTAX.md).
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Wire to Your Agent
|
|
143
|
+
|
|
144
|
+
`asTools()` returns 12 tools in OpenAI function calling format. Your agent gets structured reasoning as tool calls — no prompt engineering, no FlowScript syntax.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const tools = mem.asTools();
|
|
148
|
+
// Returns: MemoryTool[] — each has { type, function: { name, description, parameters }, handler }
|
|
149
|
+
|
|
150
|
+
// Filter by category:
|
|
151
|
+
const queryOnly = mem.asTools({ include: ['query'] });
|
|
152
|
+
|
|
153
|
+
// Namespace for multi-tool agents:
|
|
154
|
+
const prefixed = mem.asTools({ prefix: 'memory_' });
|
|
155
|
+
// → memory_add_node, memory_query_why, etc.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Core tools** (build the graph): `add_node`, `add_alternative`, `relate_nodes`, `set_state`, `remove_state`
|
|
159
|
+
|
|
160
|
+
**Query tools** (ask questions): `query_why`, `query_what_if`, `query_tensions`, `query_blocked`, `query_alternatives`
|
|
161
|
+
|
|
162
|
+
**Memory tools** (inspect + search): `get_memory`, `search_nodes`
|
|
163
|
+
|
|
164
|
+
Each tool handler returns typed `{ success: true, data }` or `{ success: false, error }`.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Token-Budgeted Serialization
|
|
169
|
+
|
|
170
|
+
Inject memory into agent prompts without blowing your context window.
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// Hard budget — never exceeds maxTokens
|
|
174
|
+
const context = mem.toFlowScript({ maxTokens: 4000 });
|
|
175
|
+
|
|
176
|
+
// Four strategies:
|
|
177
|
+
mem.toFlowScript({ maxTokens: 4000, strategy: 'tier-priority' }); // foundation first (default)
|
|
178
|
+
mem.toFlowScript({ maxTokens: 4000, strategy: 'recency' }); // newest first
|
|
179
|
+
mem.toFlowScript({ maxTokens: 4000, strategy: 'frequency' }); // most-referenced first
|
|
180
|
+
mem.toFlowScript({ maxTokens: 4000, strategy: 'relevance', relevanceQuery: 'auth' }); // topic match
|
|
181
|
+
|
|
182
|
+
// Proven + foundation tiers always included (preserveTiers default)
|
|
183
|
+
// Dormant nodes excluded by default (excludeDormant)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
~3:1 compression ratio vs prose. Same reasoning, 66% fewer tokens. At scale that's real money.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Audit Trail
|
|
191
|
+
|
|
192
|
+
`prune()` doesn't delete — it archives. Every pruned node, relationship, and state is appended to `.audit.jsonl` with full provenance. Write-before-remove ordering for crash safety.
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
mem.prune(); // dormant nodes → agent-memory.audit.jsonl
|
|
196
|
+
|
|
197
|
+
// Query the audit trail
|
|
198
|
+
const history = Memory.readAuditLog('./agent-memory.audit.jsonl');
|
|
199
|
+
// Returns: AuditEntry[] — timestamp, event, full node objects, temporal metadata
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Your agent's decision history is always recoverable. Compliance-friendly by design.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## The Query Engine
|
|
207
|
+
|
|
208
|
+
Five semantic queries. No competitor has these.
|
|
209
|
+
|
|
210
|
+
| Query | What it does | Example question it answers |
|
|
211
|
+
|-------|-------------|---------------------------|
|
|
212
|
+
| `why(nodeId)` | Traces causal chains backward | "Why did we choose Redis?" |
|
|
213
|
+
| `whatIf(nodeId)` | Projects forward consequences | "What breaks if we drop caching?" |
|
|
214
|
+
| `tensions()` | Maps all tradeoffs with named axes | "What tensions exist in this design?" |
|
|
215
|
+
| `blocked()` | Finds blockers with impact scoring | "What's stuck and what's downstream?" |
|
|
216
|
+
| `alternatives(questionId)` | Reconstructs decision rationale | "What options did we consider?" |
|
|
217
|
+
|
|
218
|
+
Each query returns structured, typed results in multiple formats (chain, tree, flat, comparison). All execute in **<1ms** on typical agent memory graphs.
|
|
219
|
+
|
|
220
|
+
These operations are computationally impossible on unstructured text. That's the point. Structure makes reasoning queryable.
|
|
221
|
+
|
|
222
|
+
Full query docs with TypeScript API: [QUERY_ENGINE.md](QUERY_ENGINE.md)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Temporal Intelligence
|
|
227
|
+
|
|
228
|
+
Memory that gets smarter over time. Nodes have temporal tiers that reflect how established knowledge is:
|
|
229
|
+
|
|
230
|
+
| Tier | Meaning | Behavior |
|
|
231
|
+
|------|---------|----------|
|
|
232
|
+
| `current` | New, recent observations | Grows quickly, may be pruned |
|
|
233
|
+
| `developing` | Patterns emerging (touched 2+ times) | Building confidence |
|
|
234
|
+
| `proven` | Validated through repeated use (3+ times) | Protected from pruning |
|
|
235
|
+
| `foundation` | Core truths | Always preserved, even under budget pressure |
|
|
236
|
+
|
|
237
|
+
Nodes graduate automatically based on frequency. The `garden()` method shows what's growing, resting, and dormant. `prune()` removes dormant nodes to the audit trail. Proven and foundation tiers are preserved through budget constraints — your agent never loses hard-won knowledge.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Agent-to-Agent Decision Exchange
|
|
242
|
+
|
|
243
|
+
FlowScript's most differentiated use case: **structured semantic payloads between agents.**
|
|
244
|
+
|
|
245
|
+
When Agent A asks Agent B "why did you make that decision?", most systems return unstructured text. FlowScript returns a typed causal chain:
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
// Agent B responds to a why() query with structured reasoning
|
|
249
|
+
const chain = mem.query.why("auth-decision-001");
|
|
250
|
+
// Returns: decision ← rationale ← evidence ← constraints
|
|
251
|
+
// Every link typed, every source tracked, every tradeoff named
|
|
252
|
+
|
|
253
|
+
// Agent A can then query further:
|
|
254
|
+
const impacts = mem.query.whatIf("auth-decision-001");
|
|
255
|
+
// "If that decision changes, what downstream effects propagate?"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
This is [LDP Mode 3](https://arxiv.org/abs/2603.08852) (Semantic Graphs) — structured decision payloads as a protocol, not just storage. No other agent memory system enables typed reasoning exchange between agents. Embedding stores pass blobs. FlowScript passes *understanding*.
|
|
259
|
+
|
|
260
|
+
See [flowscript-ldp](https://pypi.org/project/flowscript-ldp/) for the working reference implementation.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Cross-Architecture Evidence
|
|
265
|
+
|
|
266
|
+
Six AI architectures (Claude, ChatGPT, Gemini, DeepSeek, Claude Code, fresh Claude instances) parsed FlowScript *without being given the specification*. All six recognized the notation immediately and started using it in responses.
|
|
267
|
+
|
|
268
|
+
Different training data, different attention mechanisms, different optimization targets. Same structural recognition. This suggests FlowScript taps fundamental patterns in language and reasoning, not model-specific quirks.
|
|
269
|
+
|
|
270
|
+
Specification alone is sufficient for full adoption. No training. No fine-tuning. Just the syntax reference and examples.
|
|
271
|
+
|
|
272
|
+
Running in production daily in a multi-agent cognitive architecture with 11 sensors, 22 scheduled tasks, and bilateral AI-to-AI relay. Not theoretical.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Why This Isn't Another Memory Layer
|
|
277
|
+
|
|
278
|
+
| Capability | FlowScript | Embedding stores | State dicts | LLM self-edit |
|
|
279
|
+
|-----------|-----------|-----------------|------------|--------------|
|
|
280
|
+
| Semantic queries (why, blocked, tensions) | Yes | No | No | No |
|
|
281
|
+
| Human-readable persistence | Yes (.fs files) | No | Partially | No |
|
|
282
|
+
| Decision provenance | Yes (typed chains) | No | No | Sometimes |
|
|
283
|
+
| Agent-to-agent reasoning exchange | Yes (LDP Mode 3) | No | No | No |
|
|
284
|
+
| Token-budgeted serialization | Yes (4 strategies) | No | No | No |
|
|
285
|
+
| Temporal tiers + graduation | Yes | No | No | No |
|
|
286
|
+
| Append-only audit trail | Yes (.audit.jsonl) | No | No | No |
|
|
287
|
+
| Sub-ms query performance | Yes | Depends | Yes | No (LLM call) |
|
|
288
|
+
| Works without fine-tuning | Yes | Yes | Yes | Yes |
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## EU AI Act Alignment
|
|
293
|
+
|
|
294
|
+
FlowScript's `why()` query produces the typed explanatory chains that Articles 12, 13(3)(b)(iv), and 86 of the EU AI Act require for high-risk AI systems. The append-only audit trail (`.audit.jsonl`) provides the decision provenance record these regulations mandate. Built for reasoning — compliance comes free.
|
|
295
|
+
|
|
296
|
+
*Applies to high-risk AI systems under Annex III. Not a universal compliance claim.*
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Notation at a Glance
|
|
301
|
+
|
|
302
|
+
You don't need to learn all 21 markers. Start with these:
|
|
303
|
+
|
|
304
|
+
| Marker | Meaning | Example |
|
|
305
|
+
|--------|---------|---------|
|
|
306
|
+
| `->` | causes / leads to | `poor sleep -> reduced focus` |
|
|
307
|
+
| `?` | question / decision point | `? which framework to use` |
|
|
308
|
+
| `><` | tension / tradeoff | `speed >< code quality` |
|
|
309
|
+
| `[blocked]` | waiting on dependency | `* [blocked(reason, since)]` |
|
|
310
|
+
| `[decided]` | committed direction | `* [decided(rationale, on)]` |
|
|
311
|
+
| `thought:` | insight worth preserving | `thought: caching is the bottleneck` |
|
|
312
|
+
|
|
313
|
+
Full 21-marker spec: [FLOWSCRIPT_SYNTAX.md](FLOWSCRIPT_SYNTAX.md) | Beginner guide: [FLOWSCRIPT_LEARNING.md](FLOWSCRIPT_LEARNING.md) | Real-world examples: [FLOWSCRIPT_EXAMPLES.md](FLOWSCRIPT_EXAMPLES.md)
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## CLI
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# Parse FlowScript to IR
|
|
321
|
+
npx flowscript-core parse example.fs -o example.json
|
|
322
|
+
|
|
323
|
+
# Lint for semantic errors (9 rules)
|
|
324
|
+
npx flowscript-core lint example.fs
|
|
325
|
+
|
|
326
|
+
# Validate IR against schema
|
|
327
|
+
npx flowscript-core validate example.json
|
|
328
|
+
|
|
329
|
+
# Query the graph
|
|
330
|
+
npx flowscript-core query why <node-id> example.json
|
|
331
|
+
npx flowscript-core query tensions example.json
|
|
332
|
+
npx flowscript-core query blocked example.json
|
|
333
|
+
npx flowscript-core query alternatives <question-id> example.json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Protocol Alignment
|
|
339
|
+
|
|
340
|
+
Three independent systems arrived at symbolic notation for AI communication without cross-pollination:
|
|
341
|
+
|
|
342
|
+
| System | Date | Scope |
|
|
343
|
+
|--------|------|-------|
|
|
344
|
+
| [SynthLang](https://github.com/ruvnet/SynthLang) | Jan 2025 | Prompt compression |
|
|
345
|
+
| **FlowScript** | **Oct 2025** | **Decision intelligence + formal toolchain** |
|
|
346
|
+
| [MetaGlyph](https://arxiv.org/abs/2601.07354) | Jan 2026 | Prompt compression (6 operators, 62-81% token reduction) |
|
|
347
|
+
|
|
348
|
+
When independent builders converge on the same structural insight, that's evidence the insight is load-bearing.
|
|
349
|
+
|
|
350
|
+
FlowScript's IR is the first implementation of **LDP Mode 3** (Semantic Graphs) from [arXiv:2603.08852](https://arxiv.org/abs/2603.08852). Active collaboration with the LDP paper author on session state machine co-design ([GitHub issues](https://github.com/sunilp/ldp-protocol/issues)).
|
|
351
|
+
|
|
352
|
+
Also structurally aligned with [G2CP](https://github.com/karim0bkh/G2CP_AAMAS) (graph-grounded agent communication, 73% token reduction), [JamJet](https://jamjet.dev) (Rust agent runtime with ProtocolAdapter), and [NFD](https://arxiv.org/abs/2603.10808) (three-tier cognitive architecture matching FlowScript's temporal model).
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Documentation
|
|
357
|
+
|
|
358
|
+
**Learn the notation:**
|
|
359
|
+
[FLOWSCRIPT_SYNTAX.md](FLOWSCRIPT_SYNTAX.md) (complete spec) | [FLOWSCRIPT_LEARNING.md](FLOWSCRIPT_LEARNING.md) (beginner guide) | [FLOWSCRIPT_EXAMPLES.md](FLOWSCRIPT_EXAMPLES.md) (real-world patterns)
|
|
360
|
+
|
|
361
|
+
**Understand the engine:**
|
|
362
|
+
[QUERY_ENGINE.md](QUERY_ENGINE.md) (5 queries, TypeScript API) | [TOOLCHAIN.md](TOOLCHAIN.md) (parser, linter, validator)
|
|
363
|
+
|
|
364
|
+
**Dive deeper:**
|
|
365
|
+
[ADVANCED_PATTERNS.md](ADVANCED_PATTERNS.md) (sophisticated usage) | [spec/](spec/) (formal specifications) | [examples/](examples/) (golden .fs/.json pairs)
|
|
366
|
+
|
|
367
|
+
**Try it live:** [flowscript.org](https://flowscript.org)
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Contributing
|
|
372
|
+
|
|
373
|
+
Use FlowScript. Report what's friction. Open issues with evidence from real use, not theoretical proposals.
|
|
374
|
+
|
|
375
|
+
Working on agent protocols? FlowScript's IR is a natural fit for structured semantic payloads. PRs for integration welcome.
|
|
376
|
+
|
|
377
|
+
- [GitHub Issues](https://github.com/phillipclapham/flowscript/issues)
|
|
378
|
+
- [GitHub Discussions](https://github.com/phillipclapham/flowscript/discussions)
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## License
|
|
383
|
+
|
|
384
|
+
MIT. See [LICENSE](LICENSE).
|
|
385
|
+
|
|
386
|
+
*Decision intelligence for AI agents. 532 tests. Typed semantic queries over structured reasoning.*
|
package/bin/flowscript
ADDED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* FlowScript CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for FlowScript toolchain:
|
|
6
|
+
* - parse: Compile FlowScript text → IR JSON
|
|
7
|
+
* - lint: Validate FlowScript semantics
|
|
8
|
+
* - validate: Verify IR JSON against schema
|
|
9
|
+
* - query: Query IR for cognitive insights (5 queries)
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG"}
|