Liking cljdoc? Tell your friends :D

fractal-engine.codebrain

CODEBRAIN — a persistent code-discovery brain built on the recursive engine.

It is a thin PRODUCT surface, not part of the compute kernel: the value is two prompts, not new engine machinery. The kernel teaches a node how to be a recursive compute node (the base system prompt); codebrain is a second, session-level overlay on top of that one — a standing role added once at the brain's birth that says "you are a code-discovery brain for THIS repo: build a repo map for yourself using your children and leaves, then answer a coding agent's questions from it, compact and cited." The overlay is carried across every turn and every resume via the message history; it is never re-stated per turn.

Used like bd: durable state lives on disk under <runs-dir>/codebrain/ and survives across CLI invocations. codebrain init is born once and builds its map; each codebrain ask resumes that same brain (its map and vars stay warm) to answer a query and advance the brain's HEAD. The point is to move codebase discovery off the coding agent's context and onto the brain's: the agent gets a small cited answer instead of having to read the code itself.

CODEBRAIN — a persistent code-discovery brain built on the recursive engine.

It is a thin PRODUCT surface, not part of the compute kernel: the value is two
prompts, not new engine machinery. The kernel teaches a node how to be a
recursive compute node (the base system prompt); codebrain is a second,
session-level overlay on top of that one — a standing role added once at the
brain's birth that says "you are a code-discovery brain for THIS repo: build a
repo map for yourself using your children and leaves, then answer a coding
agent's questions from it, compact and cited." The overlay is carried across
every turn and every resume via the message history; it is never re-stated per
turn.

Used like `bd`: durable state lives on disk under `<runs-dir>/codebrain/` and
survives across CLI invocations. `codebrain init` is born once and builds its
map; each `codebrain ask` resumes that same brain (its map and vars stay warm)
to answer a query and advance the brain's HEAD. The point is to move codebase
discovery off the coding agent's context and onto the brain's: the agent gets a
small cited answer instead of having to read the code itself.
raw docstring

ask-messageclj

(ask-message question)

The per-turn message carrying a coding agent's query. Lean on purpose — the brain role and working rules already live in the session overlay; this delivers the question and pins the cited FINAL shape the agent consumes.

The per-turn message carrying a coding agent's query. Lean on purpose — the
brain role and working rules already live in the session overlay; this delivers
the question and pins the cited FINAL shape the agent consumes.
sourceraw docstring

brain-dirclj

(brain-dir runs-dir)

The directory holding this repo's brain. Lives under the runs dir so it travels with .fractal/ discovery, but its turn dirs are nested one level deeper so they never show up in fractal ls (which only scans immediate run dirs).

The directory holding this repo's brain. Lives under the runs dir so it travels
with `.fractal/` discovery, but its turn dirs are nested one level deeper so they
never show up in `fractal ls` (which only scans immediate run dirs).
sourceraw docstring

build-messageclj

(build-message root)

The per-turn message that asks the brain to (re)build its repo map. The HOW lives in the session overlay; this states the task and pins the FINAL shape.

The per-turn message that asks the brain to (re)build its repo map. The HOW lives
in the session overlay; this states the task and pins the FINAL shape.
sourceraw docstring

cmd-askclj

(cmd-ask pos flags)

Resume the brain and answer one coding-agent query, advancing its HEAD.

Resume the brain and answer one coding-agent query, advancing its HEAD.
sourceraw docstring

cmd-helpclj

(cmd-help _ _)
source

cmd-initclj

(cmd-init pos flags)

Birth the brain and build its first repo map. Re-running starts a fresh brain (the prior turn dirs are left in place for provenance).

Birth the brain and build its first repo map. Re-running starts a fresh brain
(the prior turn dirs are left in place for provenance).
sourceraw docstring

cmd-mapclj

(cmd-map pos flags)

Show the brain's persisted repo map.

Show the brain's persisted repo map.
sourceraw docstring

cmd-statusclj

(cmd-status pos flags)
source

commandclj

(command pos flags)

Dispatch a fractal codebrain <sub> … invocation. pos is the positionals AFTER the codebrain verb (sub-command first); flags the parsed flags.

Dispatch a `fractal codebrain <sub> …` invocation. `pos` is the positionals
AFTER the `codebrain` verb (sub-command first); `flags` the parsed flags.
sourceraw docstring

load-mapclj

(load-map bdir)
source

load-metaclj

(load-meta bdir)
source

persist-map!clj

(persist-map! bdir m run-dir)
source

session-overlayclj

(session-overlay root)

The standing brain role, added once to the session's system message on top of the base behavior. References the repo root it is born to serve.

The standing brain role, added once to the session's system message on top of
the base behavior. References the repo root it is born to serve.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close