From 525557a952dd2e7f8911bb681a1f317c206ce028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sat, 1 Aug 2026 15:23:50 +0000 Subject: [PATCH] data-path: the agents item type and run directory the router needs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second half of c69cda4. The agents router imports getAgentRunsDir from data-path, which was still an uncommitted edit, so a clone got past the missing-module error only to fail on a missing export: SyntaxError: Export named 'getAgentRunsDir' not found in module '.../src/servers/data-path.ts' My check before c69cda4 verified that every module the agents files import is TRACKED, but not that the SYMBOLS they import actually EXIST in the committed version of those modules. Module resolution and named-export resolution are separate failures and the first check only covered the former. The whole diff to this file is one feature — 'agents' joins ItemType/ITEM_TYPES, and getAgentRunsDir is added — so it goes in whole rather than split. Co-Authored-By: Claude Opus 5 (1M context) --- src/servers/data-path.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/servers/data-path.ts b/src/servers/data-path.ts index d6d53f4a..a3466372 100644 --- a/src/servers/data-path.ts +++ b/src/servers/data-path.ts @@ -8,9 +8,9 @@ export const DATA_PATH = process.env.DATA_PATH ?? join(process.cwd(), 'data'); // process/extension is a directory under one of these type subfolders — no scope tiers, no DB. export const OFFICER_ITEMS_DIR = process.env.OFFICER_ITEMS_DIR ?? join(process.cwd(), 'officer-items'); -export type ItemType = 'skills' | 'tools' | 'tasks' | 'processes' | 'extensions'; +export type ItemType = 'skills' | 'tools' | 'tasks' | 'processes' | 'extensions' | 'agents'; -export const ITEM_TYPES: ItemType[] = ['skills', 'tools', 'tasks', 'processes', 'extensions']; +export const ITEM_TYPES: ItemType[] = ['skills', 'tools', 'tasks', 'processes', 'extensions', 'agents']; export const itemsDir = (type: ItemType) => join(OFFICER_ITEMS_DIR, type); @@ -20,6 +20,12 @@ export const ensureItemDirs = () => { export const SERVER_CONFIG_DIR = join(DATA_PATH, 'server-settings'); +// Every run of a given agent shares one working directory. That is deliberate and load-bearing: the +// `claude` CLI groups transcripts by cwd (see api/chat/claude-sessions.ts), so a shared cwd is what +// makes an agent's runs show up as their own project group in /chat, listed newest-first, with no +// database row anywhere. The accumulated CLAUDE.md / LEARNINGS.md for the agent live here too. +export const getAgentRunsDir = (dirName: string) => join(DATA_PATH, 'agentic_runs', dirName); + // The `pi`/opencode agent's own config dir (auth.json + models.json). External-tool path. export const AGENT_CONFIG_DIR = join(homedir(), '.pi', 'agent');