Context
Today, intent resolver strategies are hardcoded Rust structs in crates/kodo_resolver/src/strategies/. An agent writes intent database { ... } in Kōdo, but the resolution logic is Rust code that generates AST programmatically.
Proposal
Allow intent resolver strategies to be written in Kōdo itself — a .ko file that receives intent configuration and returns generated code.
Benefits
- Extensible: Anyone creates new resolvers without recompiling the compiler
- Self-hosting: More of the compiler in Kōdo
- Dog-fooding: Proves Kōdo is expressive enough for metaprogramming
- Agent-authored resolvers: AI agents could write custom resolvers for new domains
Blockers
- Kōdo has no macros or eval — can't generate AST from within Kōdo yet
- Resolver needs access to compiler internals (AST types)
- Needs a plugin API or intermediate format (JSON?) for communication
Possible Approach
- Define a JSON-based intermediate representation for generated functions
- Kōdo resolver scripts receive intent config as JSON, output function definitions as JSON
- Compiler deserializes JSON back to AST and injects into pipeline
- Later: native AST manipulation when Kōdo has reflection/macros
Timeline
Depends on Bootstrap Compiler (v2.0.0) — when type checker and resolver are in Kōdo, this becomes natural.
Current Implementation
crates/kodo_resolver/src/strategies/ — 12 Rust strategy files
crates/kodo_resolver/src/lib.rs — resolve engine
docs/intent_system.md — design documentation
Context
Today, intent resolver strategies are hardcoded Rust structs in
crates/kodo_resolver/src/strategies/. An agent writesintent database { ... }in Kōdo, but the resolution logic is Rust code that generates AST programmatically.Proposal
Allow intent resolver strategies to be written in Kōdo itself — a
.kofile that receives intent configuration and returns generated code.Benefits
Blockers
Possible Approach
Timeline
Depends on Bootstrap Compiler (v2.0.0) — when type checker and resolver are in Kōdo, this becomes natural.
Current Implementation
crates/kodo_resolver/src/strategies/— 12 Rust strategy filescrates/kodo_resolver/src/lib.rs— resolve enginedocs/intent_system.md— design documentation