Dagger
Search

dagmar

This is dagmar's Dagger module: the execution engine that runs the coder loop,
prompter loop, adjudicator loop, gate, and sandbox. The Kubernetes controller
dispatches these functions via `dagger call` from agent pods.

Installation

dagger install github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9

Entrypoint

Return Type
Dagmar !
Arguments
NameTypeDefault ValueDescription
projectDirectory -The target Project's source directory (per-Project binding seam).
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
func (m *MyModule) Example() *dagger.Dagmar  {
	return dag.
			Dagmar()
}
@function
def example() -> dagger.Dagmar:
	return (
		dag.dagmar()
	)
@func()
example(): Dagmar {
	return dag
		.dagmar()
}

Types

Dagmar 🔗

entry point into dagmar’s Dagger functionality AND the per-Project binding seam: the New constructor binds the target Project once, and every method (Run, Sandbox, Gate, …) reuses that bound state (ADR-0010 §5). Project Hook Services (issues, memory, prompts) are exposed as native Dagger functions via WithMainModule(), not Go ports (ADR-0018).

adjudicate() 🔗

Adjudicate is dagmar’s adjudicator-loop entry point (ADR-0023 D4). When the deterministic Gate and the Reviewer-LLM disagree (gate green + reviewer veto, or gate redapprove), the Adjudicator resolves the conflict — it is the final automated decision maker before human escalation.

The Adjudicator is read-only: it reads source, issues, and memory to investigate the disagreement, but modifies nothing. It returns a structured verdict string naming one of three resolution paths: reviewer-wrong (calibrate reviewer, proceed), gate-wrong (coder repairs the gate checkables, full re-run), or escalate (unresolvable, human needed).

Unlike Prompt/Code, the Adjudicator does NOT use a chained prompter — its instructions come directly from the adjudicator meta-prompt (prompts.AdjudicatorMetaPrompt). The controller dispatches this via dagger call -m .dagger adjudicate --source <dir> .... Delegates to app.Adjudicate.

The args are primitives + Dagger types because Dagger codegen requires main-package types only. The app layer builds the read-only Env, sends the meta-prompt + disagreement context, and drives the Loop (ADR-0010 §3: Tier A direct).

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

source is the project source directory (read-only). The Adjudicator reads files from here to investigate the root cause of the disagreement.

gateResultString !-

gateResult is the gate’s outcome: “green” or “red” plus which checkables failed (if red) and their failure messages.

reviewResultString !-

reviewResult is the reviewer’s outcome: “approve” or “veto” plus the reviewer’s rationale.

taskContextString !-

taskContext is the original issue text / task description the coder was asked to implement.

modelString "anthropic/claude-sonnet-4"

model is the LLM model identifier (e.g. “anthropic/claude-sonnet-4”). The Adjudicator needs strong reasoning (ADR-0023 D6).

maxApicallsInteger 30

maxAPICalls bounds the LLM API calls for this adjudication Run. Higher than the prompter (adjudication may require deeper investigation of source

moduleRefString ".dagmar"

moduleRef is the project module reference (the Project CR’s moduleRef). Registers dagmar-issues + dagmar-memory as LLM-Tool hooks via WithMainModule. Defaults to “.dagmar” (dagmar dogfooding itself).

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 adjudicate --source DIR_PATH --gate-result string --review-result string --task-context string
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, gateResult string, reviewResult string, taskContext string) string  {
	return dag.
			Dagmar().
			Adjudicate(ctx, source, gateResult, reviewResult, taskContext)
}
@function
async def example(source: dagger.Directory, gateresult: str, reviewresult: str, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.adjudicate(source, gateresult, reviewresult, taskcontext)
	)
@func()
async example(source: Directory, gateResult: string, reviewResult: string, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.adjudicate(source, gateResult, reviewResult, taskContext)
}

code() 🔗

Code is dagmar’s coder-loop entry point (Phase 2 cognition, ADR-0021 D1). It constructs the Env, drives the LLM Loop, and returns the modified workspace Directory. The controller dispatches this via dagger call -m .dagger code --source <dir> --prompt-file <md>. Delegates to app.Code.

The args are primitives + Dagger types (Directory, File) because Dagger codegen requires main-package types only. The app layer builds the Env + LLM + Loop from these (ADR-0010 §3: Tier A direct). The prompt file is pre-composed by the controller (ADR-0005 merge).

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

source is the workspace Directory — the project source the agent works on (clone from ADR-0020 D1: dag.Git(repoURL).Branch(branchName).Tree()).

promptFileFile !-

promptFile is the resolved prompt .md (ADR-0005 cross-store merge, pre-computed by the controller). The agent receives this via WithPromptFile.

modelString "anthropic/claude-sonnet-4"

model is the LLM model identifier (e.g. “anthropic/claude-sonnet-4”).

maxApicallsInteger 100

maxAPICalls bounds the LLM API calls for this Run (token/cost cap, ADR-0021 D4). Engine-enforced hard stop: when exhausted, the Loop terminates.

moduleRefString ".dagmar"

moduleRef is the project module reference (the Project CR’s moduleRef). Defaults to “.dagmar” (dagmar dogfooding itself).

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 code --source DIR_PATH --prompt-file file:path
func (m *MyModule) Example(source *dagger.Directory, promptFile *dagger.File) *dagger.Directory  {
	return dag.
			Dagmar().
			Code(source, promptFile)
}
@function
def example(source: dagger.Directory, promptfile: dagger.File) -> dagger.Directory:
	return (
		dag.dagmar()
		.code(source, promptfile)
	)
@func()
example(source: Directory, promptFile: File): Directory {
	return dag
		.dagmar()
		.code(source, promptFile)
}

cognitionRun() 🔗

CognitionRun creates a new cognition pipeline as a Dagger Custom Object (ADR-0027). Each step (Prompt, Code, Gate, Review, Adjudicate) is a chainable method on the returned CognitionRun struct. The struct’s exported fields hold the accumulated pipeline state — Dagger serializes them between method calls (ADR-0027 D1).

The gate step calls the project’s dagmar-gate Hook via a typed cross-module call (dag.Dagmar().DagmarGate) — the project defines what the gate is (ADR-0014).

Return Type
CognitionRun !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

source is the project source directory.

taskContextString !-

taskContext is the issue text / task description.

modelString "anthropic/claude-sonnet-4"

model is the LLM model identifier.

maxApicallsInteger 100

maxAPICalls bounds the total LLM API calls for the pipeline.

moduleRefString ".dagmar"

moduleRef is the project module reference (registers dagmar-issues + dagmar-memory

coverageFloorBpsInteger 0

coverageFloorBps is the ratcheted coverage floor (0 = disabled).

maxReviseInteger 3

maxRevise bounds the code→gate→revise iterations (0 = default 3).

callbackUrlString ""

callbackURL is the controller’s Collector endpoint for step-result pushes. Empty = no Collector (pipeline runs standalone, testable without controller).

callbackTokenString ""

callbackToken is the Bearer token for Collector auth.

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.DagmarCognitionRun  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext)
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.DagmarCognitionRun:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
	)
@func()
example(source: Directory, taskContext: string): DagmarCognitionRun {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
}

diff() 🔗

Diff computes the difference between a pre-Loop and post-Loop workspace (ADR-0021 D8). The controller calls this after Code() to extract the agent’s changes for the PR flow (ADR-0020 D3). Returns a Directory containing only the changed files.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
afterDirectory !-

after is the post-Loop workspace (Code’s return value).

beforeDirectory !-

before is the pre-Loop workspace (the original clone).

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 diff --after DIR_PATH --before DIR_PATH
func (m *MyModule) Example(after *dagger.Directory, before *dagger.Directory) *dagger.Directory  {
	return dag.
			Dagmar().
			Diff(after, before)
}
@function
def example(after: dagger.Directory, before: dagger.Directory) -> dagger.Directory:
	return (
		dag.dagmar()
		.diff(after, before)
	)
@func()
example(after: Directory, before: Directory): Directory {
	return dag
		.dagmar()
		.diff(after, before)
}

prompt() 🔗

Prompt is dagmar’s prompter-loop entry point (ADR-0023 D1). It synthesizes a tailored prompt for the Coder or Reviewer by running a short LLM loop that reads project source, issues, and memory. The synthesized prompt is returned as a string — the controller forwards it as –prompt-file to the subsequent Code or Review Run.

The args are primitives + Dagger types because Dagger codegen requires main-package types only. The app layer builds the read-only Env, selects the meta-prompt by phase, and drives the Loop (ADR-0010 §3: Tier A direct). Delegates to app.Prompt.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

source is the project source directory (read-only). The prompter reads files from here to ground the synthesized prompt in real project context.

phaseString !-

phase selects which meta-prompt to use: “pre-code” (coder) or “pre-review” (reviewer).

taskContextString !-

taskContext is the issue text / task description from the orchestrating Run.

modelString "anthropic/claude-sonnet-4"

model is the LLM model identifier (e.g. “anthropic/claude-sonnet-4”). The prompter may use a smaller/faster model — synthesis is well-bounded (ADR-0023 D6).

maxApicallsInteger 10

maxAPICalls bounds the LLM API calls for this synthesis Run. Low budget — prompt synthesis is well-bounded (ADR-0023 D1).

moduleRefString ".dagmar"

moduleRef is the project module reference (the Project CR’s moduleRef). Registers dagmar-issues + dagmar-memory as LLM-Tool hooks via WithMainModule. Defaults to “.dagmar” (dagmar dogfooding itself).

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 prompt --source DIR_PATH --phase string --task-context string
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, phase string, taskContext string) string  {
	return dag.
			Dagmar().
			Prompt(ctx, source, phase, taskContext)
}
@function
async def example(source: dagger.Directory, phase: str, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.prompt(source, phase, taskcontext)
	)
@func()
async example(source: Directory, phase: string, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.prompt(source, phase, taskContext)
}

review() 🔗

Review is dagmar’s reviewer-loop entry point (ADR-0024 D4). The reviewer reads the coder’s workspace, applies review criteria from the prompt, and returns a structured JSON verdict (approve/veto + rationale). Unlike Code(), Review is read-only (no Writable, no DirectoryOutput) and returns a JSON string, not a Directory.

The controller dispatches this via dagger call -m .dagger review --source <dir> .... The output is a JSON string the controller parses for the approve/veto decision (ADR-0025: structured JSON output via WithJSONValueOutput, not termination-log).

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

source is the workspace Directory — the project source the reviewer reads (read-only: the reviewer does NOT modify code).

promptFileFile !-

promptFile is the pre-synthesized reviewer prompt (from the chained prompter with phase “pre-review”). Contains the review criteria + task context.

modelString "anthropic/claude-sonnet-4"

model is the LLM model identifier.

maxApicallsInteger 50

maxAPICalls bounds the LLM API calls for this review Run.

moduleRefString ".dagmar"

moduleRef is the project module reference (registers dagmar-issues

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 review --source DIR_PATH --prompt-file file:path
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, promptFile *dagger.File) string  {
	return dag.
			Dagmar().
			Review(ctx, source, promptFile)
}
@function
async def example(source: dagger.Directory, promptfile: dagger.File) -> str:
	return await (
		dag.dagmar()
		.review(source, promptfile)
	)
@func()
async example(source: Directory, promptFile: File): Promise<string> {
	return dag
		.dagmar()
		.review(source, promptFile)
}

sandbox() 🔗

Sandbox realizes an isolated, credentialed execution slot (a Dagger Container — Tier A, used directly; ADR-0010 §3). This is the v0 vertical proving the layout seams (functional core -> app Tier-A-direct -> main delegation -> a chainable custom return object) without an LLM call. Delegates to app.BuildSandbox.

NOTE: the args are primitives (not a domain.SandboxSpec) because Dagger cannot code-generate for a foreign (non-main-package) input type. The pure domain.SandboxSpec is constructed at this seam from the primitives; domain stays Dagger-free and unit-tested (ADR-0010 §3).

Return Type
Sandbox !
Arguments
NameTypeDefault ValueDescription
imageString !-

Base OCI image for the Sandbox container.

workingDirString -

Working directory inside the Sandbox (empty = image default). Named workingDir, not workdir, to avoid a CLI flag collision with *dagger.Container’s own workdir field.

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 sandbox --image string
func (m *MyModule) Example(image string) *dagger.DagmarSandbox  {
	return dag.
			Dagmar().
			Sandbox(image)
}
@function
def example(image: str) -> dagger.DagmarSandbox:
	return (
		dag.dagmar()
		.sandbox(image)
	)
@func()
example(image: string): DagmarSandbox {
	return dag
		.dagmar()
		.sandbox(image)
}

CognitionRun 🔗

CognitionRun is the pipeline state object (ADR-0027 D1). Exported fields are serialized by Dagger between chained method calls.

source() 🔗

Input configuration (set by constructor).

Return Type
Directory !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 source
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.Directory  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Source()
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.Directory:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.source()
	)
@func()
example(source: Directory, taskContext: string): Directory {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.source()
}

taskContext() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 task-context
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Taskcontext(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.taskcontext()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.taskContext()
}

model() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 model
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Model(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.model()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.model()
}

maxApicalls() 🔗

Return Type
Integer !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 max-apicalls
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) int  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Maxapicalls(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> int:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.maxapicalls()
	)
@func()
async example(source: Directory, taskContext: string): Promise<number> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.maxApicalls()
}

moduleRef() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 module-ref
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Moduleref(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.moduleref()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.moduleRef()
}

coverageFloorBps() 🔗

Return Type
Integer !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 coverage-floor-bps
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) int  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Coveragefloorbps(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> int:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.coveragefloorbps()
	)
@func()
async example(source: Directory, taskContext: string): Promise<number> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.coverageFloorBps()
}

maxRevise() 🔗

Return Type
Integer !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 max-revise
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) int  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Maxrevise(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> int:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.maxrevise()
	)
@func()
async example(source: Directory, taskContext: string): Promise<number> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.maxRevise()
}

callbackUrl() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 callback-url
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Callbackurl(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.callbackurl()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.callbackUrl()
}

callbackToken() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 callback-token
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Callbacktoken(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.callbacktoken()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.callbackToken()
}

promptText() 🔗

Accumulated pipeline state (written by step methods via mergeResult).

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 prompt-text
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Prompttext(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.prompttext()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.promptText()
}

gateResult() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 gate-result
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Gateresult(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.gateresult()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.gateResult()
}

gatePassed() 🔗

Return Type
Boolean !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 gate-passed
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) bool  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Gatepassed(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> bool:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.gatepassed()
	)
@func()
async example(source: Directory, taskContext: string): Promise<boolean> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.gatePassed()
}

reviewVerdict() 🔗

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 review-verdict
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Reviewverdict(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.reviewverdict()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.reviewVerdict()
}

rounds() 🔗

Return Type
Integer !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 rounds
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) int  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Rounds(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> int:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.rounds()
	)
@func()
async example(source: Directory, taskContext: string): Promise<number> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.rounds()
}

jSon() 🔗

JSON serializes the pipeline state as JSON (ADR-0027 D5). This is the terminal method — the controller parses this to decide policy.

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 j-s-o-n
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Json(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.json()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.jSON()
}

run() 🔗

Run orchestrates the full pipeline with internal decision points (ADR-0027).

This is the primary entry point for the controller. It chains all steps with gate-red revise loops and review-veto adjudication. Decision points are the only places where Go branching occurs — between them, steps compose lazily.

Segment flow:

Segment A: WithPrompt(pre-code) → WithCode → WithGate
Decision 1: gate green? → proceed to Segment B
            gate red? → revise loop (append feedback, re-code, re-gate)
Segment B: WithPrompt(pre-review) → WithReview
Decision 2: review approve? → done
            review veto? → Segment C
Segment C: WithAdjudicate → done

Returns the final pipeline result as JSON (see Result method).

Return Type
String !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 run
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, taskContext string) string  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Run(ctx)
}
@function
async def example(source: dagger.Directory, taskcontext: str) -> str:
	return await (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.run()
	)
@func()
async example(source: Directory, taskContext: string): Promise<string> {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.run()
}

withAdjudicate() 🔗

WithAdjudicate runs the adjudicator LLM Loop (ADR-0023 D4).

Delegates to app.Adjudicate — the existing, tested adjudicator function. Passes the gate result and review verdict as disagreement context.

Return Type
CognitionRun !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 with-adjudicate
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.DagmarCognitionRun  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Withadjudicate()
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.DagmarCognitionRun:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.withadjudicate()
	)
@func()
example(source: Directory, taskContext: string): DagmarCognitionRun {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.withAdjudicate()
}

withCode() 🔗

WithCode runs the coder LLM Loop on the workspace (ADR-0021 D2).

Delegates to app.Code — the existing, tested coder function that builds the Env (Privileged + Writable + DirectoryInput/Output), drives the LLM Loop, and returns the modified workspace Directory.

Reads from c.Source (the workspace) and c.PromptFile (the synthesized prompt from WithPrompt). Stores the modified workspace in c.Workspace.

Return Type
CognitionRun !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 with-code
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.DagmarCognitionRun  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Withcode()
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.DagmarCognitionRun:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.withcode()
	)
@func()
example(source: Directory, taskContext: string): DagmarCognitionRun {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.withCode()
}

withGate() 🔗

WithGate runs the project’s dagmar-gate Hook (ADR-0027 D4).

Calls dag.Dagmar().DagmarGate — a typed cross-module call to the project’s conformant module. The project defines what the gate checks (ADR-0014, ADR-0017 §3). No gate logic is duplicated here; the project’s gate runs as-is.

Return Type
CognitionRun !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 with-gate
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.DagmarCognitionRun  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Withgate()
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.DagmarCognitionRun:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.withgate()
	)
@func()
example(source: Directory, taskContext: string): DagmarCognitionRun {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.withGate()
}

withPrompt() 🔗

WithPrompt synthesizes a coder prompt via the Prompter-LLM (ADR-0023 D1).

Delegates to app.Prompt — the existing, tested prompter function that reads project source, issues, and memory, then synthesizes a tailored prompt. Meta-prompts are go:embed files (coder-meta.md / reviewer-meta.md), not inline strings (ADR-0023 D9).

The phase selects which meta-prompt drives synthesis: - “pre-code”: synthesizes the prompt the coder needs - “pre-review”: synthesizes the prompt the reviewer needs

Return Type
CognitionRun !
Arguments
NameTypeDefault ValueDescription
phaseString "pre-code"

phase selects the meta-prompt: “pre-code” (coder) or “pre-review” (reviewer).

Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 with-prompt
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.DagmarCognitionRun  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Withprompt()
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.DagmarCognitionRun:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.withprompt()
	)
@func()
example(source: Directory, taskContext: string): DagmarCognitionRun {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.withPrompt()
}

withReview() 🔗

WithReview runs the reviewer LLM Loop (ADR-0024 D4).

Delegates to app.Review — the existing, tested reviewer function that builds a read-only Env, drives the LLM Loop, and extracts a structured ReviewVerdict via WithJSONValueOutput (ADR-0025).

Reads from c.Workspace (the coder’s modified workspace) and c.PromptFile (the synthesized review prompt from WithPrompt with phase “pre-review”).

Return Type
CognitionRun !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 cognition-run --source DIR_PATH --task-context string \
 with-review
func (m *MyModule) Example(source *dagger.Directory, taskContext string) *dagger.DagmarCognitionRun  {
	return dag.
			Dagmar().
			Cognitionrun(source, taskContext).
			Withreview()
}
@function
def example(source: dagger.Directory, taskcontext: str) -> dagger.DagmarCognitionRun:
	return (
		dag.dagmar()
		.cognitionrun(source, taskcontext)
		.withreview()
	)
@func()
example(source: Directory, taskContext: string): DagmarCognitionRun {
	return dag
		.dagmar()
		.cognitionRun(source, taskContext)
		.withReview()
}

Sandbox 🔗

Sandbox is the Dagger object returned by Dagmar.Sandbox — a thin, chainable wrapper over the realized Container. Exported methods on it become callable Dagger functions.

container() 🔗

Container returns the underlying Dagger Container (Tier A).

Return Type
Container !
Example
dagger -m github.com/denkhaus/dagmar@e39bf1b064ef19cea860343dc9d099e4cbacb3a9 call \
 sandbox --image string \
 container
func (m *MyModule) Example(image string) *dagger.Container  {
	return dag.
			Dagmar().
			Sandbox(image).
			Container()
}
@function
def example(image: str) -> dagger.Container:
	return (
		dag.dagmar()
		.sandbox(image)
		.container()
	)
@func()
example(image: string): Container {
	return dag
		.dagmar()
		.sandbox(image)
		.container()
}