a digital entity named phi that roams bsky phi.zzstoatzz.io
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 111 lines 6.3 kB view raw view rendered
1# memory 2 3phi has four kinds of state it draws on. they differ in visibility, trust, who curates them, and where they live. 4 5## 1. thread context (chronological) 6 7**source**: ATProto network · **storage**: none — fetched on demand · **visibility**: public 8 9``` 10@alice: I love birds 11@phi: me too! what's your favorite? 12@alice: especially crows 13``` 14 15fetched via `client.get_thread(uri, depth=100)` per batch (~200ms). provides what was said in *this* thread. not cached — the network is always current. 16 17## 2. private memory (TurboPuffer) 18 19**source**: extraction agent + phi's `note` tool · **storage**: TurboPuffer vector DB (OpenAI text-embedding-3-small) · **visibility**: private to phi 20 21### namespaces 22 23| namespace | contents | 24|---|---| 25| `phi-users-{handle}` | per-user observations, raw interaction logs, exploration notes, summaries | 26| `phi-episodic` | phi's own notes about the world (not tied to a specific user) | 27 28within a user namespace, rows have a `kind`: 29- `observation` — extracted facts about the user ("likes rust", "name is nate") 30- `interaction` — verbatim log of an exchange ("user: X / bot: Y") 31- `exploration_note` — background research phi did on a person's public activity (lower trust) 32- `summary` — compacted relationship summary (generated by external prefect flow) 33 34### supersession (not deletion) 35 36observations carry a `status` field (`active` | `superseded`) and a `supersedes` field linking to the prior row when an observation is updated. only active rows appear in context injection. superseded rows stay in the namespace as provenance — you can trace what phi believed and when it changed. 37 38### the extraction pipeline 39 40after every reply, `after_interaction` stores the verbatim exchange. periodically, the extraction agent reads the recent exchanges and proposes new observations. for each proposal: 41 421. find the 3 most similar active observations (vector search) 432. send the new + best-match to a haiku reconciliation agent 443. it returns ADD / UPDATE / DELETE / NOOP — execute accordingly 45 46reconciliation runs blind on the new exchange (no existing observations in the prompt) so the extraction model can't pattern-match off potentially-bad prior observations. only the reconciliation step sees both. 47 48### dream/distill 49 50a separate `process_review` pass evaluates recent observations across user namespaces — keep, supersede, promote to public cosmik card. operator-triggered; not on a cron yet. 51 52## 3. public memory (cosmik / semble) 53 54**source**: phi's `save_url`, `note`, `create_connection` tools · **storage**: phi's PDS as `network.cosmik.*` records, indexed by [semble](https://semble.so) · **visibility**: public 55 56three record types: 57- `network.cosmik.card` (NOTE) — text notes 58- `network.cosmik.card` (URL) — bookmarks with title/description 59- `network.cosmik.connection` — typed semantic links between cards 60 61phi searches public memory via `search_network` (semble's semantic search). the `note` tool dual-writes to both turbopuffer (private fast recall) and cosmik (public discoverable). `save_url` writes only to cosmik. 62 63## 4. intent state (PDS) 64 65**source**: phi via owner-gated tools · **storage**: phi's PDS under `io.zzstoatzz.phi.*` · **visibility**: public 66 67durable intent that phi acts against: 68 69- `io.zzstoatzz.phi.goal` — phi's anchors (e.g. "make 3 friends" with a concrete progress signal). mutated via `propose_goal_change`, owner-gated by the like-as-approval mechanism. injected as `[GOALS]` every tick. 70- `io.zzstoatzz.phi.mentionConsent` — handles opted in to be tagged by phi. 71 72## context injection 73 74when phi processes a notification batch, the system prompt assembles blocks from each kind of state: 75 76``` 77[GOALS] ← intent (PDS) 78[INNER CRITIC] ← haiku critique of recent posts vs goals, first person 79[SELF STATE] ← last-follow age, queue depth 80[NEW NOTIFICATIONS] ← the batch itself 81[PHI'S SYNTHESIZED IMPRESSION] ← per-author relationship summary (low trust) 82[OBSERVATIONS ABOUT @alice] ← per-author observations (active only) 83[BACKGROUND RESEARCH] ← per-author exploration notes (lowest trust) 84[PAST EXCHANGES WITH @alice] ← per-author interaction logs (high trust) 85[RELEVANT MEMORIES — synthesized for this query] ← episodic top-K → haiku synthesis 86[SEMBLE] ← one-line cosmik state 87``` 88 89each section is labeled with its trust level. operational instructions tell phi to trust current user messages over stored observations. 90 91see [system-prompt.md](system-prompt.md) for the full block-by-block reference (sources, refresh cadences, purposes). 92 93## why episodic gets synthesized, observations don't 94 95episodic memory was getting raw top-K from the vector store dumped into the prompt — stale "pending X" notes appeared next to fresh ones with equal weight, no reconciliation against current PDS state. now `inject_episodic` fetches top-K, then a haiku pass takes phi's goals + the current query as context and produces a coherent block (deduped, recency-aware, contradictions flagged). same shape as `[INNER CRITIC]` does for posts. 96 97per-author observation blocks aren't synthesized because they're already curated by reconciliation on write — by the time they hit the prompt they're an active set with no near-duplicates by design. 98 99## the graph (`/memory`) 100 101a visualization at `/memory` shows phi + user nodes positioned by semantic similarity of their observation vectors (PCA projection). only active observations contribute to positioning. 102 103## summary table 104 105| | thread context | private memory | public memory | intent state | 106|---|---|---|---|---| 107| **what** | this conversation | patterns across conversations | knowledge worth sharing | what phi is for / pending | 108| **storage** | network (atproto) | TurboPuffer | PDS (cosmik) + semble | PDS (`io.zzstoatzz.phi.*`) | 109| **visibility** | public | private to phi | public | public | 110| **curation** | network handles it | extraction + reconciliation (append-only supersession) | phi's intentional writes | owner-approved (like-gate) | 111| **trust** | high (verbatim) | medium (extracted) | higher (intentional) | highest (gated) |