Skip to content

[P2][RFC] Add hermetic modules and pure typed helpers for reusable agent programs #66

Closed

Description

@AetherAI3

Motivation and current boundary

Nano currently parses one strategy followed by EOF in parser.py. Typed inputs, parameters, computed expressions and reasoning signatures exist, but users cannot compose their own reusable functions or import shared record contracts.

The goal is practical language composition: reuse an evidence validator, resource-budget calculation or handoff schema across agents. Rust/Go-like tooling and explicit types are the useful analogy. A native compiler, unrestricted host I/O and a broad package ecosystem are not prerequisites.

RFC requirements

Propose syntax and IR changes for:

  • local, explicitly pinned modules with a manifest/lockfile and dependency hashes;
  • pure typed functions and reusable records/enums/results, starting with one minimal subset;
  • acyclic imports and bounded expansion; initially prohibit recursion;
  • source maps across dependencies and deterministic canonical identity;
  • effect composition, preserving the host boundary for inference, evidence reads and QPU work.

Document compatibility with baseline strategy IR, v1 modules and the separate Intent frontend. Do not merge independently versioned artifacts into an unversioned catch-all.

First executable milestone

Implement a narrowly scoped vertical slice after the RFC: two local modules share one pure helper or record validator, compile deterministically, and produce the same result as the equivalent inline program. Select the smallest syntax/IR addition that proves this. No registry download, implicit filesystem discovery, network import or ambient clock/RNG.

Acceptance

  • Typed call signatures, duplicate symbols, import cycles and stale dependency hashes have positioned diagnostics.
  • Inline and imported versions agree on outputs; hashes capture all semantically relevant dependencies.
  • Imported code cannot add undeclared effects or expand beyond a fixed resource budget.
  • Tests demonstrate an agent task/evidence record use case without trading-specific names.
  • Preserve existing programs; explain any new IR version and migration.
  • Cost/resource units distinguish shots, QPU seconds, queue time, model tokens and measured joules. Compiler QUBO energy is a separate quantity.

Subsequent directions, not this first PR

Build a nano init/check/test/fmt workflow, portable Rust/Go/TypeScript host clients from the protocol schema, and bounded task-graph composition. Reuse Predator's per-child qualification and reservation rules rather than invent an unbounded agent runtime inside Nano. A future fanout declaration must compute child and shared-pool limits before host execution.

No paid inference or hardware is required for the RFC or first milestone.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions