init: ClawRoles — role/position definitions for PrismFacet
6 role definitions (developer, manager, operator, mentor, secretary, agent-resource-director) and 6 position definitions. Routers: role.ts and position.ts read ego.json for agent mapping. install.sh: copies routers to PrismFacet, scans roles/ and positions/ directories, registers rules in PrismFacet's rules.json. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
14
routers/position.ts
Normal file
14
routers/position.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// Reads agent position from ego.json (requires PaddedCell/ego-mgr)
|
||||
import { readFileSync } from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
|
||||
const EGO_PATH = `${homedir()}/.openclaw/ego.json`;
|
||||
|
||||
export function resolve(ctx: { agentId: string }): string {
|
||||
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