Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

feat(agent-vault): isolate repository progress in private Obsidian vaults

Abdurrahman Fakhrul4c9ea47d97ef
diff --git a/.env.example b/.env.example
index 1f80ba10..9de0148c 100644
--- a/.env.example
+++ b/.env.example
@@ -28,6 +28,8 @@ OS_SESSION_SECRET=
# --- Filesystem bounds (optional) ---
# Colon-separated roots. "~" = home, "/" = whole filesystem.
# READ defaults to home + ~/projects; set "/" to browse the whole box read-only.
+# OS_AGENT_VAULT_ROOT=~/mso-vaults
+# OS_AGENT_VAULT_PROJECT= # Optional default source repo id/name/path; private local configuration
# OS_FS_READ_ROOTS=/
# WRITE defaults to home + ~/projects (narrow, so the OS can't clobber system files).
# OS_FS_WRITE_ROOTS=~:~/projects
diff --git a/README.md b/README.md
index d7ee5ddc..0d1148da 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
|---|---|
| **Understand a project** | Project context, trusted skills and task-specific tool discovery. |
| **Do the work** | Real PTY, bounded file tools, service controls and explicit approvals. |
-| **Pick up where you left off** | Durable sessions, local memory, workflow evidence and agent handoffs. |
+| **Pick up where you left off** | Durable sessions, local memory, workflow evidence, agent handoffs and [separate repo progress vaults](./docs/AGENT-VAULT.md). |
| **Build server-native workflows** | Server-native n8n-core workflow parity: schedule/webhook triggers, branching/loops/subflows, retries/error paths, versions/history, private variables, integrations, per-node logs, and automatic private learning. |
**One runtime, three ways in:** use desktop/mobile windows, stay in your terminal, or connect an MCP client.
diff --git a/app/api/v1/agent-vault/route.test.ts b/app/api/v1/agent-vault/route.test.ts
new file mode 100644
index 00000000..e4ddb6ec
--- /dev/null
+++ b/app/api/v1/agent-vault/route.test.ts
@@ -0,0 +1,27 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+const mocks = vi.hoisted(() => ({ auth: vi.fn(), get: vi.fn(), sync: vi.fn(), audit: vi.fn(), rate: vi.fn() }));
+vi.mock("@/lib/auth/require-session", () => ({ getSessionContext: mocks.auth }));
+vi.mock("@/lib/host/agent-vault-api", () => ({ getAgentVault: mocks.get, syncAgentVault: mocks.sync }));
+vi.mock("@/lib/host/audit-api", () => ({ audit: mocks.audit }));
+vi.mock("@/lib/host/limits-api", () => ({ rateLimited: mocks.rate }));
+import { NextRequest } from "next/server";
+import { GET, POST } from "./route";
+const request = (method: string, body?: string) => new NextRequest("http://localhost/api/v1/agent-vault?project=fixture", { method, ...(body ? { body, headers: { "content-type": "application/json" } } : {}) });
+beforeEach(() => { vi.clearAllMocks(); mocks.auth.mockResolvedValue({ role: "owner", session: { device_id: "fixture-owner" } }); mocks.rate.mockReturnValue(false); mocks.get.mockResolvedValue({ state: {} }); mocks.sync.mockResolvedValue({ state: { root: "/fixture/data" } }); });
+describe("agent vault owner-private route", () => {
+ it.each(["viewer", "operator"])("refuses %s reads and refreshes before touching data", async role => {
+ mocks.auth.mockResolvedValue({ role, session: { device_id: "fixture" } });
+ expect((await GET(request("GET"))).status).toBe(403); expect((await POST(request("POST", "{}"))).status).toBe(403);
+ expect(mocks.get).not.toHaveBeenCalled(); expect(mocks.sync).not.toHaveBeenCalled();
+ });
+ it("rejects unauthenticated reads", async () => { mocks.auth.mockResolvedValue(null); expect((await GET(request("GET"))).status).toBe(401); });
+ it("reads without mutation and audits an owner refresh", async () => {
+ expect((await GET(request("GET"))).headers.get("Cache-Control")).toContain("no-store"); expect(mocks.audit).not.toHaveBeenCalled();
+ expect((await POST(request("POST", '{"project":"fixture"}'))).status).toBe(200);
+ expect(mocks.sync).toHaveBeenCalledWith("fixture"); expect(mocks.audit).toHaveBeenCalledWith(expect.objectContaining({ actor: "fixture-owner", action: "fs.write" }));
+ });
+ it("rejects malformed inputs and rate-limits refreshes", async () => {
+ expect((await POST(request("POST", '{"project":1}'))).status).toBe(400); expect(mocks.sync).not.toHaveBeenCalled();
+ mocks.rate.mockReturnValue(true); expect((await POST(request("POST", "{}"))).status).toBe(429); expect(mocks.sync).not.toHaveBeenCalled();
+ });
+});
diff --git a/app/api/v1/agent-vault/route.ts b/app/api/v1/agent-vault/route.ts
new file mode 100644
index 00000000..2c9ce11f
--- /dev/null
+++ b/app/api/v1/agent-vault/route.ts
@@ -0,0 +1,32 @@
+import { NextRequest, NextResponse } from "next/server";
+import { getSessionContext } from "@/lib/auth/require-session";
+import { getAgentVault, syncAgentVault } from "@/lib/host/agent-vault-api";
+import { audit } from "@/lib/host/audit-api";
+import { rateLimited } from "@/lib/host/limits-api";
+import { readSetupJson } from "@/lib/infra/setup-http";
+
+export const runtime = "nodejs";
+export const dynamic = "force-dynamic";
+const headers = { "Cache-Control": "private, no-store" };
+const failure = (error: unknown, status = 400) => NextResponse.json({ error: error instanceof Error ? error.message.slice(0, 300) : "Vault request failed" }, { status, headers });
+export async function GET(req: NextRequest) {
+ const context = await getSessionContext();
+ if (!context) return failure(new Error("unauthorized"), 401);
+ if (context.role !== "owner") return failure(new Error("owner_required"), 403);
+ if (rateLimited(`agent-vault:read:${context.session.device_id}`, 60, 60_000)) return failure(new Error("rate_limited"), 429);
+ try { return NextResponse.json(await getAgentVault(req.nextUrl.searchParams.get("project") ?? undefined, req.nextUrl.searchParams.get("note") ?? undefined), { headers }); }
+ catch (error) { return failure(error); }
+}
+export async function POST(req: NextRequest) {
+ const context = await getSessionContext();
+ if (!context) return failure(new Error("unauthorized"), 401);
+ if (context.role !== "owner") return failure(new Error("owner_required"), 403);
+ if (rateLimited(`agent-vault:sync:${context.session.device_id}`, 10, 60_000)) return failure(new Error("rate_limited"), 429);
+ try {
+ const body = await readSetupJson(req, 4096);
+ if (body.project !== undefined && typeof body.project !== "string") throw new Error("project must be a string");
+ const result = await syncAgentVault(body.project as string | undefined);
+ void audit({ action: "fs.write", actor: context.session.device_id, target: result.state.root, detail: "Refresh repository agent vault" });
+ return NextResponse.json(result, { headers });
+ } catch (error) { return failure(error); }
+}
diff --git a/bin/mso b/bin/mso
index 8c9be061..460ebedd 100755
--- a/bin/mso
+++ b/bin/mso
@@ -77,6 +77,7 @@
# a2a * Agent-to-Agent v1 + workflow trace: list | discover | send | handoff | trace
# memory * Assistant memories: list | add | rm
# memory-graph [project] Knowledge graph: vault notes, project memory, agent memory
+# agent-vault * Separate repository progress vault: show | sync | read
# config * Advanced raw AI config compatibility surface
# prefs * UI preferences: show | set
# federation * Batonly capability federation worker: status
diff --git a/docs/AGENT-VAULT.md b/docs/AGENT-VAULT.md
new file mode 100644
index 00000000..3587e5c3
--- /dev/null
+++ b/docs/AGENT-VAULT.md
@@ -0,0 +1,86 @@
+# Agent Vault
+
+> **Current reference.** Portable MSO feature code and installation-owned user data are separate.
+
+Agent Vault is an owner-private MSO app at `/agent-vault`. It projects recorded agent
+roles, project knowledge and progress from a selected repository into an independent
+Markdown vault readable by both MSO and Obsidian. Snapshot data describes repository
+evidence at capture time; an agent profile or commit never proves a live agent or a
+healthy deployment.
+
+## Source code and user data
+
+| Layer | Location | Authority |
+|---|---|---|
+| Open source feature | `frontend/slices/agent-vault`, `lib/agent-vault`, shared contract and host facade | Portable implementation; no operator repo identities or user notes |
+| Default source selection | `OS_AGENT_VAULT_PROJECT` in the installation's private environment | Optional repo id/name/path; browser selection can override it |
+| Vault data base | `OS_AGENT_VAULT_ROOT`, default `~/mso-vaults` | Installation-owned data outside the MSO checkout and selected source repository |
+| One repository vault | `<base>/<safe-repo-name>-<hash-of-project-id>` | Distinct roots even when repositories have the same name |
+| Snapshots and index | `Snapshots/<content-digest>/…`, `manifest.json` | Generated projection; repository sources remain authoritative |
+
+No private repository content, source path, persona, conversation or runtime configuration
+belongs in the MSO Git repository. Do not configure the vault base inside any source
+checkout. Storage inside either MSO's checkout or the selected source repository is rejected. Paths retain the normal host
+`OS_FS_READ_ROOTS` / `OS_FS_WRITE_ROOTS` bounds and credential exclusions.
+Vault ownership follows MSO's Unix service account and existing device roles;
+portable source code does not contain any installation's repository selection.
+
+## Use
+
+1. Open **Agent Vault** and enter the repository's validated id, name or path.
+2. Select **Load** to read existing snapshots, or **Refresh snapshot** to capture changes.
+3. Choose a snapshot, search its note list, and open a note.
+4. In Obsidian, choose **Open folder as vault** and select the data directory shown in MSO.
+ The overview note links to every generated note for Obsidian's local graph.
+
+Example private environment (replace the source locally):
+
+```dotenv
+OS_AGENT_VAULT_ROOT=~/mso-vaults
+OS_AGENT_VAULT_PROJECT=example-project
+```
+
+CLI:
+
+```bash
+mso agent-vault show example-project
+mso agent-vault sync example-project
+mso agent-vault read example-project '<exact note path returned by show>'
+```
+
+MCP tools are `project_agent_vault_read` (read scope) and
+`project_agent_vault_sync` (write scope, filesystem audit). Alfa exposes the same
+capabilities; refresh requires its normal mutation approval. Native API reads and
+refreshes both require a live Owner device. Browser UI filtering is not authorization.
+External clients with cached action catalogs need a tool rescan after upgrading;
+MSO cannot remotely refresh a client's action snapshot.
+
+## Collection and preservation
+
+Sources are deliberately specific: `wiki/agents/*.md`, `wiki/projects/*.md`,
+`wiki/log.md`, `docs/PROGRESS.md`, top-level Markdown summaries under
+`inbox/{mso,hermes,gpt,grokbot}`, compact `.agent/memory` records and recent Git commits.
+Secrets are redacted before persistence. Adapter configuration, raw transcripts,
+personal wiki pages, credentials and nested archived inbox material are not collected.
+No source repository writes, agent activation, model calls, Git fetch or automatic
+background schedule occur during capture.
+
+Capture preserves every completed older snapshot and user annotations within it.
+Unchanged source content reuses the current snapshot. The manifest is atomically
+replaced only after the new notes are written; a failed capture leaves the previous
+published snapshot readable. Files are private (0600) and directories private (0700).
+
+Limits: 80 source Markdown files, 600 directory entries, 48 KiB per source, 40 compact
+memory records and 20 recent commits. Notes exceeding a cap are skipped or shortened
+and the snapshot is marked partial. Each server process runs at most two refreshes;
+the existing private-store lock serializes each repository across processes. Each vault retains up to 20 distinct snapshots; when full it fails
+without deleting history. Archive the data directory and select a new base for more
+captures. A personal Obsidian vault and MSO's general assistant memories remain
+separate; their data is not imported.
+
+## Backup and rollback
+
+Back up the vault data directory independently of the MSO source checkout. Disabling
+the feature or reverting its code does not delete user data. Never commit snapshots,
+manifests, vault settings or source-selection environment files into the open source
+project.
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 2b00f216..b98bd7ba 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -6,6 +6,10 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
## 2026-10-09
+**Added**
+
+- `agent-vault` isolate repository progress in private Obsidian vaults
+
**Fixed**
- `security` pin bounded MCP store reads to one descriptor
diff --git a/docs/CLI.md b/docs/CLI.md
index 8446c1b8..1cedaafc 100644
--- a/docs/CLI.md
+++ b/docs/CLI.md
@@ -117,6 +117,7 @@ Commands:
a2a * Agent-to-Agent v1 + workflow trace: list | discover | send | handoff | trace
memory * Assistant memories: list | add | rm
memory-graph [project] Knowledge graph: vault notes, project memory, agent memory
+ agent-vault * Separate repository progress vault: show | sync | read
config * Advanced raw AI config compatibility surface
prefs * UI preferences: show | set
federation * Batonly capability federation worker: status
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index c8d5874a..bf1c3f76 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,12 @@
+## 2026-10-09: Separate repository agent progress from portable MSO code
+
+The owner asked for an Obsidian feature whose data reflects repository agents rather than personal starter notes. Agent Vault now provides a lazy native app, owner-only API, CLI and paired read/write MCP/Alfa capabilities over one guarded host implementation. Portable source contains no installation identity or user notes; source selection lives in private environment/browser state and each logical repository gets an independent data directory outside both source checkouts.
+
+Bounded capture projects canonical agent/project pages, progress logs, platform inbox summaries, compact repo memory and recent commit metadata. Content digests deduplicate unchanged captures, published snapshots preserve history and user annotations, and metadata commits only after note writes. The existing private-store lock serializes capture for a repository across server processes. Raw transcripts, adapter state and owner recall are excluded; text is redacted and collection limits stay visible. Snapshots describe recorded evidence, never live agent or deployment health.
+
+Regressions cover repo isolation, source preservation, corrupt manifests, secret/transcript exclusion, path/symlink refusal, private permissions, owner access and scope/audit parity. Synthetic browser journeys exercise note reads, changed/old snapshots, search, mobile reflow and live role revocation. The fixed snapshot ceiling refuses further capture without deleting history; no automatic schedule or native desktop launch is added to the portable feature. Agent Vault follows Settings in the mobile catalog so existing first-page apps stay reachable. Compact ChatGPT one-line descriptions use a smaller character cap to admit the two tools within the existing scanner budget, retaining all names, schemas, scopes and permission checks.
+
+
## 2026-10-09: Pin the bounded MCP store read and review the inference-test alert
Post-release CodeQL found a check/reopen race in the new store byte limit. The reader now opens once with no-follow/nonblocking flags, checks and reads that descriptor into a size-bounded buffer, rejects growth/content changes and closes it on every path. Real-file regressions replace the pathname after open and grow the file after the size check. Atomic replacement still permits reading the original consistent snapshot.
diff --git a/docs/README.md b/docs/README.md
index 1d6b1dc9..788e193a 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -33,6 +33,7 @@ evidence and review freshness. The repository quality gate runs both automatical
| [`AGENT-BOOTSTRAP.md`](./AGENT-BOOTSTRAP.md) | Canonical first-call sequence and capability-parity matrix across CLI, MCP, and Alfa |
| [`RASMIC.md`](./RASMIC.md) | Risk-aware orchestration, repo-local memory/evidence, collision detection and recipe/script promotion |
| [`MEMORY-GRAPH.md`](./MEMORY-GRAPH.md) | Owner Memory app: vault notes, project knowledge, agent memory, layouts and limits |
+| [`AGENT-VAULT.md`](./AGENT-VAULT.md) | Separate private repository agent-progress vaults, source/data boundaries and Obsidian use |
| [`MEMORY-SAFETY.md`](./MEMORY-SAFETY.md) | Session-source preservation, owner cleanup previews, local memory backups, learning/discovery visibility and remaining limits |
| [`COMPARISON.md`](./COMPARISON.md) | Generated product comparison methodology, evidence and notes |
| [`COMPETITIVE-ROADMAP.md`](./COMPETITIVE-ROADMAP.md) | Executed comparison plan, deliberate specialist boundaries and next investments |
diff --git a/docs/SLICE-CATALOG.md b/docs/SLICE-CATALOG.md
index 8434daca..d96dc9e4 100644
--- a/docs/SLICE-CATALOG.md
+++ b/docs/SLICE-CATALOG.md
@@ -3,15 +3,16 @@
> **Current reference.** Counts are checked against the directory tree by
> `scripts/check-docs.mjs`; the directory remains the final authority.
-<!-- slice-catalog: slices=29 appshell-features=10 -->
+<!-- slice-catalog: slices=30 appshell-features=10 -->
Every application is a vertical slice under `frontend/slices/`. Host-facing slices use the
shared API/host seam rather than reaching arbitrary Node host APIs from client code.
-## Slices (29)
+## Slices (30)
| Slug | Purpose |
|---|---|
+| `agent-vault` | Separate private repository agent-progress snapshots in an Obsidian-compatible Markdown vault |
| `app-store` | App Store / app discovery surface |
| `appshell` | Generic desktop/mobile shell framework |
| `assistant` | Alfa assistant, agents/playbooks and tool activity |
diff --git a/docs/generated/MCP-CATALOG.md b/docs/generated/MCP-CATALOG.md
index 0f2a63cf..74d6af7f 100644
--- a/docs/generated/MCP-CATALOG.md
+++ b/docs/generated/MCP-CATALOG.md
@@ -4,21 +4,21 @@
## Full MSO catalog
-<!-- mcp-toolset: server=1.16.0 version=2026.09.27.1 tools=115 read=58 write=34 exec=23 -->
+<!-- mcp-toolset: server=1.16.0 version=2026.10.09.1 tools=117 read=59 write=35 exec=23 -->
| Fact | Current source value |
|---|---:|
| MCP server | `1.16.0` |
-| Toolset | `2026.09.27.1` |
-| Toolset changed at | `2026-09-27T05:05:41+00:00` |
-| Transport tools | **117** |
-| Model/operator tools | **115** |
-| Read | **58** |
-| Write | **34** |
+| Toolset | `2026.10.09.1` |
+| Toolset changed at | `2026-10-09T14:00:00+00:00` |
+| Transport tools | **119** |
+| Model/operator tools | **117** |
+| Read | **59** |
+| Write | **35** |
| Exec | **23** |
| App-only bridges | **2** |
-### Read (58)
+### Read (59)
- `a2a_agent_discover`
- `a2a_agents_list`
@@ -57,6 +57,7 @@
- `mso_surface_apps_list`
- `organization_chart`
- `project_agent_status`
+- `project_agent_vault_read`
- `project_candidate_search`
- `project_capabilities`
- `project_changes_list`
@@ -79,7 +80,7 @@
- `tool_forge_candidates`
- `vps_status`
-### Write (34)
+### Write (35)
- `a2a_agent_register`
- `a2a_agent_remove`
@@ -104,6 +105,7 @@
- `local_agent_message_send`
- `local_agent_reply`
- `organization_manage`
+- `project_agent_vault_sync`
- `project_asset_attach`
- `project_knowledge_set`
- `project_mcp_manage`
@@ -149,20 +151,20 @@
## ChatGPT model profile
-<!-- mcp-chatgpt-profile: server=1.16.0 version=2026.09.27.1 tools=115 read=58 write=34 exec=23 app-only=2 total=117 -->
+<!-- mcp-chatgpt-profile: server=1.16.0 version=2026.10.09.1 tools=117 read=59 write=35 exec=23 app-only=2 total=119 -->
The ChatGPT profile automatically projects the complete MSO-owned generic model/operator catalog. OAuth scope is still enforced independently; app-only compatibility bridges stay app-only, and project-owned MCP tool names remain dynamic data behind the generic project bridge.
| Fact | Current source value |
|---|---:|
-| ChatGPT transport tools | **117** |
-| ChatGPT model/operator tools | **115** |
-| Read | **58** |
-| Write | **34** |
+| ChatGPT transport tools | **119** |
+| ChatGPT model/operator tools | **117** |
+| Read | **59** |
+| Write | **35** |
| Exec | **23** |
| App-only bridges | **2** |
-### ChatGPT read (58)
+### ChatGPT read (59)
- `a2a_agent_discover`
- `a2a_agents_list`
@@ -201,6 +203,7 @@ The ChatGPT profile automatically projects the complete MSO-owned generic model/
- `mso_surface_apps_list`
- `organization_chart`
- `project_agent_status`
+- `project_agent_vault_read`
- `project_candidate_search`
- `project_capabilities`
- `project_changes_list`
@@ -223,7 +226,7 @@ The ChatGPT profile automatically projects the complete MSO-owned generic model/
- `tool_forge_candidates`
- `vps_status`
-### ChatGPT write (34)
+### ChatGPT write (35)
- `a2a_agent_register`
- `a2a_agent_remove`
@@ -248,6 +251,7 @@ The ChatGPT profile automatically projects the complete MSO-owned generic model/
- `local_agent_message_send`
- `local_agent_reply`
- `organization_manage`
+- `project_agent_vault_sync`
- `project_asset_attach`
- `project_knowledge_set`
- `project_mcp_manage`
diff --git a/frontend/slices/agent-vault/app.tsx b/frontend/slices/agent-vault/app.tsx
new file mode 100644
index 00000000..6587b3ad
--- /dev/null
+++ b/frontend/slices/agent-vault/app.tsx
@@ -0,0 +1,6 @@
+"use client";
+import { AppFrame, type AppProps } from "@/features/appshell";
+import { VaultScreen } from "./components/vault-screen";
+export default function AgentVaultApp(_props: AppProps) {
+ return <AppFrame safeArea={false} className="h-full bg-background" bodyClassName="overflow-hidden"><VaultScreen /></AppFrame>;
+}
diff --git a/frontend/slices/agent-vault/components/note-preview.tsx b/frontend/slices/agent-vault/components/note-preview.tsx
new file mode 100644
index 00000000..27c05ccd
--- /dev/null
+++ b/frontend/slices/agent-vault/components/note-preview.tsx
@@ -0,0 +1,11 @@
+"use client";
+/** Text-only Markdown preview: no HTML, embedded resources or executable links. */
+export function NotePreview({ content }: { content: string }) {
+ const body = content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "");
+ return <div className="space-y-3 text-sm leading-relaxed">{body.split(/\n\s*\n/).map((block, i) => {
+ if (/^# /.test(block)) return <h1 key={i} className="text-xl font-semibold">{block.replace(/^# /, "")}</h1>;
+ if (/^## /.test(block)) return <h2 key={i} className="text-base font-semibold">{block.replace(/^## /, "")}</h2>;
+ if (/^### /.test(block)) return <h3 key={i} className="font-semibold">{block.replace(/^### /, "")}</h3>;
+ return <p key={i} className="whitespace-pre-wrap break-words">{block}</p>;
+ })}</div>;
+}
diff --git a/frontend/slices/agent-vault/components/vault-screen.tsx b/frontend/slices/agent-vault/components/vault-screen.tsx
new file mode 100644
index 00000000..37ab861e
--- /dev/null
+++ b/frontend/slices/agent-vault/components/vault-screen.tsx
@@ -0,0 +1,96 @@
+"use client";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { FolderOpen, RefreshCw } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { openWindow } from "@/features/appshell";
+import type { AgentVaultState, AgentVaultView } from "@/lib/contracts/agent-vault";
+import { NotePreview } from "./note-preview";
+
+const KEY = "mso:agent-vault:project";
+async function request(project: string, options: { sync?: boolean; note?: string; signal?: AbortSignal } = {}): Promise<AgentVaultView> {
+ const params = new URLSearchParams();
+ if (project.trim()) params.set("project", project.trim());
+ if (options.note) params.set("note", options.note);
+ const response = await fetch(`/api/v1/agent-vault?${params}`, options.sync ? {
+ method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(project.trim() ? { project: project.trim() } : {}), signal: options.signal,
+ } : { cache: "no-store", signal: options.signal });
+ const result = await response.json();
+ if (!response.ok) throw new Error(result.error || `Request failed (${response.status})`);
+ return result as AgentVaultView;
+}
+export function VaultScreen() {
+ const [project, setProject] = useState(() => typeof window === "undefined" ? "" : localStorage.getItem(KEY) || "");
+ const [state, setState] = useState<AgentVaultState | null>(null);
+ const [snapshotId, setSnapshotId] = useState("");
+ const [note, setNote] = useState<{ path: string; content: string } | null>(null);
+ const [filter, setFilter] = useState("");
+ const [busy, setBusy] = useState(false), [noteBusy, setNoteBusy] = useState(false), [error, setError] = useState("");
+ const requests = useRef(0), noteRequests = useRef(0);
+ const load = useCallback(async (hint: string, sync = false) => {
+ const token = ++requests.current;
+ ++noteRequests.current;
+ setBusy(true); setError(""); setState(null); setNote(null); setNoteBusy(false);
+ try {
+ const result = await request(hint, { sync });
+ if (token !== requests.current) return;
+ setState(result.state); setSnapshotId(result.state.current || "");
+ setProject(result.state.project.path);
+ localStorage.setItem(KEY, result.state.project.path);
+ } catch (cause) { if (token === requests.current) setError(cause instanceof Error ? cause.message : "Could not load vault"); }
+ finally { if (token === requests.current) setBusy(false); }
+ }, []);
+ useEffect(() => {
+ const controller = new AbortController(), token = ++requests.current;
+ let alive = true;
+ request(localStorage.getItem(KEY) || "", { signal: controller.signal }).then(result => {
+ if (!alive || token !== requests.current) return;
+ setState(result.state); setSnapshotId(result.state.current || ""); setProject(result.state.project.path);
+ }, cause => { if (alive && token === requests.current) setError(cause instanceof Error ? cause.message : "Could not load vault"); });
+ return () => { alive = false; controller.abort(); };
+ }, []);
+ const snapshot = state?.snapshots.find(s => s.id === snapshotId);
+ const notes = useMemo(() => snapshot?.notes.filter(n => `${n.title} ${n.kind} ${n.source}`.toLowerCase().includes(filter.toLowerCase())) || [], [snapshot, filter]);
+ const selected = snapshot?.notes.find(n => n.path === note?.path);
+ async function select(path: string) {
+ if (!state) return;
+ const token = ++noteRequests.current;
+ setNoteBusy(true); setError(""); setNote(null);
+ try { const result = await request(state.project.path, { note: path }); if (token === noteRequests.current) setNote(result.note || null); }
+ catch (cause) { if (token === noteRequests.current) setError(cause instanceof Error ? cause.message : "Could not read note"); }
+ finally { if (token === noteRequests.current) setNoteBusy(false); }
+ }
+ return <div className="flex h-full min-h-0 flex-col">
+ <form className="flex shrink-0 flex-wrap items-center gap-2 border-b p-2" onSubmit={e => { e.preventDefault(); void load(project); }}>
+ <Input aria-label="Repository" placeholder="Repository name, id or path" value={project} onChange={e => setProject(e.target.value)} className="min-w-0 flex-1" />
+ <Button variant="outline" type="submit" disabled={busy}>Load</Button>
+ <Button type="button" disabled={busy} onClick={() => void load(project, true)}><RefreshCw className="mr-1 size-4" />{busy ? "Loading…" : "Refresh snapshot"}</Button>
+ </form>
+ <details className="shrink-0 border-b px-3 py-1 text-xs text-muted-foreground">
+ <summary className="cursor-pointer">Separate Obsidian vault{state ? ` · ${state.project.name}` : ""}{snapshot?.truncated ? " · partial snapshot" : ""}</summary>
+ <p className="py-1">Agent progress from your repository. Refresh captures a snapshot; source notes remain authoritative.</p>
+ {state ? <div className="flex flex-wrap items-center gap-2"><span className="break-all">{state.root}</span><Button size="sm" variant="ghost" disabled={!state.current} onClick={() => openWindow("files-manager", "Agent Vault files", undefined, { path: state.root })}><FolderOpen className="mr-1 size-4" />Files</Button></div> : null}
+ {snapshot?.warnings.length ? <p className="py-1">{snapshot.warnings.join(" · ")}</p> : null}
+ </details>
+ {error ? <p role="alert" className="px-3 py-2 text-sm text-destructive">{error}</p> : null}
+ {state && !state.current ? <p className="p-4 text-sm text-muted-foreground">No snapshot yet. Choose Refresh snapshot to collect repository agent notes, progress summaries and recent commits.</p> : null}
+ {snapshot ? <>
+ <div className="flex shrink-0 flex-wrap items-center gap-2 border-b px-3 py-1">
+ <label className="text-xs" htmlFor="vault-snapshot">Snapshot</label>
+ <select id="vault-snapshot" className="max-w-full rounded border bg-background px-2 py-1 text-xs" value={snapshotId} onChange={e => { ++noteRequests.current; setSnapshotId(e.target.value); setNote(null); setNoteBusy(false); }}>
+ {state?.snapshots.map(s => <option key={s.id} value={s.id}>{new Date(s.capturedAt).toLocaleString()}{s.id === state.current ? " · latest" : ""}</option>)}
+ </select>
+ <span className="text-xs text-muted-foreground">{snapshot.notes.length} notes{snapshot.truncated ? " · partial" : ""}</span>
+ </div>
+ <div className="flex min-h-0 flex-1 flex-col @min-[560px]:flex-row">
+ <aside className="flex max-h-52 min-h-0 flex-col border-b @min-[560px]:max-h-none @min-[560px]:w-64 @min-[560px]:shrink-0 @min-[560px]:border-r @min-[560px]:border-b-0">
+ <div className="p-2"><Input aria-label="Search vault notes" placeholder="Search notes" value={filter} onChange={e => setFilter(e.target.value)} /></div>
+ <div className="min-h-0 flex-1 overflow-auto">{notes.map(n => <button key={n.path} type="button" aria-pressed={note?.path === n.path} className={`block w-full border-b px-3 py-2 text-left text-sm hover:bg-muted ${note?.path === n.path ? "bg-muted" : ""}`} onClick={() => void select(n.path)}><span className="block truncate">{n.title}</span><span className="text-xs text-muted-foreground">{n.kind}</span></button>)}</div>
+ </aside>
+ <article className="min-h-0 min-w-0 flex-1 overflow-auto p-4">
+ {noteBusy ? <p className="text-sm text-muted-foreground">Loading note…</p> : note ? <><p className="mb-4 break-all text-xs text-muted-foreground">Source: {selected?.source}</p><NotePreview content={note.content} /></> : <p className="text-sm text-muted-foreground">Select a note to see agent roles, project updates or recorded progress.</p>}
+ </article>
+ </div>
+ </> : null}
+ </div>;
+}
diff --git a/frontend/slices/agent-vault/index.ts b/frontend/slices/agent-vault/index.ts
new file mode 100644
index 00000000..4beb6434
--- /dev/null
+++ b/frontend/slices/agent-vault/index.ts
@@ -0,0 +1,7 @@
+import { NotebookPen } from "lucide-react";
+import type { AppDescriptor } from "@/features/appshell";
+
+export const agentVaultApp: AppDescriptor = {
+ id: "agent-vault", title: "Agent Vault", icon: NotebookPen, gradient: "var(--primary)",
+ load: () => import("./app"), defaultSize: { w: 1000, h: 700 },
+};
diff --git a/frontend/slices/assistant/host-tools/catalog-agent-vault.ts b/frontend/slices/assistant/host-tools/catalog-agent-vault.ts
new file mode 100644
index 00000000..aaa80305
--- /dev/null
+++ b/frontend/slices/assistant/host-tools/catalog-agent-vault.ts
@@ -0,0 +1,14 @@
+import { clip, obj, str } from "./schema";
+import type { HostTool } from "./types";
+async function call(project: string, sync: boolean, note?: string): Promise<string> {
+ const params = new URLSearchParams({ project });
+ if (note) params.set("note", note);
+ const response = await fetch(`/api/v1/agent-vault?${params}`, sync ? { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ project }) } : { cache: "no-store" });
+ const result = await response.json();
+ if (!response.ok) throw new Error(result.error || "Agent vault request failed");
+ return clip(JSON.stringify(result));
+}
+export const AGENT_VAULT_HOST_TOOLS: HostTool[] = [
+ { name: "project.agent.vault.read", group: "agent", label: "Read agent vault", effect: "read", description: "Read one repository's separate agent-progress vault. Use an exact returned note path to read a snapshot note; no owner recall or raw transcripts.", parameters: obj({ "project!": str("Repository id, name or path"), note: str("Exact note path from the vault") }), run: (_api, a) => call(String(a.project || ""), false, typeof a.note === "string" ? a.note : undefined) },
+ { name: "project.agent.vault.sync", group: "agent", label: "Refresh agent vault", effect: "mutate", description: "Capture a bounded repository agent-progress snapshot in a separate private Obsidian-compatible vault. Preserve existing snapshots and leave repository sources unchanged.", parameters: obj({ "project!": str("Repository id, name or path") }), run: (_api, a) => call(String(a.project || ""), true) },
+];
diff --git a/frontend/slices/assistant/host-tools/catalog.ts b/frontend/slices/assistant/host-tools/catalog.ts
index 06e2487e..17a6a8d8 100644
--- a/frontend/slices/assistant/host-tools/catalog.ts
+++ b/frontend/slices/assistant/host-tools/catalog.ts
@@ -1,3 +1,4 @@
+import { AGENT_VAULT_HOST_TOOLS } from "./catalog-agent-vault";
import { clip, num, obj, str } from "./schema";
import { MUTATE_TOOLS } from "./catalog-mutate";
import { SKILL_TOOLS } from "./catalog-skills";
@@ -203,4 +204,4 @@ const READ_TOOLS: HostTool[] = [
];
// The catalog the rest of the app sees: read tools then mutate tools, one array.
-export const HOST_TOOLS: HostTool[] = [...READ_TOOLS, ...MUTATE_TOOLS];
+export const HOST_TOOLS: HostTool[] = [...READ_TOOLS, ...MUTATE_TOOLS, ...AGENT_VAULT_HOST_TOOLS];
diff --git a/frontend/slices/os-shell/shell.manifest.ts b/frontend/slices/os-shell/shell.manifest.ts
index 911fb763..0a671af6 100644
--- a/frontend/slices/os-shell/shell.manifest.ts
+++ b/frontend/slices/os-shell/shell.manifest.ts
@@ -26,6 +26,7 @@ import { workflowsApp } from "@/features/workflows";
import { n8nApp } from "@/features/n8n";
import { organizationApp } from "@/features/organization";
import { memoryGraphApp } from "@/features/memory-graph";
+import { agentVaultApp } from "@/features/agent-vault";
import { cloudflareApp, dokployApp } from "@/features/infrastructure";
import { themeQuickPickerFeature } from "./theme-quick-picker";
import { serverConnectionStatusFeature } from "./server-connection-status";
@@ -84,6 +85,7 @@ export const BUILTIN_APPS: AppDescriptor[] = [
// only app that explains what they are looking at and how to get their own.
withSlug(withArtwork(docsApp), "docs"),
pin(withSlug(withArtwork(osSettingsApp), "settings")),
+ withSlug(agentVaultApp, "agent-vault"),
withSlug(withArtwork(quicklinksApp), "links"),
withSlug(withArtwork(createAppApp), "create"),
];
diff --git a/lib/agent-vault/service.test.ts b/lib/agent-vault/service.test.ts
new file mode 100644
index 00000000..a07b7f85
--- /dev/null
+++ b/lib/agent-vault/service.test.ts
@@ -0,0 +1,90 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { promises as fs } from "node:fs";
+import os from "node:os";
+import path from "node:path";
+const fixtures = vi.hoisted(() => ({ projects: new Map<string, { id: string; name: string; path: string }>() }));
+vi.mock("@/lib/host/projects-api", () => ({
+ resolveProjectHint: vi.fn(async (hint: string) => fixtures.projects.get(hint) || null),
+ projectGitEdits: vi.fn(async () => ({ edits: [{ sha: "a".repeat(40), shortSha: "aaaaaaa", createdAt: "2026-01-01T00:00:00Z", author: "Fixture agent", subject: "Record verified task" }], pagination: { hasMore: false } })),
+}));
+import { getAgentVault, syncAgentVault } from "./service";
+import { vaultDirectory } from "./store";
+let root: string;
+async function put(relative: string, body: string) {
+ const file = path.join(root, "repos", "one", relative);
+ await fs.mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
+ await fs.writeFile(file, body, { mode: 0o600 });
+}
+beforeEach(async () => {
+ root = await fs.mkdtemp(path.join(os.tmpdir(), "mso-vault-test-"));
+ vi.stubEnv("OS_FS_READ_ROOTS", root); vi.stubEnv("OS_FS_WRITE_ROOTS", path.join(root, "data")); vi.stubEnv("OS_AGENT_VAULT_ROOT", path.join(root, "data"));
+ await fs.mkdir(path.join(root, "data"), { mode: 0o700 });
+ for (const name of ["one", "two"]) {
+ const project = { id: `fixture/${name}`, name: "same-name", path: path.join(root, "repos", name) };
+ await fs.mkdir(project.path, { recursive: true, mode: 0o700 });
+ fixtures.projects.set(name, project);
+ }
+ await put("wiki/agents/worker.md", "---\nid: worker\nstatus: active\n---\n# Worker\n\nTask result from the repository.");
+ await put("wiki/log.md", "# Progress\n\nVerified a task, deployment still unverified.");
+});
+afterEach(async () => { fixtures.projects.clear(); vi.unstubAllEnvs(); await fs.rm(root, { recursive: true, force: true }); });
+describe("separate repository agent vault", () => {
+ it("keeps user data outside source repos, isolates same-name repos and supports read-only discovery", async () => {
+ const before = await fs.readFile(path.join(root, "repos/one/wiki/log.md"), "utf8");
+ const empty = await getAgentVault("one");
+ expect(empty.state.current).toBeNull();
+ expect(await fs.stat(empty.state.root).catch(() => null)).toBeNull();
+ const one = await syncAgentVault("one"), two = await syncAgentVault("two");
+ expect(one.state.root).not.toBe(two.state.root);
+ expect(one.state.root.startsWith(path.join(root, "data"))).toBe(true);
+ expect(one.state.snapshots[0].notes.some(n => n.kind === "agent")).toBe(true);
+ expect(two.state.snapshots[0].notes.some(n => n.kind === "agent")).toBe(false);
+ expect(await fs.readFile(path.join(root, "repos/one/wiki/log.md"), "utf8")).toBe(before);
+ expect((await fs.stat(one.state.root)).mode & 0o777).toBe(0o700);
+ expect((await fs.stat(path.join(one.state.root, "manifest.json"))).mode & 0o777).toBe(0o600);
+ });
+ it("deduplicates unchanged data and preserves earlier snapshots, including user edits", async () => {
+ const first = await syncAgentVault("one"), id = first.state.current!;
+ expect((await syncAgentVault("one")).changed).toBe(false);
+ const old = first.state.snapshots[0].notes.find(n => n.kind === "agent")!;
+ await fs.writeFile(path.join(first.state.root, old.path), "User annotation", { mode: 0o600 });
+ await put("wiki/log.md", "# Progress\n\nSecond task completed.");
+ const next = await syncAgentVault("one");
+ expect(next.state.current).not.toBe(id); expect(next.state.snapshots).toHaveLength(2);
+ expect((await getAgentVault("one", old.path)).note?.content).toBe("User annotation");
+ });
+ it("excludes unrelated private data, adapter configs, transcripts and nested archived deposits; redacts summaries", async () => {
+ await put("wiki/agents/worker.md", "# Worker\n\napi_key=sk_secret12345678\nFinished task.");
+ for (const relative of ["raw/chat.md", "wiki/people/private.md", "adapters/hermes/profile.md", "inbox/hermes/archive/transcript.md"]) await put(relative, "PRIVATE-TRANSCRIPT");
+ const result = await syncAgentVault("one");
+ const texts = await Promise.all(result.state.snapshots[0].notes.map(n => getAgentVault("one", n.path)));
+ const bodies = texts.map(n => n.note?.content).join("\n");
+ expect(bodies).not.toContain("PRIVATE-TRANSCRIPT"); expect(bodies).not.toContain("sk_secret12345678"); expect(bodies).toContain("[redacted]");
+ });
+ it("refuses traversal, cross-repository note reads and symlink source/target escapes", async () => {
+ await fs.symlink(path.join(root, "repos/one/wiki/log.md"), path.join(root, "repos/one/wiki/agents/linked.md"));
+ const one = await syncAgentVault("one"), two = await syncAgentVault("two");
+ expect(one.state.snapshots[0].notes.some(n => n.source.endsWith("linked.md"))).toBe(false);
+ await expect(getAgentVault("one", "../repos/one/wiki/log.md")).rejects.toThrow("not part");
+ await expect(getAgentVault("two", one.state.snapshots[0].notes[0].path)).rejects.toThrow("not part");
+ const selected = two.state.snapshots[0].notes[0];
+ await fs.unlink(path.join(two.state.root, selected.path));
+ await fs.symlink(path.join(root, "repos/one/wiki/log.md"), path.join(two.state.root, selected.path));
+ await expect(getAgentVault("two", selected.path)).rejects.toThrow("symlinks");
+ });
+ it("fails closed on corrupt manifests and on source-overlapping vault storage", async () => {
+ const result = await syncAgentVault("one");
+ await fs.writeFile(path.join(result.state.root, "manifest.json"), "broken-json");
+ await expect(getAgentVault("one")).rejects.toThrow();
+ vi.stubEnv("OS_AGENT_VAULT_ROOT", path.join(root, "repos/one"));
+ expect(() => vaultDirectory(fixtures.projects.get("one")!)).toThrow("outside");
+ vi.stubEnv("OS_AGENT_VAULT_ROOT", path.join(process.cwd(), "user-data"));
+ expect(() => vaultDirectory(fixtures.projects.get("one")!)).toThrow("MSO source checkout");
+ });
+ it("marks oversized sources as partial and does not read them", async () => {
+ await put("wiki/agents/large.md", "x".repeat(50 * 1024));
+ const result = await syncAgentVault("one"), snapshot = result.state.snapshots[0];
+ expect(snapshot.truncated).toBe(true); expect(snapshot.warnings.join(" ")).toContain("oversized");
+ expect(snapshot.notes.some(n => n.source.endsWith("large.md"))).toBe(false);
+ });
+});
diff --git a/lib/agent-vault/service.ts b/lib/agent-vault/service.ts
new file mode 100644
index 00000000..6336b99f
--- /dev/null
+++ b/lib/agent-vault/service.ts
@@ -0,0 +1,67 @@
+import path from "node:path";
+import { redactText } from "@/lib/orchestration/redaction";
+import { withSecurityStoreLock } from "@/lib/security-store-lock";
+import { makeDir } from "@/lib/host/fs";
+import { resolveReadable } from "@/lib/host/paths";
+import { resolveProjectHint } from "@/lib/host/projects-api";
+import type { AgentVaultView, AgentVaultNote, AgentVaultSnapshot } from "@/lib/contracts/agent-vault";
+import { collectVaultSources, type VaultSource } from "./sources";
+import { digest, emptyState, loadVaultState, readVaultNote, writeVaultArtifact } from "./store";
+
+const active = new Set<string>();
+async function projectFor(hint?: string) {
+ const selected = hint?.trim() || process.env.OS_AGENT_VAULT_PROJECT?.trim() || "";
+ if (!selected || selected.length > 500) throw new Error("Select a repository id, name or path");
+ const project = await resolveProjectHint(selected);
+ if (!project) throw new Error("Repository not found within configured project roots");
+ return { id: project.id, name: project.name, path: project.path };
+}
+export async function getAgentVault(project?: string, note?: string): Promise<AgentVaultView> {
+ const state = await loadVaultState(await projectFor(project));
+ return { state, ...(note ? { note: { path: note, content: await readVaultNote(state, note) } } : {}) };
+}
+function noteBody(source: VaultSource, project: string, sources: VaultSource[]): string {
+ const targets = new Map(sources.map(s => [s.source, s.key]));
+ const content = source.content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (original, label: string, href: string) => {
+ if (/^(?:[a-z]+:|\/|#)/i.test(href)) return original;
+ const [file, anchor] = href.split("#");
+ if (!file.endsWith(".md")) return original;
+ const target = targets.get(path.posix.normalize(path.posix.join(path.posix.dirname(source.source), file)));
+ return target ? `[${label}](${path.posix.relative(path.posix.dirname(source.key), target)}${anchor ? `#${anchor}` : ""})` : `${label} (source: ${href})`;
+ });
+ return `---\ntype: ${source.kind}\nsource: ${JSON.stringify(redactText(source.source, 400))}\nrepository: ${JSON.stringify(project)}\ngenerated: true\n---\n\n> Repository projection. The source remains authoritative; this snapshot is not live agent status.\n\n${content}\n`;
+}
+export async function syncAgentVault(hint?: string): Promise<AgentVaultView & { changed: boolean }> {
+ const project = await projectFor(hint);
+ if (active.has(project.id)) throw new Error("This repository vault is already refreshing");
+ if (active.size >= 2) throw new Error("Vault refresh capacity reached");
+ active.add(project.id);
+ try {
+ const root = emptyState(project).root;
+ await makeDir(root);
+ if (await resolveReadable(root) !== root) throw new Error("Vault symlinks are not supported");
+ return await withSecurityStoreLock(path.join(root, "manifest.json"), async () => {
+ const state = await loadVaultState(project);
+ const collected = await collectVaultSources(project);
+ const id = digest(JSON.stringify({ formatVersion: 1, ...collected }));
+ const now = new Date().toISOString();
+ if (state.current === id) return { state, changed: false };
+ const existing = state.snapshots.find(s => s.id === id);
+ if (!existing && state.snapshots.length >= 20) throw new Error("Vault has 20 snapshots. Archive this vault and configure a new data directory before refreshing");
+ let snapshot: AgentVaultSnapshot;
+ if (existing) snapshot = existing;
+ else {
+ const notes: AgentVaultNote[] = collected.sources.map(s => ({ path: `Snapshots/${id}/${s.key}`, title: s.title, kind: s.kind, source: redactText(s.source, 400) }));
+ const overview = `# ${project.name} — Agent progress\n\nSource repository: ${project.path}\n\nCaptured: ${now}\n\n## Notes\n\n${notes.map(n => `- [[${n.path.replace(/\.md$/, "")}|${n.title.replace(/[\[\]|]/g, "")}]] · ${n.kind}`).join("\n")}\n\n## Collection limits\n\n${collected.warnings.join("\n\n") || "No collection warnings."}\n\n${collected.truncated ? "Partial snapshot: some sources exceeded collection limits." : "Within the configured collection limits."}\n`;
+ for (const source of collected.sources) await writeVaultArtifact(state.root, `Snapshots/${id}/${source.key}`, noteBody(source, project.path, collected.sources));
+ const overviewPath = `Snapshots/${id}/overview/Beranda.md`;
+ await writeVaultArtifact(state.root, overviewPath, overview);
+ notes.unshift({ path: overviewPath, title: "Agent progress", kind: "overview", source: "generated" });
+ snapshot = { id, capturedAt: now, notes, warnings: collected.warnings, truncated: collected.truncated };
+ }
+ const next = { ...state, current: id, refreshedAt: now, snapshots: [snapshot, ...state.snapshots.filter(s => s.id !== id)] };
+ await writeVaultArtifact(state.root, "manifest.json", `${JSON.stringify(next, null, 2)}\n`);
+ return { state: next, changed: true };
+ });
+ } finally { active.delete(project.id); }
+}
diff --git a/lib/agent-vault/sources.ts b/lib/agent-vault/sources.ts
new file mode 100644
index 00000000..2eab3776
--- /dev/null
+++ b/lib/agent-vault/sources.ts
@@ -0,0 +1,67 @@
+import path from "node:path";
+import { promises as fs } from "node:fs";
+import { createHash } from "node:crypto";
+import { readBoundedRegularFile } from "@/lib/host/bounded-read";
+import { resolveReadable } from "@/lib/host/paths";
+import { projectGitEdits } from "@/lib/host/projects-api";
+import { listRepoMemoryRecords } from "@/lib/orchestration/repo-memory";
+import { redactText } from "@/lib/orchestration/redaction";
+import type { AgentVaultKind } from "@/lib/contracts/agent-vault";
+
+export interface VaultSource { key: string; title: string; kind: AgentVaultKind; source: string; content: string }
+const MAX_FILES = 80, MAX_ENTRIES = 600, MAX_BYTES = 48 * 1024;
+const GROUPS: Record<string, AgentVaultKind> = { "wiki/agents": "agent", "wiki/projects": "project", "inbox/mso": "inbox", "inbox/hermes": "inbox", "inbox/gpt": "inbox", "inbox/grokbot": "inbox" };
+const hash = (s: string) => createHash("sha256").update(s).digest("hex").slice(0, 12);
+export function sourceNote(source: string, kind: AgentVaultKind, body: string): VaultSource {
+ const title = redactText(body.match(/^#\s+(.+)$/m)?.[1] ?? path.basename(source, ".md"), 100);
+ const slug = redactText(path.basename(source, ".md"), 100).replace(/[^a-zA-Z0-9_-]/g, "-").slice(0, 60) || "note";
+ return { key: `${kind}/${slug}-${hash(source)}.md`, title, kind, source, content: redactText(body, 32_000) };
+}
+
+export async function collectVaultSources(project: { path: string; name: string }) {
+ const sources: VaultSource[] = [], warnings: string[] = [];
+ let truncated = false, entriesSeen = 0;
+ async function read(relative: string, kind: AgentVaultKind) {
+ if (sources.length >= MAX_FILES) { truncated = true; return; }
+ const file = path.join(project.path, relative);
+ const stat = await fs.lstat(file).catch(() => null);
+ if (!stat) return;
+ if (!stat.isFile() || stat.isSymbolicLink()) { warnings.push(`Skipped non-regular source: ${relative}`); return; }
+ const readable = await resolveReadable(file);
+ if (readable !== file) { warnings.push(`Skipped linked source: ${relative}`); return; }
+ const body = await readBoundedRegularFile(file, MAX_BYTES);
+ if (body === null) { truncated = true; warnings.push(`Skipped oversized or unreadable source: ${relative}`); return; }
+ if (body.length > 32_000) truncated = true;
+ sources.push(sourceNote(relative, kind, body));
+ }
+ for (const relative of ["wiki/log.md", "docs/PROGRESS.md"]) await read(relative, "progress");
+ for (const [relative, kind] of Object.entries(GROUPS)) {
+ const dir = path.join(project.path, relative);
+ const canonical = await resolveReadable(dir).catch(() => null);
+ if (canonical !== dir) continue;
+ const handle = await fs.opendir(dir).catch(() => null);
+ if (!handle) continue;
+ const names: string[] = [];
+ for await (const entry of handle) {
+ if (++entriesSeen > MAX_ENTRIES) { truncated = true; break; }
+ if (entry.isFile() && !entry.isSymbolicLink() && entry.name.endsWith(".md")) names.push(entry.name);
+ }
+ for (const name of names.sort()) await read(`${relative}/${name}`, kind);
+ if (entriesSeen > MAX_ENTRIES) break;
+ }
+ try {
+ const records = await listRepoMemoryRecords(project.path, { includeHistory: true, limit: 41 });
+ if (records.length > 40) truncated = true;
+ for (const record of records.slice(0, 40)) {
+ const body = `# ${record.title}\n\nUpdated: ${record.updatedAt}\n\nKind: ${record.kind} · Status: ${record.status} · Result: ${record.result ?? "unknown"}\n\n${record.summary}`;
+ sources.push(sourceNote(`.agent/memory/${record.kind}/${record.id}`, "memory", body));
+ }
+ } catch { warnings.push("Repository memory unavailable"); truncated = true; }
+ try {
+ const { edits, pagination } = await projectGitEdits(project.path, { limit: 20 });
+ const body = `# Repository changes\n\nThese are repository commits, not proof that an agent is running or a deployment is healthy.\n\n${edits.map(e => `- ${e.createdAt} · ${e.shortSha} · ${redactText(e.author, 100)} — ${redactText(e.subject, 500)}`).join("\n")}`;
+ sources.push(sourceNote("git:recent-commits", "progress", body));
+ if (pagination.hasMore) warnings.push("Commit history shows the latest 20 commits");
+ } catch { warnings.push("Git history unavailable"); truncated = true; }
+ return { sources: sources.sort((a, b) => a.key.localeCompare(b.key)), warnings, truncated };
+}
diff --git a/lib/agent-vault/store.ts b/lib/agent-vault/store.ts
new file mode 100644
index 00000000..5167cccc
--- /dev/null
+++ b/lib/agent-vault/store.ts
@@ -0,0 +1,57 @@
+import path from "node:path";
+import { promises as fs } from "node:fs";
+import { createHash } from "node:crypto";
+import { appDir, homeDir, isUnderRoot, resolveReadable } from "@/lib/host/paths";
+import { makeDir, writeFile } from "@/lib/host/fs";
+import { readBoundedRegularFile } from "@/lib/host/bounded-read";
+import type { AgentVaultState } from "@/lib/contracts/agent-vault";
+
+export const digest = (value: string) => createHash("sha256").update(value).digest("hex").slice(0, 20);
+const MAX_MANIFEST = 1024 * 1024;
+export function vaultDirectory(project: AgentVaultState["project"]): string {
+ const configured = process.env.OS_AGENT_VAULT_ROOT?.trim();
+ const base = configured?.startsWith("~/") ? path.join(homeDir(), configured.slice(2)) : configured || path.join(homeDir(), "mso-vaults");
+ const slug = project.name.replace(/[^a-zA-Z0-9_-]/g, "-").slice(0, 60) || "project";
+ const root = path.resolve(base, `${slug}-${digest(project.id)}`);
+ if (isUnderRoot(root, project.path) || isUnderRoot(project.path, root)) throw new Error("Vault data must be outside the source repository");
+ if (isUnderRoot(root, appDir())) throw new Error("Vault user data must be outside the MSO source checkout");
+ return root;
+}
+export function emptyState(project: AgentVaultState["project"]): AgentVaultState {
+ return { schemaVersion: 1, project, root: vaultDirectory(project), current: null, snapshots: [], refreshedAt: null };
+}
+async function exactReadable(file: string): Promise<string> {
+ const real = await resolveReadable(file);
+ if (real !== path.resolve(file)) throw new Error("Vault symlinks are not supported");
+ return real;
+}
+export async function loadVaultState(project: AgentVaultState["project"]): Promise<AgentVaultState> {
+ const empty = emptyState(project), file = path.join(empty.root, "manifest.json");
+ const stat = await fs.lstat(file).catch(() => null);
+ if (!stat) return empty;
+ const body = await readBoundedRegularFile(await exactReadable(file), MAX_MANIFEST);
+ if (body === null) throw new Error("Vault manifest is unreadable or oversized");
+ const state = JSON.parse(body) as AgentVaultState;
+ if (state.schemaVersion !== 1 || state.project?.id !== project.id || state.root !== empty.root || !Array.isArray(state.snapshots) || state.snapshots.length > 20) throw new Error("Invalid vault manifest");
+ for (const snapshot of state.snapshots) {
+ if (!/^[a-f0-9]{20}$/.test(snapshot.id) || !Array.isArray(snapshot.notes) || snapshot.notes.length > 125 || !Array.isArray(snapshot.warnings)) throw new Error("Invalid vault snapshot");
+ for (const note of snapshot.notes) {
+ if (typeof note.path !== "string" || !note.path.startsWith(`Snapshots/${snapshot.id}/`) || !/^Snapshots\/[a-f0-9]{20}\/(?:overview|agent|project|progress|inbox|memory)\/[a-zA-Z0-9_-]+\.md$/.test(note.path)) throw new Error("Invalid vault note path");
+ }
+ }
+ return state;
+}
+export async function readVaultNote(state: AgentVaultState, note: string): Promise<string> {
+ if (!state.snapshots.some(s => s.notes.some(n => n.path === note))) throw new Error("Note is not part of this repository vault");
+ const file = path.join(state.root, note);
+ const body = await readBoundedRegularFile(await exactReadable(file), 64 * 1024);
+ if (body === null) throw new Error("Vault note is unreadable or oversized");
+ return body;
+}
+export async function writeVaultArtifact(root: string, relative: string, body: string): Promise<void> {
+ const file = path.join(root, relative);
+ if (!isUnderRoot(file, root) || file === root || Buffer.byteLength(body) > 1024 * 1024) throw new Error("Invalid vault artifact");
+ await makeDir(path.dirname(file));
+ await exactReadable(path.dirname(file));
+ await writeFile(file, body);
+}
diff --git a/lib/contracts/agent-vault.ts b/lib/contracts/agent-vault.ts
new file mode 100644
index 00000000..045a98cc
--- /dev/null
+++ b/lib/contracts/agent-vault.ts
@@ -0,0 +1,27 @@
+/** Portable data contract; repository identities and note bodies are installation data. */
+export type AgentVaultKind = "overview" | "agent" | "project" | "progress" | "inbox" | "memory";
+export interface AgentVaultNote {
+ path: string;
+ title: string;
+ kind: AgentVaultKind;
+ source: string;
+}
+export interface AgentVaultSnapshot {
+ id: string;
+ capturedAt: string;
+ notes: AgentVaultNote[];
+ warnings: string[];
+ truncated: boolean;
+}
+export interface AgentVaultState {
+ schemaVersion: 1;
+ project: { id: string; name: string; path: string };
+ root: string;
+ current: string | null;
+ snapshots: AgentVaultSnapshot[];
+ refreshedAt: string | null;
+}
+export interface AgentVaultView {
+ state: AgentVaultState;
+ note?: { path: string; content: string };
+}
diff --git a/lib/host/agent-vault-api.ts b/lib/host/agent-vault-api.ts
new file mode 100644
index 00000000..33ca6c19
--- /dev/null
+++ b/lib/host/agent-vault-api.ts
@@ -0,0 +1,2 @@
+/** One guarded domain implementation for web, MCP and CLI adapters. */
+export { getAgentVault, syncAgentVault } from "@/lib/agent-vault/service";
diff --git a/lib/mcp/parity.test.ts b/lib/mcp/parity.test.ts
index eba0b040..4f9c39b8 100644
--- a/lib/mcp/parity.test.ts
+++ b/lib/mcp/parity.test.ts
@@ -226,6 +226,8 @@ describe("MCP rate limits mirror the routes", () => {
"project.knowledge": 30,
"organization.read": 60,
"organization.write": 40,
+ "agent.vault.read": 60,
+ "agent.vault.sync": 10,
};
for (const t of TOOLS) {
if (!t.limit) continue;
diff --git a/lib/mcp/tool-contract.ts b/lib/mcp/tool-contract.ts
index 8aa8fd07..7a07e6d2 100644
--- a/lib/mcp/tool-contract.ts
+++ b/lib/mcp/tool-contract.ts
@@ -135,7 +135,7 @@ export function toolDescriptor(tool: McpTool, profile: McpToolProfile = "full")
return {
name: tool.name,
title: tool.title ?? toolTitle(tool.name),
- description: compact ? compactText(tool.chatgptDescription ?? tool.description, 48) : tool.description,
+ description: compact ? compactText(tool.chatgptDescription ?? tool.description, 36) : tool.description,
inputSchema: compact ? compactSchema(tool.inputSchema) : tool.inputSchema,
...(outputSchema ? { outputSchema: compact ? compactSchema(outputSchema) : outputSchema } : {}),
securitySchemes,
diff --git a/lib/mcp/tools-agent-vault.test.ts b/lib/mcp/tools-agent-vault.test.ts
new file mode 100644
index 00000000..1b4f7d53
--- /dev/null
+++ b/lib/mcp/tools-agent-vault.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it, vi } from "vitest";
+const mocks = vi.hoisted(() => ({ get: vi.fn(), sync: vi.fn() }));
+vi.mock("@/lib/host/agent-vault-api", () => ({ getAgentVault: mocks.get, syncAgentVault: mocks.sync }));
+import { AGENT_VAULT_TOOLS } from "./tools-agent-vault";
+import { allows } from "./scope";
+describe("agent vault capability contract", () => {
+ it("separates read and write scope and delegates both to the shared host facade", async () => {
+ const [read, sync] = AGENT_VAULT_TOOLS;
+ expect(read.scope).toBe("read"); expect(allows("read", sync.scope)).toBe(false);
+ expect(sync.audit).toEqual({ action: "fs.write", targetArg: "project" });
+ expect(sync.limit?.max).toBe(10); expect(sync.inputSchema.required).toContain("project");
+ await read.run({ project: "fixture", note: "Snapshots/fixture.md" }, { scope: "read" });
+ expect(mocks.get).toHaveBeenCalledWith("fixture", "Snapshots/fixture.md");
+ await sync.run({ project: "fixture" }, { scope: "write" }); expect(mocks.sync).toHaveBeenCalledWith("fixture");
+ });
+});
diff --git a/lib/mcp/tools-agent-vault.ts b/lib/mcp/tools-agent-vault.ts
new file mode 100644
index 00000000..2b2e54de
--- /dev/null
+++ b/lib/mcp/tools-agent-vault.ts
@@ -0,0 +1,23 @@
+import { getAgentVault, syncAgentVault } from "@/lib/host/agent-vault-api";
+import { opt, S, str, type McpTool } from "./tool-kit";
+export const AGENT_VAULT_TOOLS: McpTool[] = [
+ {
+ name: "project_agent_vault_read", scope: "read",
+ chatgptDescription: "Read repository vault snapshots/notes.",
+ description: "Read one repository's separate Obsidian-compatible agent-progress vault, snapshots and note metadata. Optional note must be an exact path returned by this tool. No refresh, raw transcripts or owner recall.",
+ annotations: { readOnlyHint: true, idempotentHint: true },
+ limit: { key: "agent.vault.read", max: 60, windowMs: 60_000 },
+ inputSchema: S({ project: { type: "string", maxLength: 500 }, note: { type: "string", maxLength: 300 } }, ["project"]),
+ run: a => getAgentVault(str(a, "project"), opt(a, "note")),
+ },
+ {
+ name: "project_agent_vault_sync", scope: "write",
+ chatgptDescription: "Refresh repository vault snapshots.",
+ description: "Capture a bounded agent-progress snapshot from one selected repository into its separate private Markdown vault. Sources: wiki agent/project pages, top-level platform inbox summaries, progress log, compact .agent memory, latest 20 commits. Preserves previous snapshots; does not edit the source repository or run agents.",
+ annotations: { idempotentHint: true },
+ audit: { action: "fs.write", targetArg: "project" },
+ limit: { key: "agent.vault.sync", max: 10, windowMs: 60_000 },
+ inputSchema: S({ project: { type: "string", maxLength: 500 } }, ["project"]),
+ run: a => syncAgentVault(str(a, "project")),
+ },
+];
diff --git a/lib/mcp/tools.ts b/lib/mcp/tools.ts
index 899cf466..5ba3b6f4 100644
--- a/lib/mcp/tools.ts
+++ b/lib/mcp/tools.ts
@@ -1,3 +1,4 @@
+import { AGENT_VAULT_TOOLS } from "./tools-agent-vault";
import { AGENT_OPEN_TOOLS } from "./tools-agent-open";
import { PROJECT_ASSET_TOOLS } from "./tools-project-assets";
import { PROJECT_MCP_MANAGE_TOOLS } from "./tools-project-mcp-manage";
@@ -27,4 +28,4 @@ import { BLOCK_TOOLS, LIST_TOOLS, NATIVE_UI_PROBE_TOOLS, SURFACE_TOOLS } from ".
import type { McpTool } from "./tool-kit";
import { MUTATE_TOOLS } from "./tools-mutate";
-export const TOOLS: McpTool[] = [...FLOW_TOOLS, ...AGENT_OPEN_TOOLS, ...PROJECT_ASSET_TOOLS, ...PROJECT_MCP_MANAGE_TOOLS, ...SESSION_ARTIFACT_TOOLS, ...READ_TOOLS, ...FILE_TRANSFER_READ_TOOLS, ...DISCOVERY_TOOLS, ...LEARNING_TOOLS, ...JEV_TOOLS, ...AGENT_TOOLS, ...LOCAL_AGENT_TOOLS, ...SUBAGENT_TOOLS, ...A2A_TOOLS, ...FORGE_TOOLS, ...READ_PIPELINE_TOOLS, ...PROJECT_MCP_TOOLS, ...PROJECT_EXPERIENCE_TOOLS, ...ORGANIZATION_TOOLS, ...OPERATOR_DASHBOARD_TOOLS, ...NATIVE_UI_PROBE_TOOLS, ...BLOCK_TOOLS, ...LIST_TOOLS, ...SURFACE_TOOLS, ...INFRA_TOOLS, ...INTEGRATION_TOOLS, ...MUTATE_TOOLS, ...POWER_TOOLS].map(withWorkflowContext); export const TOOLS_BY_NAME = new Map(TOOLS.map((t) => [t.name, t]));
+export const TOOLS: McpTool[] = [...AGENT_VAULT_TOOLS, ...FLOW_TOOLS, ...AGENT_OPEN_TOOLS, ...PROJECT_ASSET_TOOLS, ...PROJECT_MCP_MANAGE_TOOLS, ...SESSION_ARTIFACT_TOOLS, ...READ_TOOLS, ...FILE_TRANSFER_READ_TOOLS, ...DISCOVERY_TOOLS, ...LEARNING_TOOLS, ...JEV_TOOLS, ...AGENT_TOOLS, ...LOCAL_AGENT_TOOLS, ...SUBAGENT_TOOLS, ...A2A_TOOLS, ...FORGE_TOOLS, ...READ_PIPELINE_TOOLS, ...PROJECT_MCP_TOOLS, ...PROJECT_EXPERIENCE_TOOLS, ...ORGANIZATION_TOOLS, ...OPERATOR_DASHBOARD_TOOLS, ...NATIVE_UI_PROBE_TOOLS, ...BLOCK_TOOLS, ...LIST_TOOLS, ...SURFACE_TOOLS, ...INFRA_TOOLS, ...INTEGRATION_TOOLS, ...MUTATE_TOOLS, ...POWER_TOOLS].map(withWorkflowContext); export const TOOLS_BY_NAME = new Map(TOOLS.map((t) => [t.name, t]));
diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.ts
index a41c3582..225bf33b 100644
--- a/lib/mcp/toolset.ts
+++ b/lib/mcp/toolset.ts
@@ -4,8 +4,8 @@ import type { McpTool } from "./tool-kit";
import { toolDescriptor, type McpToolProfile } from "./tool-contract";
export const MCP_SERVER_VERSION = "1.16.0";
-export const MCP_TOOLSET_VERSION = "2026.09.27.1";
-export const MCP_TOOLSET_CHANGED_AT = "2026-09-27T05:05:41+00:00";
+export const MCP_TOOLSET_VERSION = "2026.10.09.1";
+export const MCP_TOOLSET_CHANGED_AT = "2026-10-09T14:00:00+00:00";
export type McpToolsetInfo = {
serverVersion: string;
diff --git a/scripts/cli/commands-state.sh b/scripts/cli/commands-state.sh
index 75585c6f..0131f87f 100755
--- a/scripts/cli/commands-state.sh
+++ b/scripts/cli/commands-state.sh
@@ -184,6 +184,13 @@ case "$cmd" in
rm) jdel "/api/memory?id=$(enc "${2:?id}")" ;;
*) die "usage: mso $U_memory" ;;
esac ;;
+ agent-vault)
+ case "${1:-show}" in
+ show) jget "/api/v1/agent-vault${2:+?project=$(enc "$2")}" ;;
+ sync) jpost "/api/v1/agent-vault" "$(jq -n --arg p "${2:-}" 'if $p == "" then {} else {project:$p} end')" ;;
+ read) jget "/api/v1/agent-vault?project=$(enc "${2:?project}")&note=$(enc "${3:?note-path}")" ;;
+ *) die "usage: mso $U_agent_vault" ;;
+ esac ;;
memory-graph)
if [ -n "${1-}" ]; then jget "/api/v1/memory-graph?project=$(enc "$1")";
else jget "/api/v1/memory-graph"; fi ;;
diff --git a/scripts/cli/commands.sh b/scripts/cli/commands.sh
index 0254de41..865d6848 100755
--- a/scripts/cli/commands.sh
+++ b/scripts/cli/commands.sh
@@ -47,6 +47,7 @@ U_org="org flow-custom-nodes|flow-nodes-move|flow-update|flow-replace|flow-node-
U_a2a="a2a list|state|sessions|spawn <source-session> <objective> [title]|inbox <session>|discover <url>|add <url> [alias]|rm <target>|send <target> <message> [--wait]|stream <target> <message>|task <target> <taskId> [history]|cancel <target> <taskId>|handoff <target> <objective> [context] [--wait]|local sessions|local handoff <session> <objective>|local spawn <sourceSession> <objective> [title]|local inbox <session>|trace <start|progress|plan|action|evidence|blocker|result|handoff|status|context|attach|finish|cancel|list> [...]|auth list [target]|auth add <target> [label] [bearer|api-key|oauth2]|auth use <target> <credentialId|none>|auth rm <credentialId>|inbound list|inbound create [label] [read|write|exec]|inbound rm <tokenId>"
U_memory="memory list|add <text>|rm <id>"
U_memory_graph="memory-graph [project]"
+U_agent_vault="agent-vault show|sync [project]|read <project> <note-path>"
U_config="config show|set <json>|key <provider>|style <off|caveman|ponytail>|rm <provider>"
U_prefs="prefs show|set <json>"
U_federation="federation status"
@@ -102,7 +103,7 @@ mso_cli_main() {
mso_cmd_host "$cmd" "$@" ;;
agent|chat|model|setup|onboard|provider|providers|integrations|channels|flow|workflow|gateway|heartbeat|web|camoufox|apps|mapp|term)
mso_cmd_runtime "$cmd" "$@" ;;
- ai|cockpit|threads|agent-sessions|agents|org|a2a|memory|memory-graph|config|prefs|federation|models|jev|skills|changelog|stock)
+ ai|cockpit|threads|agent-sessions|agents|org|a2a|memory|memory-graph|agent-vault|config|prefs|federation|models|jev|skills|changelog|stock)
mso_cmd_state "$cmd" "$@" ;;
devices|device|approve|revoke|oauth|mcp|audit|whoami|login|logout|service|build|deploy|update|reset|uninstall|crud|api|completion)
mso_cmd_admin "$cmd" "$@" ;;
diff --git a/scripts/e2e/agent-vault.mjs b/scripts/e2e/agent-vault.mjs
new file mode 100644
index 00000000..6852c1f0
--- /dev/null
+++ b/scripts/e2e/agent-vault.mjs
@@ -0,0 +1,46 @@
+import { expect } from "@playwright/test";
+import { readFile, writeFile } from "node:fs/promises";
+import path from "node:path";
+
+export async function agentVaultJourney(page, fixture) {
+ await page.goto(fixture.base + "/agent-vault");
+ await expect(page.getByLabel("Repository", { exact: true })).toHaveValue(fixture.vaultProject);
+ await page.getByRole("button", { name: "Refresh snapshot", exact: true }).click();
+ await expect(page.getByLabel("Snapshot", { exact: true })).toBeVisible();
+ await page.getByRole("button", { name: /^Fixture worker/ }).click();
+ await expect(page.getByRole("heading", { name: "Fixture worker", exact: true })).toBeVisible();
+ await expect(page.getByText("Responsible for verifying fixture tasks.", { exact: true })).toBeVisible();
+ const state = await page.evaluate(async () => (await (await fetch("/api/v1/agent-vault")).json()).state);
+ expect(state.root.startsWith(path.join(fixture.dir, "vault-data"))).toBe(true);
+ expect(state.root.startsWith(fixture.vaultProject + path.sep)).toBe(false);
+ const previous = state.current;
+ await writeFile(path.join(fixture.vaultProject, "wiki/log.md"), "# Fixture progress\n\nSecond verified repository update.\n", { mode: 0o600 });
+ await page.getByRole("button", { name: "Refresh snapshot", exact: true }).click();
+ await expect(page.getByLabel("Snapshot", { exact: true }).locator("option")).toHaveCount(2);
+ await page.getByRole("button", { name: /^Fixture progress/ }).click();
+ await expect(page.getByText("Second verified repository update.", { exact: true })).toBeVisible();
+ await page.getByLabel("Snapshot", { exact: true }).selectOption(previous);
+ await page.getByRole("button", { name: /^Fixture progress/ }).click();
+ await expect(page.getByText("First verified repository update.", { exact: true })).toBeVisible();
+ expect(await readFile(path.join(fixture.vaultProject, "wiki/log.md"), "utf8")).toContain("Second verified");
+ await page.getByLabel("Search vault notes", { exact: true }).fill("worker");
+ await expect(page.getByRole("button", { name: /^Fixture worker/ })).toBeVisible();
+ await expect(page.getByRole("button", { name: /^Fixture progress/ })).toHaveCount(0);
+ await page.getByLabel("Search vault notes", { exact: true }).fill("");
+ for (const viewport of [{ width: 390, height: 844 }, { width: 844, height: 390 }]) {
+ await page.setViewportSize(viewport);
+ await page.goto(fixture.base + "/agent-vault");
+ await expect(page.getByRole("button", { name: /^Fixture worker/ })).toBeVisible();
+ await page.getByRole("button", { name: /^Fixture worker/ }).click();
+ await expect(page.getByRole("heading", { name: "Fixture worker", exact: true })).toBeVisible();
+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1)).toBe(true);
+ }
+ await fixture.setRole("viewer");
+ const denied = await page.evaluate(async () => {
+ const read = await fetch("/api/v1/agent-vault"), sync = await fetch("/api/v1/agent-vault", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
+ return [read.status, sync.status];
+ });
+ expect(denied).toEqual([403, 403]);
+ await fixture.setRole("owner");
+ await page.setViewportSize({ width: 1280, height: 900 });
+}
diff --git a/scripts/e2e/release-fixture.mjs b/scripts/e2e/release-fixture.mjs
index ebf87a6f..7dd48a59 100644
--- a/scripts/e2e/release-fixture.mjs
+++ b/scripts/e2e/release-fixture.mjs
@@ -34,6 +34,9 @@ export async function releaseFixture({ live = false, surfaceApps = [] } = {}) {
const fixtureProject = path.join(dir, "projects", "fixture-project");
await mkdir(fixtureProject, { recursive: true });
await writeFile(path.join(fixtureProject, "package.json"), JSON.stringify({ name: "fixture-project", version: "1.0.0", private: true }), { mode: 0o600 });
+ await mkdir(path.join(fixtureProject, "wiki", "agents"), { recursive: true, mode: 0o700 });
+ await writeFile(path.join(fixtureProject, "wiki", "agents", "worker.md"), "# Fixture worker\n\nResponsible for verifying fixture tasks.\n", { mode: 0o600 });
+ await writeFile(path.join(fixtureProject, "wiki", "log.md"), "# Fixture progress\n\nFirst verified repository update.\n", { mode: 0o600 });
await writeFile(path.join(dir, "infra.json"), JSON.stringify({
version: 2, instanceId: randomUUID(), defaultUser: "fixture", bindings: [],
users: { fixture: { id: "fixture", uid: randomUUID(), label: "Release fixture", defaults: { convex: "local" },
@@ -54,6 +57,7 @@ export async function releaseFixture({ live = false, surfaceApps = [] } = {}) {
OS_CONFIG_STORE: path.join(dir, "config.json"), OS_PREFS_PATH: path.join(dir, "prefs.json"),
OS_AUDIT_LOG: path.join(dir, "audit.jsonl"), OS_LOGIN_PASSWORD: password,
OS_SESSION_SECRET: randomBytes(32).toString("hex"), OS_FS_READ_ROOTS: dir, OS_FS_WRITE_ROOTS: dir,
+ OS_AGENT_VAULT_ROOT: path.join(dir, "vault-data"), OS_AGENT_VAULT_PROJECT: fixtureProject,
MSO_SKILL_INSTALL_ROOT: path.join(dir, "skills"), OS_MCP_ENABLED: "1", NEXT_PUBLIC_OS_DEMO: "0", NEXT_TELEMETRY_DISABLED: "1",
});
const mcpToken = randomBytes(32).toString("hex");
@@ -92,6 +96,6 @@ export async function releaseFixture({ live = false, surfaceApps = [] } = {}) {
const setAiConfig = async config => {
await writeFile(env.OS_CONFIG_STORE, JSON.stringify(config, null, 2), { mode: 0o600 });
};
- return { dir, base, device, password, setRole, seedMcp, mcpToken, setAiConfig, seedSessions: () => seedSessionMonitor(env), revokeProvider: () => { providerStatus = 401; }, close };
+ return { dir, base, device, password, vaultProject: fixtureProject, setRole, seedMcp, mcpToken, setAiConfig, seedSessions: () => seedSessionMonitor(env), revokeProvider: () => { providerStatus = 401; }, close };
} catch (error) { await close(); throw error; }
}
diff --git a/scripts/e2e/release.mjs b/scripts/e2e/release.mjs
index 444c88d4..4d667a20 100644
--- a/scripts/e2e/release.mjs
+++ b/scripts/e2e/release.mjs
@@ -6,6 +6,7 @@ import AxeBuilder from "@axe-core/playwright";
import { mcpOwnerJourneys, mcpPublicJourney, oauthRegistrationJourney, settingsAccessibilityJourney } from "./mcp-settings.mjs";
import { automationJourney } from "./automation.mjs";
import { organizationJourney } from "./organization.mjs";
+import { agentVaultJourney } from "./agent-vault.mjs";
import { workflowCanvasJourney } from "./workflow-canvas.mjs";
import { storeExtensionsJourney } from "./store-extensions.mjs";
import { releaseFixture } from "./release-fixture.mjs";
@@ -93,6 +94,8 @@ try {
await page.locator('input[type="password"]').fill(fixture.password);
await page.getByRole("button", { name: "Unlock", exact: true }).click();
await expect(page).toHaveURL(fixture.base + "/integrations");
+ await agentVaultJourney(page, fixture);
+ await page.goto(fixture.base + "/integrations");
await shellNoticesJourney(page, fixture);
await expect(page.getByRole("group", { name: "Credential owner" }).getByRole("button")).toContainText("fixture");
await page.getByRole("navigation", { name: "Integrations sections", exact: true }).getByRole("button", { name: "AI Providers", exact: true }).click();