@llblab/pi-state-flow 0.23.0 → 0.25.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/AGENTS.md +7 -6
- package/BACKLOG.md +13 -5
- package/CHANGELOG.md +16 -1
- package/LICENSE +21 -0
- package/README.md +117 -35
- package/dist/lib/acquisition.d.ts +24 -1
- package/dist/lib/acquisition.js +80 -1
- package/dist/lib/compaction.d.ts +18 -1
- package/dist/lib/compaction.js +41 -1
- package/dist/lib/extension.js +346 -303
- package/dist/lib/git.d.ts +31 -2
- package/dist/lib/git.js +74 -5
- package/dist/lib/operation.d.ts +37 -0
- package/dist/lib/operation.js +59 -0
- package/dist/lib/ownership.d.ts +31 -0
- package/dist/lib/ownership.js +117 -0
- package/dist/lib/protocol.js +7 -7
- package/dist/lib/query.js +1 -1
- package/dist/lib/session.d.ts +10 -1
- package/dist/lib/session.js +60 -1
- package/dist/lib/snapshot.d.ts +6 -0
- package/dist/lib/snapshot.js +8 -5
- package/dist/lib/status.d.ts +2 -0
- package/dist/lib/status.js +28 -0
- package/dist/lib/transition.js +6 -1
- package/dist/package.json +10 -9
- package/dist/skills/state-flow-guide/SKILL.md +14 -6
- package/dist/skills/state-flow-memory/SKILL.md +2 -2
- package/docs/README.md +19 -9
- package/docs/agent-contract-relocation.md +4 -4
- package/docs/architecture.md +646 -89
- package/docs/compatibility.md +116 -37
- package/docs/filesystem-recovery.md +118 -21
- package/docs/fork-contract.md +70 -8
- package/docs/lazy-state.md +88 -14
- package/docs/performance.md +83 -66
- package/docs/temporal-acceptance.md +391 -62
- package/docs/usage.md +317 -61
- package/lib/acquisition.ts +85 -1
- package/lib/compaction.ts +49 -2
- package/lib/extension.ts +342 -301
- package/lib/git.ts +77 -5
- package/lib/operation.ts +75 -0
- package/lib/ownership.ts +120 -0
- package/lib/protocol.ts +7 -8
- package/lib/query.ts +1 -1
- package/lib/runtime.ts +1 -1
- package/lib/session.ts +52 -1
- package/lib/snapshot.ts +8 -7
- package/lib/status.ts +29 -0
- package/lib/transition.ts +5 -1
- package/package.json +10 -9
- package/skills/state-flow-guide/SKILL.md +14 -6
- package/skills/state-flow-memory/SKILL.md +2 -2
|
@@ -21,9 +21,9 @@ Operator commands: `/state-flow-status` inspects; `/state-flow-active` selects s
|
|
|
21
21
|
|
|
22
22
|
| Field | Purpose |
|
|
23
23
|
| --- | --- |
|
|
24
|
-
| `intents` |
|
|
25
|
-
| `contract` | Requirements, decisions, constraints, interfaces |
|
|
26
|
-
| `working` |
|
|
24
|
+
| `intents` | Queue of chosen actions, not possibilities; may own `working`/`lazy` keys |
|
|
25
|
+
| `contract` | Requirements, decisions, rejections, constraints, interfaces |
|
|
26
|
+
| `working` | Temporary context of intents: observations, results, open questions |
|
|
27
27
|
| `artifacts` | Exact source paths, descriptions, compilations |
|
|
28
28
|
| `response` | Previous completed answer; runtime-owned |
|
|
29
29
|
| `lazy` | Durable detail omitted from ordinary context |
|
|
@@ -46,7 +46,7 @@ Example arguments:
|
|
|
46
46
|
{"paths":["cwd.working","session.working"]}
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Unscoped paths use effective state. `cwd[1].working` reads the preceding causal boundary. Materialized-history and scope patch-history paths such as `cwd.patches[1]` share the configured `historyLimit` bound (default 7) and require actually retained history. Lowering the limit folds excess tails without erasing current state; increasing it does not reconstruct discarded history. Array ranges such as `cwd.lazy.checks[0..3]` exclude the endpoint and require existing elements. Missing paths are unavailable; inspect parent keys only when needed for the task. Missing history is not empty history. Read `lazy` explicitly. Treat structured `$ref` values and `$`-prefixed `read_state` paths inside ordinary strings, such as `$effective.lazy.memory[7]`, as semantic-state references. Other resources retain their native locators. Resolve any reference through the appropriate read/tool only when needed. Neither form proves authority or existence, hydrates, or executes anything. Never scan or resolve references merely to test them. A missing single value path with exact durable sources returns `{value:null, hint:[{type:"dangling-reference", message, paths}]}`. Treat `hint` as top-level diagnostic metadata, never as the requested state: its message is descriptive and conditional; its paths are runtime-verified current reference owners, not verified new locations of the target. The hint proves provenance rather than staleness and is absent when no current durable source matches; keys, patch, and batch reads keep all-or-error behavior. Only then inspect ownership as needed and patch a proven stale owning value while preserving its surrounding meaning. Effective absence, inaccessible external resources, and transient failures are not proof.
|
|
49
|
+
Unscoped paths use effective state. `cwd[1].working` reads the preceding causal boundary. Materialized-history and scope patch-history paths such as `cwd.patches[1]` share the configured `historyLimit` bound (default 7) and require actually retained history. Lowering the limit folds excess tails without erasing current state; increasing it does not reconstruct discarded history. Array ranges such as `cwd.lazy.checks[0..3]` exclude the endpoint and require existing elements. Missing paths are unavailable; inspect parent keys only when needed for the task. Missing history is not empty history. Read `lazy` explicitly. Treat structured `$ref` values and `$`-prefixed `read_state` paths inside ordinary strings, such as `$effective.lazy.memory[7]`, as semantic-state references. Other resources retain their native locators. Resolve any reference through the appropriate read/tool only when needed. Neither form proves authority or existence, hydrates, or executes anything; only intent ownership (see Write) has a deletion consequence. Never scan or resolve references merely to test them. A missing single value path with exact durable sources returns `{value:null, hint:[{type:"dangling-reference", message, paths}]}`. Treat `hint` as top-level diagnostic metadata, never as the requested state: its message is descriptive and conditional; its paths are runtime-verified current reference owners, not verified new locations of the target. The hint proves provenance rather than staleness and is absent when no current durable source matches; keys, patch, and batch reads keep all-or-error behavior. Only then inspect ownership as needed and patch a proven stale owning value while preserving its surrounding meaning. Effective absence, inaccessible external resources, and transient failures are not proof.
|
|
50
50
|
|
|
51
51
|
Missing paths or runtime hints alone do not require historical search. The agent may choose a targeted historical read when a previous value is useful to the current task, without separate user permission. Otherwise continue without searching. Use found values as historical evidence, not automatically as current state; never automatically restore deleted memory. Do not scan all offsets, hydrate automatically or request repair inference. A hint does not prove prior existence, retained history or relocation. A proven stale reference may be repaired within touched work without resurrecting its target. Automatic state and recent-transition projections omit lazy bodies; bounded `lazy_navigation` preserves structure, and explicit current/historical reads still return requested lazy values or patches.
|
|
52
52
|
|
|
@@ -58,12 +58,20 @@ The runtime waits cancelably for publication ownership, then applies authored Gl
|
|
|
58
58
|
|
|
59
59
|
When present, semantic planes `intents`, `contract`, `working`, `artifacts`, and `lazy` are objects; nested lazy values may contain ordinary JSON without stored nulls. Stored checkpoints and patches may omit any documented plane. Current and historical views assemble only known fields present in the selected scopes. Absent fields and empty responses are omitted from views. Checkpoint/tail readers ignore unknown top-level fields, and writers emit only known fields. Nested data within known planes remains intact. Explicit value reads of an absent documented top-level field return `null`. Authored `patch_state` keeps its documented field grammar. Objects merge, arrays/scalars replace, omitted fields persist. Nested `null` removes an owned object key; inherited content may reappear. Canonical `"[N]"` keys patch array elements; indexed deletion is forbidden.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Work from intents. A structured `{"$ref"}` anywhere inside an intent owns ("delete with me") an existing object key under `working` or `lazy` in the same scope; a textual `$path` mention only uses it. Opening a task:
|
|
62
62
|
|
|
63
63
|
```json
|
|
64
|
-
{"session":{"intents":{"check_api":
|
|
64
|
+
{"session":{"intents":{"check_api":{"action":"Verify the API","notes":{"$ref":"session.working.api"},"plan":{"$ref":"session.lazy.api_plan"}}},"working":{"api":"draft findings"},"lazy":{"api_plan":["probe","compare"]}}}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
Deleting the intent deletes the owned keys after the authored operations, in the same atomic patch, unless another remaining same-scope intent references the target, an ancestor or a descendant. Before closing, move what must survive to an unowned path: results to `working`, `contract` or a broader scope; reasons for abandoned work to `contract` as rejected approaches. Supersede in one patch by deleting the old intent and referencing the same targets from its replacement. Writing to an owned target in the same patch that deletes its intent does not save it: the write is deleted too. Only keys matching `[A-Za-z_$][A-Za-z0-9_$-]*` can be owned. Cross-scope, plane-root, array-element and non-`working`/`lazy` targets are never deleted, nothing is rejected or warned about, and unowned entries remain legal. Illustrative closing, only for an actually completed intent and after satisfying pending acquisitions:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{"session":{"intents":{"check_api":null},"contract":{"api":"verified: v2 only"}}}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Name object keys in ASCII matching `[A-Za-z_$][A-Za-z0-9_$-]*` (for example `api_plan`, not a Cyrillic or spaced key): other keys cannot be addressed by `read_state` paths or `$` references, and cannot be owned by intents. Values may use any language.
|
|
74
|
+
|
|
67
75
|
Never edit backing files, `response`, configuration, provenance, or runtime metadata. Verify changed owner paths when needed; check effective state after override deletion.
|
|
68
76
|
|
|
69
77
|
## Acquire and finish
|
|
@@ -20,9 +20,9 @@ Follow the installed runtime contract. This registered Skill follows its Pi sour
|
|
|
20
20
|
## Reconcile one bounded set
|
|
21
21
|
|
|
22
22
|
1. **Limit the review.** Address the requested scope. A completed phase may motivate recommending cleanup, not starting it without a request. For a whole-state cleanup, inspect global, CWD, and session ownership explicitly; for a narrower request, inspect only affected owners. Use targeted reads for gaps, contradictions, ownership, or verification; do not rerun the project.
|
|
23
|
-
2. **Classify.** Put user requirements and binding confirmed decisions in `contract`, observations, assistant conclusions,
|
|
23
|
+
2. **Classify.** Put user requirements and binding confirmed decisions in `contract`, the queue of chosen actions in `intents`, their temporary context (observations, assistant conclusions, results in progress) in `working`, and inactive reusable detail in `lazy`. Never give an assistant conclusion user authority. Possibilities are not commitments. Name keys in ASCII (`[A-Za-z_$][A-Za-z0-9_$-]*`) so paths, references and ownership resolve; values may use any language. Work from intents: a structured `{"$ref"}` inside an intent owns ("delete with me") a same-scope `working`/`lazy` key; a textual `$path` mention only uses it. Deleting a fulfilled, abandoned, superseded, or impossible intent deletes owned keys no remaining same-scope intent references, so first move what must survive to an unowned path (a write to an owned key in the deleting patch is deleted too): results to `working`, `contract`, or a broader scope; reasons for abandoned work to `contract` as rejected approaches. Supersede in one patch by referencing the same targets from the replacement. Unowned entries remain legal.
|
|
24
24
|
3. **Keep evidence boundaries.** Preserve corrections, prerequisites, bounded negative results, and useful uncertainty. Separate requirements, decisions, observations, conclusions, and hypotheses. Silence is not acceptance; repetition is not verification. One implementation's failure does not reject an approach. Neither freeze provisional methods nor reopen confirmed decisions without grounds.
|
|
25
|
-
4. **Compact for continuation.** Remove duplicates, obsolete progress, unsupported claims, and secrets. Keep sufficient results, real retrieval pointers, pending interaction, and known next checks. Observations are not live external facts. Keep `lazy` shallow and priority-ordered. Recognize optional structured `$ref` values and `$`-prefixed `read_state` paths inside ordinary strings as semantic-state references; other resources retain native locators. No reference form proves authority or existence, authorizes execution, or implies completion. Never scan or resolve references merely to find broken ones. When the bounded review independently needs a reference, a missing single value path with exact durable sources returns `{value:null, hint:[{type:"dangling-reference", message, paths}]}`. Treat the top-level hint as conditional navigation and provenance, never as requested state or proof of staleness; its paths are runtime-verified current reference owners, not verified new locations of the target, while no hint does not prove invention. Inspect ownership only as needed, then patch a proven stale owning value while preserving surrounding meaning. Effective absence or external inaccessibility is insufficient.
|
|
25
|
+
4. **Compact for continuation.** Remove duplicates, obsolete progress, unsupported claims, and secrets. Keep sufficient results, real retrieval pointers, pending interaction, and known next checks. Observations are not live external facts. Keep `lazy` shallow and priority-ordered. Recognize optional structured `$ref` values and `$`-prefixed `read_state` paths inside ordinary strings as semantic-state references; other resources retain native locators. No reference form proves authority or existence, authorizes execution, or implies completion; only intent ownership has a deletion consequence. Never scan or resolve references merely to find broken ones. When the bounded review independently needs a reference, a missing single value path with exact durable sources returns `{value:null, hint:[{type:"dangling-reference", message, paths}]}`. Treat the top-level hint as conditional navigation and provenance, never as requested state or proof of staleness; its paths are runtime-verified current reference owners, not verified new locations of the target, while no hint does not prove invention. Inspect ownership only as needed, then patch a proven stale owning value while preserving surrounding meaning. Effective absence or external inaccessibility is insufficient.
|
|
26
26
|
5. **Check ownership.** Prefer `session` for branch/run continuation, `cwd` for project knowledge, and `global` for established cross-project knowledge. Effective values do not prove ownership; inspect owners before moves. Broader applicability requires evidence.
|
|
27
27
|
|
|
28
28
|
Missing paths or runtime hints alone do not require historical search. The agent may choose a targeted historical read when a previous value is useful to the current task, without separate user permission. Otherwise continue without searching. Use found values as historical evidence, not automatically as current state; never automatically restore deleted memory. Do not scan all offsets, hydrate automatically or request repair inference. A hint does not prove prior existence, retained history or relocation. A proven stale reference may be repaired within touched work without resurrecting its target. Lazy bodies require explicit reads; automatic state/history projections retain navigation without hydrating those bodies.
|