Skip to content

Commit 3c1f8b4

Browse files
committed
Add turn-based intent demo
1 parent 7903ef5 commit 3c1f8b4

18 files changed

Lines changed: 1147 additions & 9 deletions

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ Managing Partner / CTO and a Certified Financial Planner professional.
1717
- Protocol Wealth GitHub: https://github.com/Protocol-Wealth
1818
- Nick Rygiel GitHub: https://github.com/rivendale
1919

20-
## Related Protocol Wealth Open Source Projects
20+
## Related Open Source Projects
2121

22-
These repositories are companion references and implementation inspiration. The
23-
`pwcli-core` specification remains neutral and reusable outside Protocol Wealth.
22+
These Protocol Wealth and maintainer repositories are companion references and
23+
implementation inspiration. The `pwcli-core` specification remains neutral and
24+
reusable outside Protocol Wealth.
2425

2526
- `nexus-core`: https://github.com/Protocol-Wealth/nexus-core
2627
- `pwos-core`: https://github.com/Protocol-Wealth/pwos-core
2728
- `pwplan-core`: https://github.com/Protocol-Wealth/pwplan-core
2829
- `pw-learnai`: https://github.com/Protocol-Wealth/pw-learnai
30+
- `iocalc-agent-env`: https://github.com/rivendale/iocalc-agent-env
2931

3032
## Core Idea
3133

@@ -98,6 +100,8 @@ Read these files in order:
98100
4. [docs/standards-map.md](docs/standards-map.md) for standards selection.
99101
5. [docs/context-packs.md](docs/context-packs.md) for context-pack structure.
100102
6. [docs/validation.md](docs/validation.md) for local and CI validation.
103+
7. [examples/turn-based-game/README.md](examples/turn-based-game/README.md) for a runnable browser demo.
104+
8. [docs/human-ux-guide.md](docs/human-ux-guide.md) for progressive disclosure patterns.
101105

102106
## Validation
103107

@@ -110,6 +114,10 @@ npm run validate
110114
The same command runs in GitHub Actions on pull requests and pushes to `main`
111115
using Node 22 and Node 24.
112116

117+
## Runnable Demo
118+
119+
Open [examples/turn-based-game/index.html](examples/turn-based-game/index.html) in a browser for a no-build demo of command input, intent telemetry, registered primitive hydration, approval, deterministic execution, and return-focus ledger output.
120+
113121
## Example Query
114122

115123
Illustrative synthetic example only; not tax, accounting, investment, or financial advice.

SPEC.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ They are not generated by the model at runtime. Each primitive should declare:
101101
- side-effect level;
102102
- approval requirement;
103103
- source/provenance requirements;
104-
- supported input and output modes.
104+
- supported input and output modes;
105+
- optional preview, cost, risk, empty/loading/error, primary action, and undo metadata.
105106

106-
See [schemas/primitive.schema.json](schemas/primitive.schema.json).
107+
See [schemas/primitive.schema.json](schemas/primitive.schema.json) and [docs/human-ux-guide.md](docs/human-ux-guide.md).
107108

108109
## 7. Context Packs
109110

docs/companion-projects.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Companion Projects
22

33
`pwcli-core` is a neutral public specification. The repositories below are
4-
related Protocol Wealth open-source projects that may provide implementation
5-
ideas, examples, or future integration references.
4+
related Protocol Wealth or maintainer open-source projects that may provide
5+
implementation ideas, examples, or future integration references.
66

77
Maintainer context:
88

@@ -18,6 +18,7 @@ Maintainer context:
1818
| pwos-core | https://github.com/Protocol-Wealth/pwos-core | Potential reference for operating-system style control-plane patterns. |
1919
| pwplan-core | https://github.com/Protocol-Wealth/pwplan-core | Potential reference for planning workflows and structured decision records. |
2020
| pw-learnai | https://github.com/Protocol-Wealth/pw-learnai | Potential reference for education, AI literacy, and learning workflows. |
21+
| iocalc-agent-env | https://github.com/rivendale/iocalc-agent-env | Public Apache-2.0 reference for game-agent environment experiments and agent-facing simulation context. |
2122

2223
## Boundary
2324

docs/human-ux-guide.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Human UX Guide
2+
3+
`pwcli-core` treats conversational UI as a focus-preserving control plane, not a
4+
license to hide consequential state changes behind fluent text. The user should
5+
see what the system inferred, what panel or route will hydrate, what costs or
6+
risks matter, and what will happen after approval.
7+
8+
## Progressive Disclosure
9+
10+
Use three practical disclosure modes.
11+
12+
### Basic
13+
14+
Basic mode favors speed for low-risk or reversible work. It should still leave a
15+
clear receipt after execution.
16+
17+
- read-only summaries can run directly;
18+
- reversible idempotent mutations may use one-click confirmation;
19+
- show concise source references and fallback routes after completion.
20+
21+
### Intermediate
22+
23+
Intermediate mode is the default for mixed human and AI workflows. It should
24+
show an intent receipt before consequential work.
25+
26+
- display intent, confidence, side-effect level, and candidate primitive;
27+
- show cost fields, risk labels, and likely output;
28+
- require explicit approval for state changes;
29+
- return focus with a deterministic ledger event and a separate interpretation.
30+
31+
### Advanced
32+
33+
Advanced mode favors auditability and operator control. It should expose
34+
structured payloads and provenance.
35+
36+
- show the full intent telemetry payload;
37+
- show source records separately from AI interpretations;
38+
- expose fallback route and execution target metadata;
39+
- require approval for irreversible or externally visible actions;
40+
- keep replay and rollback policy visible.
41+
42+
## Primitive UX Fields
43+
44+
Registered primitives can include optional `ux` metadata in
45+
`schemas/primitive.schema.json`. These fields do not execute behavior; they give
46+
the host application predictable labels and empty/loading/error states.
47+
48+
Recommended fields:
49+
50+
- `primaryAction` for the approval button label;
51+
- `previewFields` for deterministic values to show before execution;
52+
- `riskLabels` for warnings, counterplay, privacy, or compliance notes;
53+
- `costFields` for energy, money, time, quota, or approval costs;
54+
- `emptyState`, `loadingState`, and `errorState` for bounded UI copy;
55+
- `undoPolicy` for rollback expectations.
56+
57+
## Assertion Separation
58+
59+
Never mix factual ledger state with model interpretation. A preview panel may
60+
show both, but it should label them separately:
61+
62+
- deterministic source or event ledger: what the state engine knows;
63+
- advisor interpretation: what a model or heuristic inferred.
64+
65+
The deterministic ledger remains the source of truth.

docs/validation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The GitHub Actions workflow runs the same command on pull requests and pushes to
2525
`humanReviewRequired`.
2626
- Every `context-pack/*.md` file has YAML frontmatter matching the repository's
2727
context-pack convention.
28+
- Example-local `.schema.json` files parse, and fixture JSON files declare a resolvable `schemaRef`, `name`, `summary`, and `example`; core fixtures receive lightweight shape checks.
2829
- Markdown local links resolve.
2930
- Public metadata markers are present in root docs.
3031
- Text files are ASCII-only, use LF line endings, avoid trailing whitespace, and

examples/turn-based-game/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Turn-Based Game Intent Demo
2+
3+
Synthetic runnable example for the `pwcli-core` dual-engine pattern. It is a
4+
small browser-only demo: no build step, no backend, no model calls, and no
5+
external dependencies.
6+
7+
Open `index.html` in a modern browser.
8+
9+
## What It Demonstrates
10+
11+
1. Human command text is lossy.
12+
2. The parser compiles it into an intent telemetry object.
13+
3. The app selects a registered primitive from a static registry.
14+
4. The preview panel shows cost, risk, fallback route, and source references.
15+
5. A state-changing action pauses at an approval gate.
16+
6. The deterministic engine writes a ledger event.
17+
7. Advisor interpretation is displayed separately from deterministic state.
18+
19+
The example uses turn-based game language because games make irreversible
20+
commits, costs, and preview UX easy to see. The same pattern applies to
21+
archives, finance workbenches, household workflows, care portals, and other
22+
high-integrity apps.
23+
24+
## Files
25+
26+
- `index.html` - static page shell.
27+
- `styles.css` - small local visual layer.
28+
- `demo.js` - deterministic parser, primitive registry, state machine, and ledger.
29+
- `fixtures/` - JSON fixtures for intent, primitive, source, provenance, and result.
30+
- `schemas/` - example-local schema for the result ledger fixture.
31+
32+
## Safety Boundary
33+
34+
This demo does not let AI generate UI or mutate state. The parser is a tiny
35+
keyword heuristic so the state machine is easy to inspect. A real implementation
36+
can swap in a model parser, BAML-style parser, MCP tool, or typed API as long as
37+
the output is validated before it reaches the deterministic engine.

0 commit comments

Comments
 (0)