Skip to content

Pod-scoped URI/namespace redesign (Plans 1–3)#38

Open
tophcodes wants to merge 33 commits into
mainfrom
feat/session-scoped-writes
Open

Pod-scoped URI/namespace redesign (Plans 1–3)#38
tophcodes wants to merge 33 commits into
mainfrom
feat/session-scoped-writes

Conversation

@tophcodes

@tophcodes tophcodes commented May 29, 2026

Copy link
Copy Markdown
Member

Implements the pod-scoped URI/namespace design (docs/superpowers/specs/2026-05-29-pod-uri-namespace-design.md) across staged plans.

Plan 1 — session-scoped writes & enforcement. The agent writes knowledge only into its current session container (a capability boundary: sessionId is not a tool param); concepts are Turtle named-graph claims with session-scoped IRIs minted from prefLabel.

Plan 2 — TypeIndex discovery & bless. resolveContainers/ensureRegistration (Solid TypeIndex, default /g/), findCanonicalByLabel, and blessSession — promotes a session's non-invalidated claims into the canonical pod-scoped /g/ graph (lookup-or-mint, remap session→canonical, additive merge, provenance). CLI scripts/bless.ts. Live-verified against JSS.

Plan 3a — render canonical concepts. Claims stamped with aleph:turn; the store loads /g/ via the TypeIndex; node/edge queries match canonical /g/ concepts host-agnostically (excluding session drafts). First oxigraph store-query test.

Plan 3b (in progress) — in-chat bless/reject. Bless button wired (blessSession runs in the browser). Per-turn proposed-concept rendering + reject still to come.

Deferred (Plan 4): rename the app container /aleph//aleph.wiki/ atomically (daemon + UI + seed) and migrate existing data.

~82 unit tests pass; typecheck clean. UI bits are compile-verified (vue-tsc + vite build); browser click-through pending.

tophcodes and others added 30 commits May 29, 2026 10:43
Bun's built-in undici shim lacks cacheStores, so Comunica's QueryEngine
crashed on construction and took down `nix run .#dev`. Run the daemon
under Node (real undici) through tsx, which also resolves its
extensionless imports. Portable entry guard replaces the Bun-only
import.meta.main; reconcile bun.lock with the merged daemon deps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ssion

The router gated on .jsonld filenames and JSON.parse'd bodies, but
getResource fetches Turtle via conneg and the UI writes msg{N}.ttl — so
routeEvent returned null for every real message. Parse RDF with n3 and
query the ChatMessage/speaker triple instead; any serialization now routes.

JSS notifications don't propagate descendant writes to a parent-container
subscriber, so a single sub on /aleph/sessions/ never saw new messages in
existing sessions. Add watchSessions: one subscription per session container
plus the parent (to pick up new sessions). Log pub/route/enqueue decisions
so the event path is observable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The runner logged only bare tool names and the MCP tools were silent, so a
run that read the pod repeatedly looked like it did nothing. Log run start/
end with timing and tool-call count, each tool_use with an arg summary, the
agent's text, and every pod read/write (path + outcome) in the MCP tools.
Drain now reports sessions scanned vs. needing a reply.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
read_pod 404'd because the prompt told the agent to read msg{N}.jsonld, but
messages are msg{N}.ttl. And a path missing its leading slash produced a
malformed URL (http://localhost:3000aleph/chat/) since url() just concatenated.

Normalize url() to always join with exactly one slash. Rewrite the prompt to
pass absolute /aleph/ paths and discover real message filenames from the
container listing instead of assuming an extension.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JSS stores .jsonld opaquely and serves an empty graph under conneg, so the UI
(which ingests Turtle) never saw agent replies. Serialize the pod body to
Turtle in-process via jsonld.toRDF + n3 (expanding the inline context, so no
relative ./context.jsonld dereference), write .ttl with text/turtle. SHACL
still validates the JSON-LD graph. Live-verified: a written reply round-trips
with the full ChatMessage triples the chat query needs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Concepts were asserted with an empty @id, collapsing onto the assertion
document URL (/aleph/assertions/.../). all-nodes.sparql only renders subjects
under https://aleph.wiki/g/, so they never appeared as graph nodes. Rewrite
the prompt: each Concept needs its own g: CamelCase @id; only the assertion
header @id stays empty. Also log the failing query on sparql_query errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Instances become pod-scoped relative IRIs (<podbase>/g/<slug>), type-agnostic;
knowledge in /g/ (shared substrate, discovered via Solid TypeIndex) separated
from aleph.wiki chat/provenance plumbing. Readable slugs with mandatory
lookup-before-mint dedup. Canonicalization gate: agent proposes into the
session, user blesses, only then are canonical triples minted into /g/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…provenance)

Provenance generalized: points at canonical IRIs anywhere (not just /g/) and at
other triples in the same session. Session draft uses local hash IRIs promoted
to canonical at bless; provenance is node/claim-level (no RDF-star).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop draft.ttl: the session container's union (minus invalidated claims) is the
working graph. Each claim is its own resource/named graph, invalidated at
claim-level via PROV (no RDF-star; finer exclusion = recreate a smaller graph).
Cross-claim entities use session-scoped IRIs, remapped to canonical at bless.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The bless gate is a capability boundary, not a policy: MCP write tools derive
the target container from the run-bound session (sessionId no longer an
agent-chosen parameter) and reject anything outside it. /g/ is written only by
the bless code path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n container

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…test guards + cleanup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…map + additive merge

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tophcodes and others added 3 commits May 29, 2026 15:08
Replace STRSTARTS host-pinned filters with REGEX(STR(?x), "^https?://[^/]+/g/[^/]+$")
in all 5 graph queries. Excludes session-draft IRIs (/aleph/sessions/.../g/slug)
and vocab subjects. Verified RED→GREEN via oxigraph store-query test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tophcodes tophcodes changed the title Enforce session-scoped writes for the agent daemon Pod-scoped URI/namespace redesign (Plans 1–3) May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant