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:
zhi
2026-04-18 17:12:10 +00:00
parent 3a36605238
commit c4a72b13c0
15 changed files with 462 additions and 0 deletions

20
openclaw.plugin.json Normal file
View File

@@ -0,0 +1,20 @@
{
"id": "prism-facet",
"name": "PrismFacet",
"version": "0.1.0",
"description": "Dynamic system prompt injection via routers and rules",
"main": "dist/index.js",
"configSchema": {
"type": "object",
"properties": {
"routersDir": {
"type": "string",
"description": "Directory containing router .ts/.js files (default: {pluginDir}/routers)"
},
"rulesFile": {
"type": "string",
"description": "Path to rules.json (default: {pluginDir}/rules.json)"
}
}
}
}