pi-simocracy 0.2.0 → 0.3.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/README.md +49 -14
- package/package.json +1 -1
- package/src/auth/commands.ts +4 -4
- package/src/index.ts +260 -426
- package/src/openrouter.ts +0 -16
- package/src/simocracy.ts +3 -89
- package/src/writes.ts +117 -53
- package/src/interview.ts +0 -516
- package/src/training/alignment.ts +0 -259
- package/src/training/apply.ts +0 -271
- package/src/training/baseline.ts +0 -159
- package/src/training/chat.ts +0 -131
- package/src/training/feedback.ts +0 -81
- package/src/training/index.ts +0 -142
- package/src/training/profile.ts +0 -229
- package/src/training/prompt-helpers.ts +0 -70
- package/src/training/prompts.ts +0 -131
- package/src/training/question-set.ts +0 -134
- package/src/training/storage.ts +0 -81
- package/src/training/types.ts +0 -121
package/README.md
CHANGED
|
@@ -33,13 +33,17 @@ doesn't need it — it just rewrites pi's system prompt.
|
|
|
33
33
|
|
|
34
34
|
## Slash commands
|
|
35
35
|
|
|
36
|
-
| Command
|
|
37
|
-
|
|
38
|
-
| `/sim <name>`
|
|
39
|
-
| `/sim <at-uri>`
|
|
40
|
-
| `/sim status`
|
|
41
|
-
| `/sim unload`
|
|
42
|
-
| `/sim
|
|
36
|
+
| Command | What it does |
|
|
37
|
+
|-------------------|-------------------------------------------------------------|
|
|
38
|
+
| `/sim <name>` | Load a sim by name (fuzzy search). Multiple matches → picker. |
|
|
39
|
+
| `/sim <at-uri>` | Load a sim by AT-URI directly (no search). |
|
|
40
|
+
| `/sim status` | Show which sim is currently loaded. |
|
|
41
|
+
| `/sim unload` | Drop the persona and break character cleanly. |
|
|
42
|
+
| `/sim login [handle]` | Sign in to **ATProto / Bluesky** via loopback OAuth (NOT Anthropic — pi's built-in `/login` is what does that). Required before pi can update your sim. |
|
|
43
|
+
| `/sim logout` | Clear the local ATProto OAuth session. |
|
|
44
|
+
| `/sim whoami` | Show the signed-in handle / DID. |
|
|
45
|
+
| `/sim my [name]` | List / pick / fuzzy-load sims you own on your PDS. Single match auto-loads; ambiguous matches open a picker. Requires `/sim login`. |
|
|
46
|
+
| `/sim help` | Print usage. |
|
|
43
47
|
|
|
44
48
|
Examples:
|
|
45
49
|
|
|
@@ -47,20 +51,48 @@ Examples:
|
|
|
47
51
|
/sim mr meow
|
|
48
52
|
/sim Marie Curie
|
|
49
53
|
/sim at://did:plc:qc42fmqqlsmdq7jiypiiigww/org.simocracy.sim/3mfo6vwfaka24
|
|
54
|
+
/sim login alice.bsky.social
|
|
55
|
+
/sim my
|
|
50
56
|
/sim unload
|
|
51
57
|
```
|
|
52
58
|
|
|
53
59
|
---
|
|
54
60
|
|
|
61
|
+
## Editing a sim's constitution / speaking style
|
|
62
|
+
|
|
63
|
+
There is no slash-command pipeline for this. Once you've signed in via
|
|
64
|
+
`/sim login` and loaded a sim you own (`/sim my`, then pick), just
|
|
65
|
+
**describe the change you want to pi**:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
> add a red line about animal welfare to the constitution
|
|
69
|
+
> rewrite the speaking style to drop the lenny faces and be more concise
|
|
70
|
+
> shorten the constitution to ~300 words and emphasise renewable energy
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Pi rewrites the constitution and/or speaking style itself, then calls
|
|
74
|
+
the `simocracy_update_sim` tool to persist the result. The tool refuses
|
|
75
|
+
to run if you're not signed in or you don't own the loaded sim. The
|
|
76
|
+
new persona takes effect on the next reply — no reload needed.
|
|
77
|
+
|
|
78
|
+
Writing goes directly to your PDS via
|
|
79
|
+
`com.atproto.repo.createRecord` / `putRecord` against the
|
|
80
|
+
`org.simocracy.agents` (constitution) and `org.simocracy.style`
|
|
81
|
+
(speaking style) collections — the same lexicons simocracy.org reads
|
|
82
|
+
back.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
55
86
|
## LLM-callable tools
|
|
56
87
|
|
|
57
88
|
The same actions are exposed to pi as tools, so the model can drive them itself:
|
|
58
89
|
|
|
59
|
-
| Tool
|
|
60
|
-
|
|
61
|
-
| `simocracy_load_sim`
|
|
62
|
-
| `simocracy_unload_sim`
|
|
63
|
-
| `simocracy_chat`
|
|
90
|
+
| Tool | Use when |
|
|
91
|
+
|-------------------------|-----------------------------------------------------------------|
|
|
92
|
+
| `simocracy_load_sim` | Load a sim into the current session (sets the persona). |
|
|
93
|
+
| `simocracy_unload_sim` | Stop roleplaying. |
|
|
94
|
+
| `simocracy_chat` | Send one message to a sim and get a quoted reply, **without** changing the active session persona. Useful for "ask Mr Meow what he thinks of this PR." Requires `OPENROUTER_API_KEY`. |
|
|
95
|
+
| `simocracy_update_sim` | Write a new constitution (`shortDescription` + `description`) and/or speaking `style` for the **loaded** sim to your PDS. Requires `/sim login` AND ownership of the loaded sim. |
|
|
64
96
|
|
|
65
97
|
---
|
|
66
98
|
|
|
@@ -98,9 +130,12 @@ keeps the terminal it's already running in.
|
|
|
98
130
|
```
|
|
99
131
|
src/
|
|
100
132
|
├── index.ts # extension entry: slash command, tools, persona injection
|
|
101
|
-
├──
|
|
133
|
+
├── persona.ts # buildSimPrompt(sim) — the system-prompt fragment
|
|
134
|
+
├── simocracy.ts # indexer + PDS client (read-only fetchers)
|
|
135
|
+
├── writes.ts # PDS writers + ownership / sign-in preconditions
|
|
102
136
|
├── png-to-ansi.ts # RGBA half-block ANSI renderer
|
|
103
|
-
|
|
137
|
+
├── openrouter.ts # minimal OpenRouter client (only used by simocracy_chat)
|
|
138
|
+
└── auth/ # ATProto OAuth loopback flow + session storage
|
|
104
139
|
demo/
|
|
105
140
|
└── sim-load.tape # vhs tape — render with `vhs demo/sim-load.tape`
|
|
106
141
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-simocracy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Pi extension: load a Simocracy sim into your chat — see its pixel-art sprite render inline in the terminal and roleplay with it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "David Dao <david@gainforest.earth> (https://github.com/daviddao)",
|
package/src/auth/commands.ts
CHANGED
|
@@ -106,8 +106,8 @@ export async function runLogin(
|
|
|
106
106
|
|
|
107
107
|
ctx.ui.notify(
|
|
108
108
|
handleResolved
|
|
109
|
-
? `🔐 Signed in to ATProto as @${handleResolved} (${did}).
|
|
110
|
-
: `🔐 Signed in to ATProto as ${did}.
|
|
109
|
+
? `🔐 Signed in to ATProto as @${handleResolved} (${did}). Pi can now update the constitution / speaking style of any sim you own via the simocracy_update_sim tool — just load one of your sims with /sim my and ask pi for the change you want.`
|
|
110
|
+
: `🔐 Signed in to ATProto as ${did}. Pi can now update the constitution / speaking style of any sim you own via the simocracy_update_sim tool — just load one of your sims with /sim my and ask pi for the change you want.`,
|
|
111
111
|
"info",
|
|
112
112
|
);
|
|
113
113
|
} finally {
|
|
@@ -139,8 +139,8 @@ export async function runWhoami(ctx: ExtensionCommandContext): Promise<void> {
|
|
|
139
139
|
}
|
|
140
140
|
ctx.ui.notify(
|
|
141
141
|
auth.handle
|
|
142
|
-
? `Signed into ATProto as @${auth.handle} (${auth.did}) since ${auth.lastLogin}.
|
|
143
|
-
: `Signed into ATProto as ${auth.did} since ${auth.lastLogin}.
|
|
142
|
+
? `Signed into ATProto as @${auth.handle} (${auth.did}) since ${auth.lastLogin}. Pi can update the constitution / speaking style of any sim you own (loaded via /sim my) by calling the simocracy_update_sim tool.`
|
|
143
|
+
: `Signed into ATProto as ${auth.did} since ${auth.lastLogin}. Pi can update the constitution / speaking style of any sim you own (loaded via /sim my) by calling the simocracy_update_sim tool.`,
|
|
144
144
|
"info",
|
|
145
145
|
);
|
|
146
146
|
}
|