这个项目能做什么
Phronesis is a domain-neutral RETE rules engine designed to provide durable, deterministic governance for non-deterministic AI agents. It addresses the "contextual drift" that occurs in long-running LLM sessions (such as Claude Code, Codex, or Gemini CLI), where project-specific guidance like `CLAUDE.md` fades as the context window fills and auto-compaction triggers.
Unlike traditional approaches that rely on the LLM remembering instructions within its context, Phronesis moves enforcement out of the conversation entirely. Rules live on disk in `.phronesis/rules.json` and are evaluated by lightweight hooks at the moment of action. This ensures that rules fire consistently regardless of token count, as they are never loaded into the LLM's context window to begin with.
The system operates as a boundary around agent actions: the host normalizes a proposed tool call, the engine evaluates durable rules, and the host receives an allow, warning, or blocking decision. Key subsystems include:
1. **Durable Context**: Keeps compact project guidance in `.phronesis/durable.md`, re-injecting it at session boundaries.
2. **Confidence Scoring**: Reads build, test, and known-bug signals through declarative toolchain definitions (Cargo, xcodebuild, SwiftPM) to warn on Git mutations when evidence is incomplete.
3. **Journey Facts**: Maintains a durable per-call journal to allow rules to match cross-call temporal patterns (e.g., auth churn or build staleness) without in-memory accumulation.
4. **Structural Code Graph**: Parses Rust, Python, TypeScript, Swift, and Java into queryable relations (e.g., `defines_fn`, `calls_api`) to bind rules to concrete code referents.
5. **Drift Detection**: Compares rules with durable guidance, agent memory, and bound code to identify inconsistencies.
Phronesis is implemented in Rust and includes a core library, an MCP server (`phr-mcp`) for integration with LLM environments, and a sandboxed Rhai evaluator for extensible predicates and guard conditions.
评论
0 评分人数达到10人后显示
登录后参与讨论。