- Plugin scaffold: manifest, tsconfig, package.json - Router loader with dynamic import + cache busting for hot reload - Rule store: CRUD on rules.json - Prompt injector: resolve routers → match rules → read files → inject - MCP tool: prompt_rules (add/remove/list/test/reload-routers/list-routers) - Built-in routers: agent-id (zero-dep), role, position (ego.json) - before_prompt_build hook for system prompt injection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
15 lines
397 B
JavaScript
15 lines
397 B
JavaScript
// Reads agent role from ego.json (optional dependency on PaddedCell/ego-mgr)
|
|
import { readFileSync } from "node:fs";
|
|
import { homedir } from "node:os";
|
|
|
|
const EGO_PATH = `${homedir()}/.openclaw/ego.json`;
|
|
|
|
export function resolve(ctx) {
|
|
try {
|
|
const ego = JSON.parse(readFileSync(EGO_PATH, "utf8"));
|
|
return ego["agent-scope"]?.[ctx.agentId]?.role || "";
|
|
} catch {
|
|
return "";
|
|
}
|
|
}
|