Skip to content
7mindPublic

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

ponygirls

image

A Nix flake that assembles a complete AI coding-agent workstation: the agent CLIs themselves, a set of Pi extensions, a sandbox that keeps agents away from the rest of your machine, quota dashboards so you know when a subscription runs dry, and the Home Manager / NixOS configuration that wires it all together.

Linux uses bubblewrap for sandboxing; macOS uses Seatbelt through claude-code-sandbox.

The big picture

Five kinds of thing live here, and they build on each other:

  1. Agents and tools — packaged CLIs you can run on their own: Pi, Codex, Claude Code, the pi-search-hub web-search package, the CodeGraph MCP server.
  2. Pi extensions — small TypeScript add-ons that make Pi nicer to drive: clickable model picking, latency stats, usage tables, long-running goals, subagents, background tasks, quota panes.
  3. The sandbox and its satellites — yolo, which runs any of the agents inside a locked-down sandbox with named profiles, plus helpers for containers, VMs, and terminal reattachment.
  4. The configuration — Home Manager and NixOS modules that install and configure all of the above declaratively, including the shared skills and context documents each agent reads.
  5. Shared services — Haystack memory, Manure artifacts, and Chronicle's searchable archive of harness sessions.

Every package is under packages.<system> and can be built or run standalone (nix build .#pi-coding-agent, nix run .#tokemon, …) — the modules are convenience, not a requirement.


Components

Coding agents and tooling

Package What it is
pi-coding-agent Pi — the terminal coding agent from earendil-works/pi, built from source at a pinned release, with its bundled provider/model registry. We carry a set of patches on top of upstream (OAuth force-refresh on HTTP 401, extension console output no longer garbling the TUI, surfaced settings-write errors, Retry-After retries, editor border widgets, footer options), each documented in nix/pkg/pi-coding-agent/package.nix with the upstream issue it tracks.
codex OpenAI Codex CLI, packaged from the official release binaries (including its code-mode host) so no Rust build is needed and alpha tags track closely. nix/pkg/codex/update.sh bumps it.
claude-code Anthropic Claude Code, packaged from the official per-platform native npm artefacts and made Nix-compatible (the Bun single-file executable is left byte-identical except for the dynamic-loader fixup). update.sh bumps it.
pi-search-hub Vendored metasearch with main, always-included fallback, and configured native-provider tiers; shared RRF/source attribution, web_read fallback, and /websearch with separate Search engines, Fetchers and Test search tabs. Ranking trials retain k=60 while correcting fusion invariants. No search/fetch status-bar entries.
codegraph CodeGraph — a semantic code-intelligence MCP server (tree-sitter knowledge graph over your repositories) from colbymchenry/codegraph. Upstream ships no Nix support, so this is a vendored build against this flake's nixpkgs.
tui-tmux Pinned tmux under a distinct name, requiring a private absolute -S socket and ignoring personal tmux configuration. Installed by Home Manager on the host and inside yolo; bypasses the clipboard-only tmux shim without exposing the host server. The shared tui-testing skill covers interactive Pi, Claude Code, Codex, and other TUIs.

Pi extensions (nix/pkg/pi-extensions/)

TypeScript extensions loaded by Pi. Each is a self-contained file or directory with its own tests; the Home Manager module loads them all, and ./pi-test runs Pi against the copies in this checkout without deploying anything. Panes, badges, key hints and command-line output follow one set of interface conventions, implemented by the shared @ponygirls/pi-ui kit.

Extension What it does
ponygirls-yolo-badge Shows an amber YOLO warning on the prompt editor’s top-left border unless the yolo launcher marks the process with SMIND_SANDBOXED=1. Falls back to an amber ! if Pi only gives it one to three cells. It’s an indicator, not a sandbox check or permission control.
ponygirls-model-picker Compacts pi's footer into one line (path, session, native stats) and hides its model suffix (setFooterOptions), and keeps a clickable model / thinking-effort indicator on the input border (bottom right, e.g. mimo-v2.6-pro ⌃⇧M • high ⌃⇧E) with the ctrl+shift+m / ctrl+shift+e shortcuts that open the same menus. All shows the latest generations by default; ctrl+a toggles older models without changing saved favourites.
ponygirls-openai-fast /fast on|off|status requests OpenAI priority processing (openai and openai-codex) without changing the model or reasoning effort. Defaults to on; the preference persists in Pi's agent directory as openai-fast.json. Status distinguishes the requested tier from the provider-reported tier; priority is not guaranteed and may cost more.
ponygirls-model-stats Measures every provider response (time to first token, total span, decode tok/s) and shows per-model distributions in the /perf pane, one period at a time.
ponygirls-usage The /usage screen: period tabs (today / week / 30 days / all time) with a cost table of providers and, indented under each, their models, and a global input-size distribution view (chart or table).
ponygirls-codex-risk-retry Automatically requests up to two continuations after Codex’s specific cybersecurity-risk flag, with visible, persisted scope clarification. The budget follows the latest user message on the active branch (or the branch’s entire history when there is no user message), survives reloads and compaction, and respects cancellation. It does not rewrite the task or handle model refusals.
ponygirls-codex-goals Codex-style session goals (/goal): a persistent objective with a token budget that the model is steered by — and unlike most goal systems, every goal instruction is a visible, persisted message in the session transcript, so nothing is said to the model off the record.
ponygirls-subagents Supervisor/worker subagents (/agents): durable asynchronous delegation to child agents running in separate processes, with an inspector screen showing the agent tree and live transcripts, attributed messaging, interruption/resumption, optional reviewer validation gates, per-child tool brokering (direct or in a bubblewrap sandbox), and Git worktree workspaces.
ponygirls-historian Opt-in, tool-less journal worker for significant research, experiments and discoveries. Shared project journals live outside repositories; default OFF, switched on per session, trusted project or globally with an explicitly selected provider and model; evidence-linked revisions and coverage gaps.
ponygirls-chronicle The local Chronicle collector daemon in Pi: a row in /pony and the /chronicle pane with its state (collecting, paused, not running, failing), the last scan, the queue and whether the current project is collected; /chronicle pause, resume, exclude and include are the collector's own durable controls. It reaches the daemon only by running chronicle-collector, and shows a quiet row where no collector is installed or configured.
ponygirls-bg-tasks Background shell tasks: a bg_task tool for long-running commands, a /bg screen to read their terminal output, and completion notices that wake an idle session.
ponygirls-tokemon Provider quota info inside Pi: a tokemon tool for the model (how many credits are left before it plans a big refactor) and a /tokemon pane, plus a small quota widget on the input border (top right). Covers the providers the running Pi is configured for. The tool lists the latest model generations with include_models: true; add include_older_models: true for the full list.
ponygirls-tools-explorer The /tools pane: every tool the session has registered (built-in, extension, package and MCP tools, declared to the model or deferred) with its state, its source, an estimate of what its definition costs in context, and its parameter schema. Loads and unloads tools for the session; token ratios are measured per model family and can be re-measured with one script.
ponygirls-pony The /pony pane (ctrl+alt+p): one overview of the extensions that offer it an entry (18 today: goal, agents, tasks, inbox, Blabber, Cuckoo, Historian, the Chronicle collector, compaction, context archive, code index, quotas, usage, performance, tools, model, fast mode, web search). One row each with its state, the selected one's essential facts under its row, and keys that open its panes and settings by its own commands. It lists the extensions that are loaded and offer an entry; none of them depends on it, and it does not depend on any of them.
ponygirls-quirk-kimi-401-retry Works around a Pi defect with Kimi coding OAuth: short-lived access tokens are not refreshed on an API-level 401, so a perfectly valid subscription dies mid-turn. This re-drives the turn after a bounded re-auth once Pi has settled.

Quota dashboards

Package What it is
tokemon A terminal dashboard (Python + rich) showing quota and billing state across every provider account you use — Claude, Codex/ChatGPT, GitHub Copilot, Kimi, MiniMax, OpenRouter, Vercel, xAI, ZAI — including accounts discovered through yolo profiles and Pi's credential store. Live polling, colourised state (ok / low / EXHAUSTED / unlimited), reset times.

The sandbox and web tooling

Package What it is
yolo The sandbox launcher. yolo claude, yolo codex, yolo pi, yolo shell, or yolo cmd <anything> runs the command inside a bubblewrap sandbox: a private /dev, a cleared environment, your project directory bound read-write and little else. Everything an agent can reach is explicitly granted — capabilities can be added or removed per run with tags (gpu, display, vm, audio, codegraph) and ad-hoc --ro / --rw / --env flags, plus --bind SRC,DST / --ro-bind SRC,DST to remap a host path onto a different sandbox path (Linux; a missing SRC refuses the launch). Named profiles (--profile work) give each agent an isolated set of credentials, settings, and session history under ~/.config/yolo/, so one machine can hold work, personal, and throwaway identities; --auth-override lets one profile borrow another's credentials. A host-side clipboard broker keeps tmux load-buffer/save-buffer working across the boundary without exposing host tmux. CodeGraph indexes are prepared before Claude/Codex launch by a sandbox hook; Pi prepares its index asynchronously through its registry-driven extension. --disable=codegraph skips both automatic setup paths for one launch without disabling the MCP server. A launch prints nothing of its own before the tool starts; --trace (or YOLO_TRACE=1) prints the timestamped launch steps. Setting smind.hm.dev.llm.yolo.codegraph = null removes yolo's package, bootstrap hook, and prompt contribution, not Pi's independent integration.
reattach-llm Reattaches running Claude / Codex terminal sessions into an llm tmux session, so agent terminals survive SSH disconnects and can be re-entered later.
crawl4ai (Linux) Crawl4AI — the web-crawling library plus its self-hosted API/MCP server (Playwright Chromium, SSE at /mcp/sse).
crawl4ai-mcp A tiny stdio MCP client that proxies to the Crawl4AI SSE endpoint, keeping the API token out of process arguments and out of the Nix store.

On macOS, yolo resolves to yolo-darwin: the same launcher idea implemented with Seatbelt (via claude-code-sandbox) — per-profile isolation of Claude Code, Codex, and Pi configuration and credentials on a single user account. Its subcommands (claude, codex, pi, shell, cmd) and profile management match the Linux tool; the bubblewrap-only capabilities do not apply.

Credential/profile overlays without isolation (Linux)

yolo --cowboy-ride --auth-override pi:work pi  # host state, work credentials
yolo --cowboy-ride --profile work pi          # full work profile
yolo --cowboy-ride --profile personal --auth-override pi:work pi

--cowboy-ride provides no security isolation: the host filesystem is read-write with device access, host PID/network visibility and inherited environment (including host sockets and credential variables). Bubblewrap is used only for mount overlays. --profile retains its usual behavior for all supported agents, including shared read-only managed assets; --auth-override replaces only the selected agent's credentials file, live and read-write, so refreshes update the source profile. Pi's override covers its entire auth.json. Inherited credential variables still apply; unset them if they would bypass the desired file-based identity. Selected agents' home-directory variables (CLAUDE_CONFIG_DIR, CODEX_HOME, PI_CODING_AGENT_DIR) are routed to the mounted paths so inherited values cannot bypass the overlays. Explicit --env values take precedence over that routing. Host credentials remain accessible by their other paths: this is identity selection, not credential protection.

Sandbox hooks (host and guest), prompt extensions, declarative sandbox binds/environment/secrets/packages and clipboard forwarding are omitted; no sandbox markers are added (inherited outer-sandbox markers are preserved). The agent's own configuration/hooks still apply. Explicit --env, binds, and resource limits remain usable; resource limits are off by default, and launching from $HOME is allowed. Shell history uses host defaults. Unprivileged bubblewrap still needs mount/user namespaces: supplementary-group access and privilege escalation may differ from a direct host launch. This mode cannot escape restrictions of a sandbox it was itself launched inside.

Validation: python3 nix/pkg/yolo/cowboy-ride-test.py -v checks the CLI's bubblewrap arguments; add --real for real bubblewrap filesystem, credential refresh, profile-state, environment and namespace acceptance on Linux.

Session history: Chronicle

Package What it is
chronicle (Linux) Scala 3/distage/logstage native server: authenticated MCP search, durable session ingestion, LLM-guided source-backed chunks, PostgreSQL full-text + pgvector search, and a Baboon/WebSocket dashboard. Static users mint scoped agent tokens and share through groups.
chronicle-collector Opt-in TypeScript user daemon/CLI for Claude, Codex and Pi histories, including yolo profiles and subagents. Private durable spool, pre-upload redaction, exact retries and honest quiescent-snapshot evidence.
chronicle-web Responsive TypeScript dashboard with transcript/source navigation, access management and visible heartbeat-based connection recovery.

Start with the server README and deployment runbook. nix develop .#chronicle provides the pinned toolchain. MCP access and collection are separate Home Manager opt-ins; neither deployment nor real-history uploads happen during builds/tests.

Unified Scala services

Chronicle, Haystack and Manure are independent Scala/distage/cats-effect/http4s applications with separate PostgreSQL databases, credentials and authorization. See indexing preferences for server defaults, self-service choices, and administrator overrides.

The common sbt build and pinned dependency lock live at repository root:

nix develop .#backend --command bash scripts/backend-sbt.sh 'chronicleServer/compile' 'haystackServer/compile' 'manureServer/compile'
# Inner loop: the shared modules' suites on an owned PostgreSQL cluster, and the account web UI:
nix develop .#chronicle --command shared/scripts/test.sh
# Full verification of all three services and the cross-service checks (`scripts/verify <service>` for one):
scripts/verify all

What each level proves, and the on-demand checks, are in the "Validation" section of AGENTS.md.

The native Haystack, Manure and Blabber executables are built by default for x86-64 level 3 with the SHA extensions (nativeCpuTarget below). The checks that run such a default executable in the build sandbox (haystack-native, haystack-clickhouse-native, haystack-browser, haystack-module-config, manure-native, manure-client, manure-config, blabber-native, blabber-contract-native, blabber-hm-server) need a builder CPU with those features. The virtual-machine checks that run one (haystack-clickhouse-vm, onDemand.manure-vm, onDemand.manure-portable-root) run under software emulation with the test driver's CPU model (-cpu max), which has them; with hardware acceleration (KVM) the guest gets the host's CPU, so the host needs them too. manure-posix-acceptance runs a probe still built for the oldest baseline.

Restart acceptance (on demand, not part of verify): scripts/restart-acceptance.sh runs the three service packages of the tree against a PostgreSQL cluster of its own and stops, restarts, fences and occupies around them (a start before PostgreSQL and during "starting up", restarts under indexing load, terminated and fenced roles, an occupied port, connections per 1,000 transactions); its header has the invocation and the pass rules. Run it when service start-up, database connection handling or job recovery after database failures change.

Shared modules provide one compiled Baboon runtime, bounded JDBC transactions and credential reads, lossless JSON, model HTTP transport, and fenced PostgreSQL retrieval/publication. Domain authorization, document policies and migration semantics stay service-owned. Chronicle retains both of its search contracts. Manure's manure/server is the confined POSIX/JNI storage library; the actual application is manure/backend, including PostgreSQL metadata, durable uploads, grants and recovery. Native storage targets x86-64 Linux; Manure's standalone CLI/MCP client package does not require that server runtime.

Haystack and Manure each expose one current Baboon contract; their owned clients move with it without historical wire adapters. Chronicle retains its documented versioned search contracts. Stored documents, credentials and acknowledged writes remain migration invariants. See Haystack's server/configuration guide, and Manure's backend guide. Builds/tests use disposable fixtures; deployment and production-data migration are explicit operator actions.

Service command-line clients

Package Commands and scope
manure-clients manure: artifact upload/download, listing, metadata and password management; also includes the stdio MCP adapter.
chronicle-cli chronicle: archive/search/content, explicit ingestion, activity, accounts and application management; typed rpc covers the current operation catalog.
haystack-cli haystack: documents, search/retrieval, history, CAS writes and recovery, accounts/tokens and bounded live changes.

These packages are standalone clients, not server deployments; they do not need the server/Graal runtime. Output is human-readable by default, including pipes. Pass --json before or after the command for automation; diagnostics use stderr and nonzero exit codes. Haystack's bounded watch --json is an explicitly framed NDJSON stream rather than one JSON document.

nix run .#manure-clients -- --help
nix run .#chronicle-cli -- --help
nix run .#haystack-cli -- --help

The configured CLI wrappers installed by enabled Home Manager modules supply lazy URL/token-file defaults without reading credentials for help or overriding runtime sources. Haystack's wrapper also passes --allow-http only when the configured URL is spelled http://127.0.0.1, http://localhost or http://[::1] (lower case), with or without a port and with or without a trailing slash, which the CLI refuses without the flag. Human account cookies are separate from bearer credentials. Chronicle's bearer read/ingest commands use explicit --auth bearer; Haystack documents its --auth token|session selection. Private CLI state is not automatically exposed to agent sandboxes: use a separate explicitly bound persistent directory for agent recovery state, not a host human login directory. Builds/tests neither collect real histories nor deploy services.

See the Manure CLI guide, Chronicle CLI guide and Haystack CLI guide for command coverage, authentication, stream framing, and uncertain-operation recovery.

Agent content

Package What it is
llm-skills The shared skill set — progressive-disclosure instruction documents (SKILL.md with metadata) every agent can be handed: baboon, code-quality-review, constructive-test-taxonomy, dual-tests, environment, flake-mass-upgrade, flake-upgrade, haystack-skills-sort, independent-mutation-review, izumi, query-filters, resilient-ws-ui, subagent-campaign, tass, tui-testing. Metadata is validated at build time.
llm-contexts The shared context fragments: the general context every agent reads (CLAUDE.md / AGENTS.md memory) and Pi's repo-agnostic operating manual (appended into Pi's system prompt).
llm-context-with-env The general context combined with the sandbox-environment skill, for hosts running agents inside yolo.

The Home Manager client modules of the three services add their own text for agents when they are enabled; it lives beside the modules, not in these packages:

Client module AGENTS.md section Skills Line Pi lists the MCP server by
Haystack (nix/hm/haystack.nix) nix/hm/haystack/context.md haystack, haystack-github-accounting, haystack-skill-drafts (nix/hm/haystack/skills/) nix/hm/haystack/listing.txt
Chronicle (nix/hm/chronicle.nix) nix/hm/chronicle/context.md recall-sessions (nix/hm/chronicle/skills/) nix/hm/chronicle/listing.txt
Manure (nix/hm/manure.nix) nix/hm/manure/context.md manure (manure/skill/SKILL.md) nix/hm/manure/listing.txt

For Haystack, Pi also declares the tools that only read (get, search, retrieve) to the model without tool_search, and nix/hm/pi.nix adds them to the default of pi.subagentsAllowedTools when the Haystack client is enabled; put stays behind tool_search. The record types these texts ask agents to write are described in haystack/docs/record-types.md.


Configuration

Home Manager: homeManagerModules.dev-llm

One module, smind.hm.dev.llm.*, that turns a user account into an agent workstation. It configures Claude Code, Codex, and Pi (packages, settings, default models, MCP servers), installs the sandbox, and merges shared content. Switch the whole thing on with:

inputs.ponygirls.url = "github:7mind/ponygirls";

# home.nix
imports = [ inputs.ponygirls.homeManagerModules.dev-llm ];
smind.hm.dev.llm.enable = true;

The main knobs (all under smind.hm.dev.llm):

  • models — default model and reasoning effort per harness. Out of the box: Codex on gpt-6.1-sol (medium effort), Claude Code on the current opus alias (high effort), Pi on xiaomi-token-plan-ams / mimo-v2.6-pro. Pi follows fullscreenTui.enable, which defaults to fullscreen mode.
  • assetBundles — contribute skills, slash commands, subagent definitions, and memory fragments; everything is merged and delivered to all three agents (merged.skills, merged.commands, merged.agents, merged.contextText expose the result).
  • commitPolicy — shared commit guidance for Claude Code, Codex, and Pi, independent of generalContext.enable. Defaults to "no-preference", which emits no commit guidance. "no-commits" requires an explicit user request before creating commits. Set smind.hm.dev.llm.commitPolicy = "commit-by-default"; to commit completed, verified task changes by default unless the user says otherwise, limited to the agent's own changes. This does not authorize pushing, force operations, or history rewriting.
  • worktrees.enable — opt-in task-worktree guidance for all three harnesses (default false), independent of generalContext.enable. Set smind.hm.dev.llm.worktrees.enable = true; to work under the main checkout's ignored .worktrees/, verify changes, and merge back safely according to commitPolicy. The guidance preserves user changes and leaves worktrees intact when integration is unsafe. It is prompt guidance, not filesystem enforcement. The existing general rule for concurrent subagent worktrees remains separately controlled by generalContext.sections.tools.rules.worktree-isolation.enable.
  • generalContext — disable or customize the built-in general guidelines shared by Claude Code, Codex, and Pi. Every section has enable, text, and order options, with finer policy flags under selected sections' rules; integration guidance and contributed assets remain independent. See the examples below.
  • pi.providers.<name>.enable — opt-in inference provider packages for Pi (Claude Code, xAI/Grok, Ollama Cloud, …). Set smind.hm.dev.llm.pi.providers.claude-code.enable = true; to load the pinned Claude Code provider from the Nix store, without Git/npm installation at Pi startup. It uses the existing Claude Code login, including the active yolo profile.
  • crawl4ai — register the Crawl4AI MCP endpoint with Claude Code, Codex, and Pi via the shared programs.mcp registry, without writing the API token into the Nix store.
  • notify.* — Matrix notifications for long background turns in Codex, Claude Code, and Pi. Completion alerts require at least 60 seconds and an unfocused terminal by default; headless runs count as background.
  • yolo.* — sandbox policy: extra read-only / read-write paths, device binds (e.g. GPU render nodes), prompt fragments and pre-start hooks keyed by suppression tags, session and secret variables (secrets are composed into a single file bound into the sandbox, never passed through argv), extra packages on the sandbox PATH, the optional KVM VM capability (yolo.vm.enable) — QEMU and cloud-image utilities inside the sandbox plus /dev/kvm and a persistent state directory, so an agent can run its own NixOS/Ubuntu test VMs without host disks or a privileged VM manager — and forge tokens (yolo.forgeTokens), see below.

The general guidelines and rule fragments are kept together in general-context.nix, in document order. To customize them in your Home Manager configuration:

smind.hm.dev.llm.generalContext = {
  sections.hammer-mode.enable = false;
  sections.code-style.text = builtins.readFile ./coding-policy.md;
  sections.tools.order = 50;
  sections.core-principles.rules.strict-terminology.enable = false;
  sections.goal-driven-execution.rules.mandatory-plans.enable = false;
};

All sections and rules are enabled by default. text replaces the complete section, including its Markdown heading, and takes precedence over that section's rule flags. Disabling a section removes its heading and all its rules regardless of their individual flags. Sections sort by ascending order (defaults are 100, 200, …, 1200); equal orders sort by section name. Existing numbered headings are preserved when disabling or reordering sections. The supported section names, in default order, are:

  • hammer-mode
  • core-principles
  • references
  • think-before-coding
  • simplicity-first
  • surgical-changes
  • goal-driven-execution
  • reproduction-discipline
  • code-style
  • project-structure
  • tools
  • code-navigation — CodeGraph guidance for Claude Code, Codex, and Pi; disable it with generalContext.sections.code-navigation.enable = false.

Finer controls use generalContext.sections.<section>.rules.<rule>.enable. The supported rules are:

Section Rules
hammer-mode anti-sycophancy, evidence-discipline, inspection-claims, challenge-premises, abrasive-language, interaction-analysis
core-principles read-before-editing, concise-output, prefer-edits, avoid-redundant-reads, test-before-done, reproduction-first, strict-terminology, terminology-clarification, evidence-based-reasoning, operational-criteria, persistence, fail-fast, explicit-arguments, minimal-comments, root-cause-corrections, clarification, version-discipline
goal-driven-execution success-criteria, reproduction-first, mandatory-plans, delivery-flow
code-style type-safety, solid, no-globals, named-constants, internal-compatibility, composition, dry
project-structure documentation-paths, debug-script-paths, service-boundaries, ignore-rules
tools debugger-use, processor-detection, nix-store-traversal, batch-mode, worktree-isolation

Rule flags affect only their containing section. Within a section, a flag removes every fragment belonging to that rule; for example, hammer-mode.rules.anti-sycophancy.enable = false removes both the opening instructions and the later enthusiasm-mirroring instruction. Disabling every rule leaves the section heading; disable the section to remove it too.

Reproduction-first guidance appears in three sections. To remove all three occurrences:

smind.hm.dev.llm.generalContext.sections = {
  core-principles.rules.reproduction-first.enable = false;
  goal-driven-execution.rules.reproduction-first.enable = false;
  reproduction-discipline.enable = false;
};

generalContext.preamble replaces the title and introductory text. To remove all built-in general guidelines, including the preamble, and supply your own:

smind.hm.dev.llm.generalContext.enable = false;
smind.hm.dev.llm.memorySections = lib.mkAfter [
  (builtins.readFile ./agent-instructions.md)
];

This retains the independent commit policy, context from integrations and other modules, along with installed skills, commands, and agents. Pi's separate operating manual in APPEND_SYSTEM.md is unaffected. These options configure the Home Manager context; the standalone llm-contexts and llm-context-with-env packages continue to contain the default guidelines.

To configure harnesses only in named yolo profiles, leaving their native (default-profile) configuration unmanaged:

smind.hm.dev.llm.yolo.configureDefaultProfile = false; # default: true

Named launches such as yolo --profile work pi still receive the managed settings, MCP servers, skills, and extensions. Default-profile launches and bare harness commands use their own native configuration; binaries remain installed. This does not delete existing unmanaged configuration or credentials. Claude Code and Codex mutableSettings must remain disabled in this mode.

Integrations can extend programs.mcp, override programs.<agent>.package, contribute settings and files, and append generic yolo paths. (Our own CQ integration uses exactly those extension points from its own Home Manager module; ponygirls does not import CQ code or take a CQ flake argument.)

Users with the harness enabled are enrolled in the container socket's access group automatically.

Forge tokens: smind.hm.dev.llm.yolo.forgeTokens

Multiple GitHub/GitLab credentials with per-token usage policy. Each entry is injected as a secret session variable and announced by its own system-prompt fragment — account, instance, authorized targets and operations, free-form policy, instance-appropriate CLI/API usage — plus one shared confidentiality fragment when any token is configured, so agents know exactly which credential to use where, and what must never leave the machine.

smind.hm.dev.llm.yolo.forgeTokens = [
  {
    account = "autopeasant";
    forge = "github";
    tokenFile = "/run/agenix/github-token-autopeasant";
    default = true;               # the forge's default credential -> GH_TOKEN
    targets.publicOnly = true;    # public repositories only
    operations = [ "read" "issues" "pull-requests" ];
    policy = ''
      It belongs to a GitHub account created specifically for autonomous
      agentic work — it is NOT the user's personal account. Use it (via the
      `gh` CLI or the token directly) for GitHub operations carried out on
      the agent's own behalf, within the authorized targets above.

      For every verified defect attributable to a public GitHub-hosted
      project, autonomously file an issue in that project's GitHub tracker; do
      not ask for confirmation. When subagents are available, delegate this
      job to a subagent (reproduction, repository identification, duplicate
      search, sanitized report, and filing) instead of doing it inline. Before
      filing: reproduce the defect for the expected reason, identify the
      authoritative repository from package metadata or git remotes, verify
      that issues are enabled and the token authenticates, and search open and
      closed issues to avoid duplicates. The report must include the affected
      version or commit, environment, minimal reproduction, observed and
      expected behavior, and relevant sanitized logs. After filing, give the
      user the issue URL. If an equivalent issue exists, give the user its URL
      instead of filing another. Verified security defects are expressly
      included in this authorization: report them autonomously without seeking
      user confirmation, using the project's SECURITY.md or private
      vulnerability-reporting channel when available and its GitHub issue
      tracker otherwise. If filing cannot proceed, state the exact reason to
      the user.
    '';
  }
  {
    account = "acme";
    forge = "github";
    tokenFile = "/run/agenix/github-token-acme";
    targets.orgs = [ "acme" ];     # or instance = "git.acme.example" for GHES
    operations = [ "read" "issues" "pull-requests" ];
    policy = "Company account: company-internal issues and pull requests only; never use it for anything else.";
  }
  {
    account = "acme";
    forge = "gitlab";
    tokenFile = "/run/agenix/gitlab-token-acme";
    instance = "gitlab.acme.example";   # self-managed GitLab
    targets.orgs = [ "acme" ];
    operations = [ "read" "issues" "merge-requests" ];
  }
];

Conventions and behavior:

  • Env-var names: default = true yields the forge's canonical variable (GH_TOKEN / GITLAB_TOKEN); otherwise the name is derived as GH_<ACCOUNT>_TOKEN / GITLAB_<ACCOUNT>_TOKEN (uppercased account, -/. to _). An explicit envVar overrides the derivation. Names must be unique; at most one default per forge; pull-requests is GitHub-only and merge-requests GitLab-only — these and malformed account/repository names fail at evaluation time.
  • Targets combine as an intersection (publicOnly, orgs, repos); empty means any repository on instance. Operations are stated as an allowlist: anything not listed is declared not authorized.
  • Usage guidance is instance-appropriate: gh reads GH_TOKEN on github.com/ghe.com, GH_HOST + GH_ENTERPRISE_TOKEN on GitHub Enterprise Server; glab reads GITLAB_TOKEN, with GITLAB_HOST per invocation for self-managed instances; raw HTTPS with Authorization: Bearer / PRIVATE-TOKEN works everywhere.
  • Confidentiality (bug reports, PR/MR descriptions, comments, …) is covered by one shared fragment: nothing posted externally may expose credentials, personal data, private repository/organization names, instance hostnames, internal paths, codenames, business context, or co-worker identity; unreportable leaks go back to the user as a sanitized draft instead.
  • Suppression: each fragment carries [ "forge" <forge> <account> ] tags, so yolo --disable=acme (or --disable=forge) drops the note at launch — the token itself is still injected. when = false omits the note at eval time.
  • Policy-level only: the tokens are ordinary environment variables inside the sandbox. Nothing at the sandbox or network layer prevents a determined process from using one outside its documented scope; the fragments constrain agent behavior, not the machine.

Matrix notifications

smind.hm.dev.llm.notify = {
  enable = true;
  homeserver = "https://matrix.org";
  roomId = "!notifications:matrix.org";
  tokenFile = "/run/agenix/matrix-notify";
  minTurnSeconds = 60;
  onlyWhenUnfocused = true;
};

The token is read at runtime and exposed read-only inside yolo only when notifications are configured and enabled. Each client can be disabled through notify.codex.enable, notify.claude.enable, or notify.pi.enable.

Set notify.includeTmuxWindow = true; to append the originating window's index and available name, for example [tmux window 3: backend]. This is off by default; names may contain work context. Yolo captures these labels before isolation, without exposing the host tmux socket, so they reflect the window at launch. Outside yolo, the notifier queries the window containing its originating pane when sending. Missing window information leaves the notification unchanged. Restart existing yolo sessions after deploying this option so they capture the window snapshot.

With transport = "e2ee", delivery goes through matrix-nio instead: set sender and passwordFile, and the notifier provisions a per-host device automatically on first use (agent-notify-matrix --setup forces reprovisioning). Add recoveryKeyFile pointing at a file containing the account recovery key and provisioning also decrypts the account self-signing key from secret storage and signs the new device with it, so the device is cross-signed without a verification round-trip in Element; an already-provisioned device is cross-signed on its next send. Without recoveryKeyFile, the new device must be verified in Element once.

Interactive clients use terminal focus reports. Terminal multiplexers must forward those reports; tmux requires set -g focus-events on. Unknown focus suppresses alerts with a diagnostic. Set onlyWhenUnfocused = false for alerts based on duration alone, without the terminal wrapper. Claude permission requests obey the focus condition but do not wait for the duration threshold.

After activation, review and trust Codex's new UserPromptSubmit hook through /hooks; Codex skips new or changed user hooks until they are trusted. See the Codex hook trust documentation.

HTTPS protects notification messages in transit to the homeserver. These are ordinary m.room.message events, without Matrix end-to-end encryption, so homeservers can read their contents. Element's unencrypted-message indicator describes this lack of end-to-end encryption. Notifications include only the event, agent, and shortened session identifier. Repository names, agent responses, and other free-form hook text are omitted.

Home Manager server hosting (Linux)

Server hosting is separate from the existing MCP clients and Chronicle collector. The exports are inert until explicitly enabled and require a working user systemd manager; they do not configure host trust, firewall rules or enrollment. homeManagerModules.service-postgres provides the independent ponygirls.servicePostgres cluster. Define each application's database/role and runtime password file separately; disabling an application neither stops the provider nor deletes its database. Existing clusters are not automatically adopted: the provider uses a new marked PostgreSQL 18 state directory.

  • homeManagerModules.agenticServicesServer — user-owned SearXNG, Crawl4AI/Redis, optional native Haystack, Manure and Blabber, an nginx proxy and static publishing. Configure smind.hm.services.agentic: the state directory, listener/URLs, TLS files, runtime credential paths and optional external setup dependencies. SearXNG package/settings can be supplied by the consumer. For example:

    { config, inputs, ... }:
    let
      database = name:
        let connection = config.ponygirls.servicePostgres.connections.${name};
        in {
          inherit (connection) jdbcUrl readinessUnit;
          user = connection.databaseUser;
          passwordFile = connection.databasePasswordFile;
          limits.maxConnections = connection.maxConnections;
        };
    in {
      imports = [ inputs.ponygirls.homeManagerModules.agenticServicesServer ];
      ponygirls.servicePostgres = {
        enable = true;
        stateDirectory = "/home/alice/.local/state/ponygirls-postgres-18";
        databases = {
          haystack = { name = "haystack"; user = "haystack"; passwordFile = "/run/user/1000/secrets/haystack-db"; };
          manure = { name = "manure"; user = "manure"; passwordFile = "/run/user/1000/secrets/manure-db"; schemas = [ "public" "manure" ]; };
        };
      };
      smind.hm.services.agentic = {
        enable = true;
        stateDirectory = "/home/alice/.local/state/agentic-services";
        host = { hostname = "services.example.net"; address = "127.0.0.1"; };
        tls = { certificateFile = "/run/user/1000/services/cert.pem"; keyFile = "/run/user/1000/services/key.pem"; };
        crawl4ai.tokenFile = "/run/user/1000/secrets/crawl4ai";
        haystack = { agentTokenFile = "/run/user/1000/secrets/haystack"; database = database "haystack"; };
        manure = { agentTokenFile = "/run/user/1000/secrets/manure"; database = database "manure"; };
      };
    }

    Tokens remain runtime files, never Nix values. Existing operator credentials are preserved and a changed agent token is refused rather than silently rotated. Plain HTTP requires explicit host.scheme = "http" and a trusted private network. Manure uses same-origin path hosting: publish trusted content only. Static reads are unauthenticated; writes require a provisioned token. Neither the proxy nor disabled browser hooks provide Crawl4AI egress isolation.

    Haystack on ClickHouse. haystack.storage selects the store Haystack keeps its state in: "postgresql" (the default: the database options) or "clickhouse" (the clickhouse options: url, database, user, passwordFile, and optionally startWaitMs and readinessUnit). The module brings the options of the managed ClickHouse provider (ponygirls.serviceClickhouse, nix/clickhouse/README.md) as it brings the PostgreSQL provider's, and a key's connections.<key> is a value of the clickhouse option. Manure, Blabber and Chronicle have no such option yet and stay on PostgreSQL:

    { config, inputs, ... }:
    let
      manure = config.ponygirls.servicePostgres.connections.manure;
    in {
      imports = [ inputs.ponygirls.homeManagerModules.agenticServicesServer ];
      # Haystack's store: the key `haystack` of the managed ClickHouse.
      ponygirls.serviceClickhouse = {
        enable = true;
        stateDirectory = "/home/alice/.local/state/ponygirls-clickhouse";
        databases.haystack = { passwordFile = "/home/alice/.secrets/haystack-clickhouse"; createPassword = true; };
      };
      # Manure stays on PostgreSQL.
      ponygirls.servicePostgres = {
        enable = true;
        stateDirectory = "/home/alice/.local/state/ponygirls-postgres-18";
        databases.manure = { passwordFile = "/run/user/1000/secrets/manure-db"; schemas = [ "public" "manure" ]; };
      };
      smind.hm.services.agentic = {
        enable = true;
        stateDirectory = "/home/alice/.local/state/agentic-services";
        host = { hostname = "services.example.net"; address = "127.0.0.1"; };
        tls = { certificateFile = "/run/user/1000/services/cert.pem"; keyFile = "/run/user/1000/services/key.pem"; };
        crawl4ai.tokenFile = "/run/user/1000/secrets/crawl4ai";
        haystack = {
          agentTokenFile = "/run/user/1000/secrets/haystack";
          storage = "clickhouse";
          clickhouse = config.ponygirls.serviceClickhouse.connections.haystack;
        };
        manure = {
          agentTokenFile = "/run/user/1000/secrets/manure";
          database = {
            inherit (manure) jdbcUrl readinessUnit;
            user = manure.databaseUser;
            passwordFile = manure.databasePasswordFile;
            limits.maxConnections = manure.maxConnections;
          };
        };
      };
    }

    What the selection changes:

    • The configuration file gains storage and the section clickhouse (haystack/server/README.md, "Storage on ClickHouse"); with the default it is the file it was, byte for byte.
    • The migrate unit (check-config, then migrate) is ordered after and requires clickhouse.readinessUnit instead of PostgreSQL's, and the server requires the migrate unit as before. A restart of the ClickHouse server's unit, and a death of its process, therefore restart the key's unit, the migrate unit and the server (nix/clickhouse/README.md, "Lifecycle"), as a restart of PostgreSQL's does; a ClickHouse server that only stops answering for a while leaves the same Haystack process running, which answers 503 for what needs the store and serves again afterwards.
    • database is optional. Given too, it is rendered beside the ClickHouse section, so that one file names both stores (the migration between them reads both), and the service does not use it; not given, nothing of PostgreSQL is rendered. The same holds for clickhouse while PostgreSQL is selected. A store that is configured and not selected is not waited for, and its password file is not read: to prepare a cut-over, a host that serves on PostgreSQL can be given the ClickHouse provider (with a password the provider creates) and the clickhouse section in one activation. That activation restarts Haystack's set-up and server units once, because their configuration file changes, and the service serves again without a start by hand; nothing of the unselected store is waited for or read.
    • Selecting a store moves no data: a start on a new store starts empty. The data is carried by haystack-server migrate-store, offline, which migrateStore.enable gives a unit that only an operator starts (<prefix>-haystack-migrate-store.service, on NixOS haystack-migrate-store.service): deploy both sections with PostgreSQL still selected, stop the server, start that unit and read its result, then deploy storage = "clickhouse". A run that verified its copy writes one row into PostgreSQL's ledger of schema migrations, which retires that store: a generation that selects PostgreSQL does not start on it any more (its set-up unit fails with a line that names the ClickHouse store, and the server is not started). The way back is the command revert-store, for which the option gives two more units (…-haystack-revert-store.service, and …-haystack-revert-store-target-unreachable.service for a ClickHouse server that is gone): stop the server, start the unit, then deploy storage = "postgresql". PostgreSQL starts again as it was when it was migrated; what was written on ClickHouse since is not carried back. The server's guide has the procedure and what each step's failure leaves (haystack/server/README.md, "Through the Nix modules").
    • maxHeapMb bounds the native server's heap (-Xmx<n>m); without it the executable takes up to 80 % of the memory it sees. On ClickHouse the heap follows the corpus (the same guide, "Heap").
    • A start takes time that grows with what it has to project. The server visits every item before it listens. On ClickHouse an item whose projection the index holds costs a share of a page's reads, 1.5 to 1.8 s for a store of 3 000 items against 11.4 s on PostgreSQL; an item it has to project, as every item after an import or under a corpus policy of another name, costs 22 to 38 ms (haystack/server/README.md, "The projection at a start"). migrate does not grow with the store (about 0.13 s), so the migrate unit, a oneshot with a start bound of 180 s here and none on NixOS, is not concerned. The server's unit sets no Type= in either module family and has no readiness protocol: by systemd's default (exec on the pinned NixOS's systemd 262, simple on older ones) it counts as started once its process runs, and no start timeout applies after that, so a start of minutes is neither killed nor marked failed. For the same reason the unit is active before the server listens: until then the proxy answers 503 unavailable on /api/ and /mcp, a client of the backend port is refused the connection, and a unit ordered after it does not wait. Every start costs this again, and so does every restart or death of the ClickHouse server's unit, which restarts the server.
    • No heap bound. The native server takes a heap of up to 80 % of the memory it sees, the machine's or its control group's (same section: 439 MB resident after eight searches at once over 3 000 items; 179 MB with -Xmx256m as the executable's first argument, which works). The modules have no option for it yet.
    • No backup. The backup unit, its timer and its directory exist only while PostgreSQL is selected. No backup tool exists for ClickHouse, and a module warning says so at every evaluation. What an operator can rely on is a cold copy: stop ponygirls-clickhouse.service (the units that require it stop with it), copy the provider's whole state root with ownership and modes, then start Haystack's unit, <prefix>-haystack.service (NixOS: haystack.service), which starts the key's unit and the server through Requires. Starting ponygirls-clickhouse.service alone is not enough: it brings back neither the key's unit nor Haystack. The password files are kept separately. A copy taken while the server runs is not a backup.
    • Refused at evaluation: storage = "clickhouse" without the clickhouse options, PostgreSQL without database, a clickhouse.url the server would refuse (anything but http or https, user information, a path, a query or a fragment, a port outside 1 to 65535, a host that is no host name or address), a database name the server cannot write into a statement, a user that is not visible ASCII (the server also admits U+00A0 to U+00FF), a start wait outside 1 000 to 3 600 000 ms, a member the server's section does not have, and a password file that is no absolute runtime path. The password is one line of visible ASCII: it travels in an HTTP header.

    Blabber (smind.hm.services.agentic.blabber) is off by default and needs its own database (ponygirls.servicePostgres.databases.blabber); its options, accounts and proxy listener (port 8448) are described in Blabber's README, "Deployment".

    nativeCpuTarget chooses the CPU target of the native Haystack, Manure and Blabber executables the module builds (decision Q242). Its default on x86-64, { march = "x86-64-v3"; features = [ "SHA" ]; }, requires a CPU with x86-64 level 3 and the SHA extensions (a measured password sign-in of Blabber took 0.24 s instead of 0.93 s on the oldest baseline). As examples from general knowledge, not a check: AMD Zen and later and Intel Ice Lake and later generally have them, but low-power and older server lines of the same years can lack AVX2 or SHA; /proc/cpuinfo decides (avx2, bmi2, fma, sha_ni, ...). On a host without them set the oldest baseline, or the newest level the host has (x86-64-v2, haswell, ...):

    smind.hm.services.agentic.nativeCpuTarget = { march = "compatibility"; features = [ ]; };

    On a CPU without one of the target's features every command of the executable exits at once with status 1, so each service's …-migrate unit fails at its check-config, with this on standard error:

    The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, SHA, FMA, F16C].
    Please rebuild the executable with an appropriate setting of the -march option.
    

    The list holds every feature the executable requires, not only the missing ones (compare /proc/cpuinfo; SHA is sha_ni there). What the module runs is built for nativeCpuTarget, and an assertion holds it to that: a service package set explicitly from this packaging records its target and must record exactly the option's value; a package that records none (built elsewhere) is admitted only while nativeCpuTarget has its default value.

    The flake's exported packages haystack, manure and blabber, its OCI images oci-haystack and oci-manure, and the NixOS modules (nixosModules.haystack, nixosModules.manure) use the default target. A deployment builds one of them for another target with the package's override and its cpuTarget argument, for example inputs.ponygirls.packages.x86_64-linux.haystack.override { cpuTarget = { march = "compatibility"; features = [ ]; }; } (on NixOS as smind.services.haystack.package; for an image, pass it to lib.oci's haystack { package = …; }). Not affected, still built for the oldest baseline (-march=compatibility): Chronicle's and Rites' native executables and Manure's POSIX acceptance probe (nix/pkg/manure/posix-acceptance.nix).

  • homeManagerModules.chronicleServer — user-owned Chronicle, password-hash provisioning and daily backups, consuming an independently provisioned PostgreSQL/pgvector database. Configure smind.hm.services.chronicle.settings with application settings and database with the connection, complete finite limits, credential path and readiness unit. The migrate unit is ordered after database/setup readiness, not after model services. With a declared settings.embedding, or once an adoption is saved, migrate needs no model server. With a reported block (manifestUrl) and no saved adoption it asks the embedding server for its manifest and fails model-identity-unknown when it cannot reach it. For a first deployment with a reported block, the embedding server must answer before the migrate unit runs, and that is the operator's step: no option orders the migrate unit after a model server (serverDependencies orders the serving unit only; setupDependencies orders the setup unit, which the migrate unit follows, after the start of the units it names). Or the archive is started once with a declared block first, whose adoption is saved. passwords.NAME can derive credentials/NAME.pbkdf2 from an explicit runtime password and nonsecret revision file. Annotation/embedding endpoints, users, tokens and any model/GPU services remain consumer choices; settings.embedding is the server's own block, which declares its embedding identity or names the embedding server's manifest (manifestUrl), as Chronicle's operations guide describes under "The embedding identity". serverDependencies joins separately managed user units with restart propagation. The generated config.lib.ponygirls.chronicleServer.{proxyHttpConfig,proxyLocations} fragments can be included by an independently configured nginx listener.

  • homeManagerModules.embeddingServer — a user-owned vLLM embedding server on a loopback port, the one nixosModules.chronicle manages with models.embedding, for a host without root. Configure smind.hm.services.embeddingServer: the pinned weights (repository, revision, files with their SHA-256), servedModelName, apiKeyFile, cudaVisibleDevices, maxModelLength, the embedding space under identity (dimensions, sendDimensions, queryPrefix, documentPrefix) and the model's description under manifest, whose runtime is a text for people. The revision the server reports is generated from the weights and these options and holds nothing of package: another package of the runtime leaves the embedding space's name as it is, as for the role the NixOS module manages. The unit embedding-server-weights.service downloads the listed files once into embedding-server under xdg.stateHome and checks them at every start; embedding-server.service serves them, with its cache in embedding-server under xdg.cacheHome, and counts as started only when its readiness check has seen the server answer with the manifest generated from these options (embedding-manifest-v1, with the stamp X-Embedding-Space on a probe's answer). package defaults to this repository's packaged runtime (nix/pkg/chronicle/embedding-runtime.nix, unfree, x86_64-linux), which needs nvidiaDriverLibraryDirectory; the NVIDIA driver is the host's. package differs from its NixOS counterpart on purpose: the NixOS module starts bin/vllm of a supplied package, and this module starts the package's main program (meta.mainProgram), and bin/vllm when the package declares none. The reason is that the repository's own runtime must be started through its wrapper on a host that is not NixOS: the wrapper sets the NVIDIA driver's library path. An empty apiKeyFile means no authorisation. The module configures no client. The read-only options under client hold what one needs:

    { config, inputs, ... }: {
      imports = [ inputs.ponygirls.homeManagerModules.embeddingServer ];
      smind.hm.services.embeddingServer = {
        enable = true;
        nvidiaDriverLibraryDirectory = "/run/opengl-driver/lib";
        repository = "google/embeddinggemma-2";
        revision = "914f7f89142e33e77833254d9c9b90c3cef7303b";
        files = { "config.json" = "<sha256>"; /* every served file */ };
        servedModelName = "google/embeddinggemma-2";
        apiKeyFile = "/run/user/1000/secrets/embedding-api-key";
        cudaVisibleDevices = [ "0" ];
        maxModelLength = 8192;
        identity = {
          dimensions = 768;
          sendDimensions = false;
          queryPrefix = "task: search result | query: ";
          documentPrefix = "title: none | text: ";
        };
        manifest = {
          name = "EmbeddingGemma 2";
          nativeDimensions = 768;
          matryoshka = [ 768 512 256 128 ];
          pooling = "mean";
          runtime = "vLLM 0.34.0";
        };
      };
      # A client that reads the identity from the server:
      # inherit (config.smind.hm.services.embeddingServer.client)
      #   operationUrl manifestUrl credentialFile;
    }

For existing deployments, explicitly retain stateDirectory, unitPrefix, listener ports, static listing/auth names and external dependencies. Changing those values is a migration, not a harmless module rename. In particular, retain all existing credential files; these modules do not migrate databases or rotate operator credentials. Backups retain completed dumps for 14 days.

Indexing policy flags

Chronicle, Haystack and Manure accept three optional booleans in the server JSON indexing object: defaultEnabled (default true), allowOptIn and allowOptOut (both default false). The two permissions are independent of each other and of the default. Chronicle's existing indexing capacity and continuation settings stay in the same object.

Set these under smind.services.<service>.indexing on NixOS, smind.hm.services.agentic.<service>.indexing for Haystack or Manure on Home Manager, or smind.hm.services.chronicle.settings.indexing for Chronicle on Home Manager. These flags are parsed configuration only; they do not yet change runtime indexing behavior.

The modules retain admin: true for configured browser administrators even when accounts.enable is off so indexing administration can use the same identity. This does not enable imperative account management or provision an accounts key. In agentic Home Manager, operator.admin defaults to true for Haystack and Manure.

NixOS modules

  • nixosModules.service-postgres — the same typed provider policy on the host's single postgresql.service, with isolated application roles/databases, explicit schemas and logical backup/restore tooling. It does not adopt an existing unmarked cluster or rotate existing role passwords.

  • nixosModules.service-clickhouse, homeManagerModules.service-clickhouse — a managed single-node ClickHouse on loopback, with one database and one restricted user per key (ponygirls.serviceClickhouse): the store of the ClickHouse storage adapters. It refuses a state root it did not mark and never rotates a password; see nix/clickhouse/README.md. The keys of one server are not isolated from each other (a known defect, stated at the head of that file): put on one server only services that may read each other's data. Haystack's modules import it and consume a key's connection (below, and "Haystack on ClickHouse" above); a configuration may import it beside them.

  • nixosModules.haystack — the native Haystack server (smind.services.haystack): declared users with token digests loaded as credentials, a set-up unit (check-config, then migrate) before the server, an optional nginx virtual host and, on PostgreSQL, pg_dump backups. The store is selected by storage, as under Home Manager: "postgresql" with the database options, or "clickhouse" with the clickhouse options. On the managed ClickHouse:

    { config, inputs, ... }:
    {
      imports = [ inputs.ponygirls.nixosModules.haystack ];
      ponygirls.serviceClickhouse = {
        enable = true;
        databases.haystack.passwordFile = "/run/secrets/haystack-clickhouse";
      };
      smind.services.haystack = {
        enable = true;
        publicUrl = "https://memory.example.net";
        storage = "clickhouse";
        clickhouse = config.ponygirls.serviceClickhouse.connections.haystack;
        users.alice = { type = "human"; tokens.laptop.tokenHashFile = "/run/secrets/haystack-alice-sha256"; };
      };
    }

    The password reaches the provider's unit and Haystack's two units through LoadCredential (in Haystack's as clickhouse-password, which the configuration names as $CREDENTIALS_DIRECTORY/clickhouse-password), and haystack-setup.service is ordered after and requires the key's readiness unit, ponygirls-clickhouse-database-haystack.service. What else the selection changes, the absence of a backup and what is refused are as in "Haystack on ClickHouse" above. The units that set up and serve load the selected store's password only: a section given for the other store names its place ($CREDENTIALS_DIRECTORY/database-password or …/clickhouse-password) without the file being loaded or read, so it need not exist yet when they start.

  • nixosModules.chronicle — the native archive/search server, consuming an explicit database connection, runtime credentials and optional reverse proxy. homeManagerModules.chronicle configures MCP access and the opt-in Linux systemd user collector; it is also included in dev-llm. With MCP access it contributes an AGENTS.md section, the skill recall-sessions and the line Pi lists the server by; outside dev-llm each is contributed where the composition has the option it is contributed to (assetBundles of that module's tools.nix, pi.mcpServerOverrides of its pi.nix). In Pi the server's Authorization header falls back to the configured tokenFile when neither a runtime CHRONICLE_TOKEN nor a runtime CHRONICLE_TOKEN_FILE is nonempty, so a direct pi launch connects without chronicle-run; Claude Code and Codex still take the token from their environment (chronicle-run, yolo).

  • nixosModules.podman — a dedicated rootless Podman service account (podsvc-llm) with a group-restricted Docker-compatible socket at /run/podman-llm/podman.sock (mode 0660). Agents get container access through that socket only; the rootful API socket is masked. The Home Manager module forwards the restricted socket into yolo and sets up the client environment. Host acceptance test: nix/tests/test-rootless-podman.sh.

    imports = [ inputs.ponygirls.nixosModules.podman ];
    smind.containers.docker.enable = true;
  • nixosModules.crawl4ai — runs the Crawl4AI API/MCP server (Playwright Chromium, Redis, SSE at /mcp/sse). It does not isolate egress by itself.

  • nixosModules.crawl4ai-isolation — the host-side nftables bridge filter for the Crawl4AI container: it may serve answers and reach the public internet, and may not open connections to local or non-global addresses, including the host.


Working on ponygirls itself

  • ./pi-test — run Pi with this checkout's extensions instead of their deployed copies, no home-manager switch needed. Everything else (packages, settings) matches your live ~/.pi/agent.
  • nix flake check — module evaluation assertions (podman wiring, crawl4ai wiring, the harness and service modules) plus the unit/integration test suites for every Pi extension, tokemon, and the yolo scripts.
  • nix/tests/test-yolo-vm.sh — host acceptance test for the KVM VM capability; run after activating a configuration with smind.hm.dev.llm.yolo.vm.enable = true.
  • nix/tests/test-rootless-podman.sh — verifies the podsvc-llm service account is genuinely restricted (no privileged groups, no sudo, no bind-mount escape into host secrets).

Platform support

  • x86_64-linux: everything, including yolo (bubblewrap), containers, and the VM capability. The native Haystack, Manure and Blabber executables (and the OCI images of Haystack and Manure) need x86-64 level 3 with the SHA extensions by default, and so does a machine that runs their checks (see the verification notes and nativeCpuTarget above).
  • aarch64-darwin: the agents, Pi extensions, tokemon, content packages, and yolo (= yolo-darwin, Seatbelt), plus Chronicle's collector CLI/dashboard. The Chronicle native server and managed collector daemon are Linux-only.

Runtime credentials: Haystack and Manure

Home Manager configures service URLs and optional tokenFile paths, never literal secrets. Existing file-backed configurations continue to work. Without a configured file, provide credentials at launch. For either service, one nonempty runtime source overrides the configured file fallback; two nonempty runtime sources are an error, even if they identify the same token. Empty values are unset. Tokens must be canonical, unpadded base64url encodings of 32 bytes (43 characters); files may contain exactly one additional final LF, nothing else.

# Read secrets at runtime, not in Nix expressions or shell command arguments.
IFS= read -r -s HAYSTACK_TOKEN; export HAYSTACK_TOKEN
haystack-run pi                         # direct harness launch
# Or use a runtime file instead:
unset HAYSTACK_TOKEN
HAYSTACK_TOKEN_FILE=/run/secrets/haystack-token haystack-run pi

IFS= read -r -s MANURE_TOKEN; export MANURE_TOKEN
manure whoami                          # packaged CLI wrapper
# Or use a runtime file instead:
unset MANURE_TOKEN
MANURE_TOKEN_FILE=/run/secrets/manure-token manure whoami

# The same runtime variables are resolved on the host for sandbox launches:
HAYSTACK_TOKEN_FILE=/run/secrets/haystack-token \
MANURE_TOKEN_FILE=/run/secrets/manure-token yolo pi

Do not place secret values in Nix options, generated configuration, --env arguments, or command-line literals. haystack-run requires a command and exports only the resolved HAYSTACK_TOKEN to it. Native remote MCP configuration uses that environment variable; direct harness launches need haystack-run to resolve file credentials. Manure's CLI and MCP wrappers apply the fallback lazily, preserving CLI help, unauthenticated public fetches and MCP initialization; the native clients validate credentials when needed. The Manure CLI resolves credentials before public fetches too: an unreadable or invalid selected fallback file still fails those commands, as with the previous file-backed configuration. For a credential-free public fetch use runtime-only configuration (tokenFile = null). No host session default for MANURE_TOKEN_FILE is exported, so a literal runtime token does not conflict with the configured fallback. Restart shells carrying old session defaults after an upgrade (or explicitly unset the obsolete variable).

Yolo transports literal tokens through its private composed environment file, not sandbox argv. Haystack file credentials are normalized to a literal token; Manure file credentials retain file transport with a read-only bind. Runtime Manure file paths must be absolute and single-line. The file remains read-only, not immutable: clients validate its current contents when read. Invalid or missing credentials fail yolo launch; direct Manure MCP initialization remains lazy and reports credential errors on tool calls. Runtime ambiguity exits 2 for direct clients/wrappers; yolo reports credential resolution failures as exit 3.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages