feat: PrismFacet core implementation
- 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>
This commit is contained in:
14
routers/position.js
Normal file
14
routers/position.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// Reads agent position 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]?.position || "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user