internal/

directory
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: GPL-3.0

Directories

Path Synopsis
Package agent owns the two provider-neutral halves of Magus's agent surface: the agent-skill artifact (this file - command packages supply embedded source files, and this package renders, installs and verifies the generated surface without knowing about a particular CLI host), and the guard verdict wire contract (guard.go, which lives here because `package main` cannot be imported, so a parity check outside cmd/magus would otherwise have to restate it).
Package agent owns the two provider-neutral halves of Magus's agent surface: the agent-skill artifact (this file - command packages supply embedded source files, and this package renders, installs and verifies the generated surface without knowing about a particular CLI host), and the guard verdict wire contract (guard.go, which lives here because `package main` cannot be imported, so a parity check outside cmd/magus would otherwise have to restate it).
Package audit detects cross-project writes: when a spell's downward walk crosses into a descendant project.
Package audit detects cross-project writes: when a spell's downward walk crosses into a descendant project.
Package auth manages the shared-secret bearer token that guards the magus MCP HTTP endpoint and provides the HTTP middleware that enforces it.
Package auth manages the shared-secret bearer token that guards the magus MCP HTTP endpoint and provides the HTTP middleware that enforces it.
Package cache implements magus's content-addressed build cache.
Package cache implements magus's content-addressed build cache.
reflink
Package reflink copies regular files using the most efficient mechanism the host platform and filesystem provide, transparently falling back to a plain userspace copy where no acceleration is available.
Package reflink copies regular files using the most efficient mechanism the host platform and filesystem provide, transparently falling back to a plain userspace copy where no acceleration is available.
Package changeset holds a change under review: the patch parsed into files, hunks and rows, and the shared session every surface reads while somebody works through it.
Package changeset holds a change under review: the patch parsed into files, hunks and rows, and the shared session every surface reads while somebody works through it.
ci
Package ci computes provider-agnostic fan-out plans for CI systems from a magus workspace.
Package ci computes provider-agnostic fan-out plans for CI systems from a magus workspace.
annotate
Package annotate emits CI job-log structure: the fold markers and the warning/error notices a CI provider recognizes.
Package annotate emits CI job-log structure: the fold markers and the warning/error notices a CI provider recognizes.
forecast
Package forecast picks an adaptive CI shard count using a USL model (N* = sqrt(W/α)) and packs projects via LPT bin-packing.
Package forecast picks an adaptive CI shard count using a USL model (N* = sqrt(W/α)) and packs projects via LPT bin-packing.
volatility
Package volatility provides Wilson-score volatility prediction and auto-retry for magus test runs.
Package volatility provides Wilson-score volatility prediction and auto-retry for magus test runs.
Package cli is the declarative specification of the magus CLI: every subcommand, its flags, usage, examples and prose, as data.
Package cli is the declarative specification of the magus CLI: every subcommand, its flags, usage, examples and prose, as data.
Package compress provides the streaming compression primitives Magus uses for cache artifacts and archives.
Package compress provides the streaming compression primitives Magus uses for cache artifacts and archives.
Package config holds the magus configuration schema and yaml-based loader.
Package config holds the magus configuration schema and yaml-based loader.
gen
Code generated by magus-utils config; DO NOT EDIT.
Code generated by magus-utils config; DO NOT EDIT.
generate
Package generate is the config generator: it reads the magus config struct and renders the flag-binding, schema-field, bind and env artifacts derived from it.
Package generate is the config generator: it reads the magus config struct and renders the flag-binding, schema-field, bind and env artifacts derived from it.
Package daemon assembles the magus daemon HTTP server: it mounts the MCP Streamable-HTTP handler, the k8s health routes, and the browser Graph Explorer console onto one loopback listener, applying the shared bearer and DNS-rebind guards.
Package daemon assembles the magus daemon HTTP server: it mounts the MCP Streamable-HTTP handler, the k8s health routes, and the browser Graph Explorer console onto one loopback listener, applying the shared bearer and DNS-rebind guards.
Package deps reads a project's declared third-party dependencies out of its manifest, at the versions that manifest resolves to.
Package deps reads a project's declared third-party dependencies out of its manifest, at the versions that manifest resolves to.
Package describe extracts a magusfile's target dependency graph statically, without evaluating any target body.
Package describe extracts a magusfile's target dependency graph statically, without evaluating any target body.
Package docs holds the shared rendering helpers the docs generators (cmd/magus-docs, cmd/magus-spelldocs) use to emit the committed Markdown under docs/**.
Package docs holds the shared rendering helpers the docs generators (cmd/magus-docs, cmd/magus-spelldocs) use to emit the committed Markdown under docs/**.
Package doctor validates a magus workspace and reports health checks.
Package doctor validates a magus workspace and reports health checks.
Package dropin reads a configuration directory of one file per entry.
Package dropin reads a configuration directory of one file per entry.
dry
Package dry is the in-process, non-executing magus evaluator: it runs Buzz source and magusfiles with every host effect (subprocess, filesystem, network) replaced by an in-memory tracer, then reports the project graph and the dry-run op trace instead of running anything.
Package dry is the in-process, non-executing magus evaluator: it runs Buzz source and magusfiles with every host effect (subprocess, filesystem, network) replaced by an in-memory tracer, then reports the project graph and the dry-run op trace instead of running anything.
Package eventstream maps magus's internal producers onto the single types.StreamEvent envelope external integrations subscribe to.
Package eventstream maps magus's internal producers onto the single types.StreamEvent envelope external integrations subscribe to.
Package file provides filesystem primitives used across the magus module.
Package file provides filesystem primitives used across the magus module.
diff
Package diff provides mtime+size snapshot diffing for attributing concurrent file writes.
Package diff provides mtime+size snapshot diffing for attributing concurrent file writes.
record
Package record stores a small struct as ONE FILE of name-then-value lines, tab separated:
Package record stores a small struct as ONE FILE of name-then-value lines, tab separated:
watch
Package watch provides a cross-platform filesystem watcher with recursive directory tracking, debouncing, and ignore filtering.
Package watch provides a cross-platform filesystem watcher with recursive directory tracking, debouncing, and ignore filtering.
generate
emit
Package emit writes magus's generated artifacts: the last stage of every generator, after its source of truth has been read and its output rendered.
Package emit writes magus's generated artifacts: the last stage of every generator, after its source of truth has been read and its output rendered.
godecl
Package godecl reads declarations out of Go source, for the generators whose source of truth is a Go file.
Package godecl reads declarations out of Go source, for the generators whose source of truth is a Go file.
graph
dependency
Package dependency constructs the project dependency DAG, translating path strings to node IDs.
Package dependency constructs the project dependency DAG, translating path strings to node IDs.
url
Package url builds daemon-origin Graph Explorer links with a pre-applied query or named view, so a magus CLI command can print a clickable "view this in the Graph Explorer" line as a COMPLEMENTARY aid alongside its normal output.
Package url builds daemon-origin Graph Explorer links with a pre-applied query or named view, so a magus CLI command can print a clickable "view this in the Graph Explorer" line as a COMPLEMENTARY aid alongside its normal output.
activity
Package activity is the console-facing ActivityService handler: it lists recent activity events (newest first, filtered) and serves a payload blob by ref for the /dashboard and log viewer.
Package activity is the console-facing ActivityService handler: it lists recent activity events (newest first, filtered) and serves a payload blob by ref for the /dashboard and log viewer.
diff
Package diff serves the review session's plain-JSON routes under /api/v1/diff.
Package diff serves the review session's plain-JSON routes under /api/v1/diff.
graph
Package graph holds the graph surfaces the daemon serves and the magus.graph.v1alpha1 wire mapping behind them: the GET /api/v1/graph route (a bulk subgraph document) and the GraphService RPCs (ranked retrieval - query, resolve, explain, path, stats).
Package graph holds the graph surfaces the daemon serves and the magus.graph.v1alpha1 wire mapping behind them: the GET /api/v1/graph route (a bulk subgraph document) and the GraphService RPCs (ranked retrieval - query, resolve, explain, path, stats).
insight
Package insight is the console-facing InsightService handler: it serves every insight lens (the four VCS-history lenses from one cached git-log scan, plus the run-outcome volatility lens folded in fresh) as the magus.insight.v1alpha1 wire type.
Package insight is the console-facing InsightService handler: it serves every insight lens (the four VCS-history lenses from one cached git-log scan, plus the run-outcome volatility lens folded in fresh) as the magus.insight.v1alpha1 wire type.
job
Package job is the console-facing JobService handler: the daemon's CONTROL surface, the mutating sibling of the read-only activity/status/viewer handlers.
Package job is the console-facing JobService handler: the daemon's CONTROL surface, the mutating sibling of the read-only activity/status/viewer handlers.
mcp
Package mcp implements the MCP (Model Context Protocol) server for magus.
Package mcp implements the MCP (Model Context Protocol) server for magus.
mcp/origin
Package origin carries agent origin metadata across goroutines via context.
Package origin carries agent origin metadata across goroutines via context.
memory
Package memory is the console-facing MemoryService handler: an observable, editable view over the durable handoff-journal entries the MCP magus_memory tool writes.
Package memory is the console-facing MemoryService handler: an observable, editable view over the durable handoff-journal entries the MCP magus_memory tool writes.
metrics
Package metrics is the daemon's derived-dashboard presentation layer for magus's OTel metrics.
Package metrics is the daemon's derived-dashboard presentation layer for magus's OTel metrics.
notes
Package notes is the console-facing NotesService handler: a READ-ONLY view over the workspace's human-authored notes, both the shared store in the checkout and the private one on this machine.
Package notes is the console-facing NotesService handler: a READ-ONLY view over the workspace's human-authored notes, both the shared store in the checkout and the private one on this machine.
status
Package status maps the live status report onto the magus.status.v1alpha1 wire message and base64-encodes it for the dashboard's SSE stream.
Package status maps the live status report onto the magus.status.v1alpha1 wire message and base64-encodes it for the dashboard's SSE stream.
token
Package token is the console-facing TokenService handler: the typed management surface for the daemon's auth tokens.
Package token is the console-facing TokenService handler: the typed management surface for the daemon's auth tokens.
tool
Package tool serves the toolchain view: every binary a workspace's spells drive, the version each one reported, and the window it is held to.
Package tool serves the toolchain view: every binary a workspace's spells drive, the version each one reported, and the window it is held to.
trailrpc
Package trailrpc is the audit interceptor for the daemon's Connect services: a connect.Interceptor that records MUTATING unary RPCs to the activity trail by construction, so auditing a state change is a structural default of the mount rather than a per-handler line a developer must remember to add.
Package trailrpc is the audit interceptor for the daemon's Connect services: a connect.Interceptor that records MUTATING unary RPCs to the activity trail by construction, so auditing a state change is a structural default of the mount rather than a per-handler line a developer must remember to add.
viewer
Package viewer holds the magus.viewer.v1alpha1 wire contract: the code that maps captured DOMAIN events onto the versioned protobuf tool-page contract and encodes them for a browser (a URL-fragment blob for a finished run, or a live SSE stream), plus the viewer's filter DSL.
Package viewer holds the magus.viewer.v1alpha1 wire contract: the code that maps captured DOMAIN events onto the versioned protobuf tool-page contract and encodes them for a browser (a URL-fragment blob for a finished run, or a live SSE stream), plus the viewer's filter DSL.
Package hint is the hints home: everything magus renders to point a reader at a better next command.
Package hint is the hints home: everything magus renders to point a reader at a better next command.
Package hostmodules is the union of every host module magus exposes to Buzz: std's own self-registering set (the 24 modules still living flat in std/*.go) plus std/encoding's nine explicitly-aggregated leaf packages (base64, csv, hex, ini, json, toml, url, xml, yaml).
Package hostmodules is the union of every host module magus exposes to Buzz: std's own self-registering set (the 24 modules still living flat in std/*.go) plus std/encoding's nine explicitly-aggregated leaf packages (base64, csv, hex, ini, json, toml, url, xml, yaml).
Package httpx owns the loopback-only HTTP server core and the DNS-rebind guard shared by magus's daemon-facing HTTP surfaces.
Package httpx owns the loopback-only HTTP server core and the DNS-rebind guard shared by magus's daemon-facing HTTP surfaces.
Package interactive provides project scoring and session-state persistence for the magus x shorthand command.
Package interactive provides project scoring and session-state persistence for the magus x shorthand command.
difftui
Package difftui is the terminal client of the shared diff session: the same changeset the console's Diff surface renders and an agent joins over MCP, read with a keyboard.
Package difftui is the terminal client of the shared diff session: the same changeset the console's Diff surface renders and an agent joins over MCP, read with a keyboard.
screen
Package screen is a terminal emulator: it consumes an escape stream and reconstructs the grid a reader would be looking at.
Package screen is a terminal emulator: it consumes an escape stream and reconstructs the grid a reader would be looking at.
tty
Package tty provides terminal-agnostic primitives: scroll regions, file-descriptor classification (TTY vs pipe vs regular file), and the picker.
Package tty provides terminal-agnostic primitives: scroll regions, file-descriptor classification (TTY vs pipe vs regular file), and the picker.
Package interp compiles and runs magusfile sources via the Buzz scripting backend.
Package interp compiles and runs magusfile sources via the Buzz scripting backend.
bindings
Package bindings registers the Go-backed modules (magus, std: os, platform, fs, vcs, env, crypto, json, log, http, archive) available to every magusfile script.
Package bindings registers the Go-backed modules (magus, std: os, platform, fs, vcs, env, crypto, json, log, http, archive) available to every magusfile script.
bindings/gen
Package gen is the generated native-to-Buzz adapter layer.
Package gen is the generated native-to-Buzz adapter layer.
engine
Package engine defines the Engine and Session interfaces that all scripting engine implementations must satisfy, along with the engine registry.
Package engine defines the Engine and Session interfaces that all scripting engine implementations must satisfy, along with the engine registry.
engine/buzz
Package buzz adapts the standalone Buzz interpreter (magus/gopherbuzz) to magus's engine.Engine/engine.Session interfaces and registers it under the "buzz" key.
Package buzz adapts the standalone Buzz interpreter (magus/gopherbuzz) to magus's engine.Engine/engine.Session interfaces and registers it under the "buzz" key.
Package jobs is the registry of the daemon's background maintenance jobs: the single source of truth that maps a job's stable name to the worker argv the daemon runs for it.
Package jobs is the registry of the daemon's background maintenance jobs: the single source of truth that maps a job's stable name to the worker argv the daemon runs for it.
Package journal captures one magus invocation as a structured stream of events - the journal a run produces.
Package journal captures one magus invocation as a structured stream of events - the journal a run produces.
Package langservice provides editor language features - completion and hover - for Buzz magusfiles, driven by a build-time snapshot of the magus host module surface (see cmd/langservice-manifest and manifest_data.go).
Package langservice provides editor language features - completion and hover - for Buzz magusfiles, driven by a build-time snapshot of the magus host module surface (see cmd/langservice-manifest and manifest_data.go).
Package ledger persists the lease ledger: the rows an orchestrating agent declares about the plan it is running, kept where a human can read them.
Package ledger persists the lease ledger: the rows an orchestrating agent declares about the plan it is running, kept where a human can read them.
Package maintenance is the daemon's built-in background maintenance scheduler: a low-key, idle-gated loop that runs the rotation and sync JOBS on their configured intervals when the daemon is quiet.
Package maintenance is the daemon's built-in background maintenance scheduler: a low-key, idle-gated loop that runs the rotation and sync JOBS on their configured intervals when the daemon is quiet.
Package memory is the durable, per-repository handoff journal: discrete, categorized records (one markdown file per entry, YAML frontmatter carrying the structured fields) plus a legacy cursor snapshot.
Package memory is the durable, per-repository handoff journal: discrete, categorized records (one markdown file per entry, YAML frontmatter carrying the structured fields) plus a legacy cursor snapshot.
Package notes is the workspace's human-authored knowledge store: discrete entries (one markdown file per note, YAML frontmatter carrying the structured fields) that attach to graph entities without being derived from any of them.
Package notes is the workspace's human-authored knowledge store: discrete entries (one markdown file per note, YAML frontmatter carrying the structured fields) that attach to graph entities without being derived from any of them.
Package observability provides OpenTelemetry instrumentation for magus.
Package observability provides OpenTelemetry instrumentation for magus.
otlp
Package otlp holds the concrete OpenTelemetry/OTLP provider that backs the observability.Provider interface.
Package otlp holds the concrete OpenTelemetry/OTLP provider that backs the observability.Provider interface.
Package playground is the browser front end for the Buzz playground: the terminal Console (command dispatch, completion, history, rendering to HTML rows), editor syntax Highlight, and the Share deep-link json.
Package playground is the browser front end for the Buzz playground: the terminal Console (command dispatch, completion, history, rendering to HTML rows), editor syntax Highlight, and the Share deep-link json.
Package proc implements the magus "process adoption" mechanism: child magus processes detect MAGUS_DAEMON_SOCKET and forward work over a Unix-domain socket RPC, sharing the parent's cache, logger, and concurrency budget.
Package proc implements the magus "process adoption" mechanism: child magus processes detect MAGUS_DAEMON_SOCKET and forward work over a Unix-domain socket RPC, sharing the parent's cache, logger, and concurrency budget.
endpoint
Package endpoint is the parsed-transport-address value type, split out of internal/proc as a leaf with no OS or daemon dependencies (only context/fmt/net/strings).
Package endpoint is the parsed-transport-address value type, split out of internal/proc as a leaf with no OS or daemon dependencies (only context/fmt/net/strings).
run
Package run is the shared subprocess helper for magus spells.
Package run is the shared subprocess helper for magus spells.
Package prompt assembles a prompt as a sequence of named sections.
Package prompt assembles a prompt as a sequence of named sections.
Package race detects filesystem race conditions across concurrently executing projects.
Package race detects filesystem race conditions across concurrently executing projects.
Package registry reads the signed file of release and end-of-life facts that `magus self refresh` fetches and everything else only ever reads from disk.
Package registry reads the signed file of release and end-of-life facts that `magus self refresh` fetches and everything else only ever reads from disk.
Package render contains graph presentation helpers: ASCII tree, DOT, and Mermaid formatters.
Package render contains graph presentation helpers: ASCII tree, DOT, and Mermaid formatters.
md
Package md is a small typed Markdown builder for magus's generated docs (MAGUS.md, the insight report).
Package md is a small typed Markdown builder for magus's generated docs (MAGUS.md, the insight report).
Package report writes per-task JSONL events for post-processing.
Package report writes per-task JSONL events for post-processing.
Package retry provides exponential-backoff retry helpers: Do runs an arbitrary operation with capped, context-aware backoff, and NewHTTPClient wraps an http.Client so idempotent requests retry on transport errors and 5xx responses (honoring Retry-After).
Package retry provides exponential-backoff retry helpers: Do runs an arbitrary operation with capped, context-aware backoff, and NewHTTPClient wraps an http.Client so idempotent requests retry on transport errors and 5xx responses (honoring Retry-After).
Package review records which changed files have been marked as read.
Package review records which changed files have been marked as read.
Package sandbox confines spell code to a workspace-bounded filesystem and environment.
Package sandbox confines spell code to a workspace-bounded filesystem and environment.
apply
Package apply builds per-workspace sandbox policies from config and owns the process-wide landlock application state.
Package apply builds per-workspace sandbox policies from config and owns the process-wide landlock application state.
env
Package env holds the environment half of a sandbox policy: the allowlist of variable names a child process may inherit and the scrubbing logic.
Package env holds the environment half of a sandbox policy: the allowlist of variable names a child process may inherit and the scrubbing logic.
filesystem
Package filesystem holds the filesystem half of a sandbox policy: the path allowlist (Ruleset) and path-shape checks consulted before touching the filesystem.
Package filesystem holds the filesystem half of a sandbox policy: the path allowlist (Ruleset) and path-shape checks consulted before touching the filesystem.
Package secret resolves credential references through a workspace's selected secret provider, and remembers the values it handed out so magus can keep them out of everything it persists.
Package secret resolves credential references through a workspace's selected secret provider, and remembers the values it handed out so magus can keep them out of everything it persists.
Package selfupdate downloads, verifies, and installs magus release binaries.
Package selfupdate downloads, verifies, and installs magus release binaries.
Package service supervises long-running shared services and their lifecycle.
Package service supervises long-running shared services and their lifecycle.
console
Package console is the pure application logic behind the browser Graph Explorer, dashboard, and log viewer.
Package console is the pure application logic behind the browser Graph Explorer, dashboard, and log viewer.
identity
Package identity derives the identity of a long-running service from its resolved process command, for three purposes:
Package identity derives the identity of a long-running service from its resolved process command, for three purposes:
Package serviceaudit bridges magus's resolved projects to the pure near-duplicate detector in internal/identity.
Package serviceaudit bridges magus's resolved projects to the pure near-duplicate detector in internal/identity.
Package sessions is the append-only record of what magus sessions did, kept where every worktree of a repository can read it.
Package sessions is the append-only record of what magus sessions did, kept where every worktree of a repository can read it.
Package share implements the daemon side of "share to phone": an on-demand, time-boxed LAN listener that serves the console's READ surface to a phone on the same network, guarded by a single short-lived read-only token.
Package share implements the daemon side of "share to phone": an on-demand, time-boxed LAN listener that serves the console's READ surface to a phone on the same network, guarded by a single short-lived read-only token.
Package symbols distills a SCIP index file into the language-agnostic types.KnowledgeSymbol shape the knowledge graph ingests.
Package symbols distills a SCIP index file into the language-agnostic types.KnowledgeSymbol shape the knowledge graph ingests.
sys
mem
Package mem reads the memory of the machine magus is running on, and of the process trees it starts there.
Package mem reads the memory of the machine magus is running on, and of the process trees it starts there.
pid
Package pid answers whether a recorded process is still running.
Package pid answers whether a recorded process is still running.
Package trail is the magus activity trail: a durable, append-only record of consequential actions taken against the daemon - who did what, and did it succeed - kept next to the execution journal under a base directory.
Package trail is the magus activity trail: a durable, append-only record of consequential actions taken against the daemon - who did what, and did it succeed - kept next to the execution journal under a base directory.
Package ward runs "kind-coherence" checks on a resolved op: it verifies that the op's argv does not contradict the op's declared kind.
Package ward runs "kind-coherence" checks on a resolved op: it verifies that the op's argv does not contradict the op's declared kind.
Package workspace holds the shared building blocks for opening a workspace: the WorkspaceRegistry and the project, spell, and target option constructors that a magusfile's register(...) calls produce, plus the Load accumulator for Open/Inspect.
Package workspace holds the shared building blocks for opening a workspace: the WorkspaceRegistry and the project, spell, and target option constructors that a magusfile's register(...) calls produce, plus the Load accumulator for Open/Inspect.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL