Repository

AgentJIT

A Just-In-Time compiler for autonomous agents. AgentJIT silently observes execution traces and compiles repetitive stochastic workflows into deterministic, zero-token skills.

Before
After
~10,000 tokens per routine task
~200 token skill invocation

Specs

  • BeforeAfter
  • ~10,000 tokens per routine task~200 token skill invocation

README



▄████▄  ▄▄▄▄ ▄▄▄▄▄ ▄▄  ▄▄ ▄▄▄▄▄▄   ██ ██ ██████ 
██▄▄██ ██ ▄▄ ██▄▄  ███▄██   ██     ██ ██   ██   
██  ██ ▀███▀ ██▄▄▄ ██ ▀██   ██  ████▀ ██   ██   


the daemon that compiles your workflows into existence

"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
— Aristotle, Nicomachean Ethics

Your AI agent repeats the same multi-step workflows hundreds of times —
kubectl logs, then grep, then edit, then apply — burning tokens
on what has already become muscle memory. AJ watches these habits
form, and in quiet moments of reflection, distills them into instinct.

Like an artisan whose hands move before conscious thought arrives,
the agent simply knows what to do next. Ten thousand tokens of
deliberation become two hundred tokens of certainty. The stochastic
becomes deterministic. Repetition becomes skill.


What is AJ?

A background JIT compiler for autonomous coding agents. It operates silently via Claude Code hooks, observes recurring tool-use patterns across sessions, and compiles them into zero-token parameterized skills — no manual configuration required.

flowchart LR
    subgraph hooks["Hook Events"]
        H1(["PostToolUse"])
        H2(["SessionStart"])
        H3(["SessionEnd"])
    end

    subgraph daemon["AJ Daemon"]
        direction TB
        D1["Ingest & Log"]
        D2["Trigger Compile"]
        D3["Emit Skills"]
        D1 --> D2 --> D3
    end

    subgraph skills["Compiled Skills"]
        S1[/"Parameterized"/]
        S2[/"Deterministic"/]
        S3[/"Zero-token"/]
    end

    subgraph runtime["Runtime Execution"]
        direction TB
        R1["Execute Skill"]
        R2{"Success?"}
        R3["Fallback to\nOriginal Workflow"]
        R4["aj stats record"]
        R1 --> R2
        R2 -- "No" --> R3
        R2 -- "Yes / No" --> R4
    end

    hooks -- "stdin (JSON)" --> daemon
    daemon -- "~/.aj/skills/" --> skills
    skills --> runtime
    runtime -- "success rates +\nexisting skills\nas context" --> daemon

    style hooks fill:#4a5568,stroke:#a0aec0,color:#e2e8f0
    style daemon fill:#2b6cb0,stroke:#63b3ed,color:#e2e8f0
    style skills fill:#276749,stroke:#68d391,color:#e2e8f0
    style runtime fill:#744210,stroke:#ecc94b,color:#fefcbf

The Self-Improvement Loop

The arrow from Runtime back to the Daemon is the key: compiled skills are not static artifacts — they live inside a continuous feedback loop.

  • Runtime Fallback — If a compiled shell script fails during execution, the agent silently falls back to the original uncompiled workflow. The user perceives no interruption; the skill simply steps aside.
  • Success Rate Auditing — Execution outcomes are tracked via aj stats record. If a skill's success rate declines, that signal is fed into the next compilation cycle, where the compiler can deprecate or refactor it. Skills uninvoked for 20+ consecutive sessions are automatically flagged for deprecation.
  • Iterative Recompilation — The current skill library is fed as context to the compiler each cycle. It doesn't start from scratch — it examines existing skills, evaluates whether underlying patterns have shifted, and updates, merges, or replaces them accordingly. Like a JIT engine re-optimizing hot paths with fresh profiling data.

The Numbers

Before After
~10,000 tokens per routine task ~200 token skill invocation
>30s stochastic reasoning