Skip to content

feat: intent resolver strategies written in Kōdo (plugin system) #41

Description

@rfunix

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

  1. Define a JSON-based intermediate representation for generated functions
  2. Kōdo resolver scripts receive intent config as JSON, output function definitions as JSON
  3. Compiler deserializes JSON back to AST and injects into pipeline
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions