### Command examples for guides Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-07-agent-first-cli-surface.md Updated command examples to show in guides and help. ```bash almanac agents list almanac agents use claude almanac agents model claude claude-opus-4-6 almanac config list --show-origin ALMANAC_AGENT=codex almanac capture ``` -------------------------------- ### CLI Command Examples with Cloud Default and --local Source: https://github.com/almanaccode/codealmanac/blob/main/docs/hosted-local-live-agreement/cloud-first-product-agreement-2026-07-01.md Example CLI commands showing the default cloud behavior and the --local opt-in for setup, runs, and agents install. Read commands like search and show are local by nature. ```bash almanac search "auth" # local repo wiki read almanac show auth-flow # local repo wiki read almanac setup # cloud walkthrough almanac setup --local # local-only setup almanac runs # cloud runs by default almanac runs --local # local run ledger almanac agents install # install cloud source-capture hooks almanac agents install --local # install local-lab capture hooks ``` -------------------------------- ### Expected new guide filenames and import line Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-almanac-naming-migration.md Lists the new guide filenames and the import line that setup should write. ```text ~/.claude/almanac.md ~/.claude/almanac-reference.md ~/.claude/CLAUDE.md containing @~/.claude/almanac.md ``` -------------------------------- ### Install CodeAlmanac with uv and run setup Source: https://github.com/almanaccode/codealmanac/blob/main/README.md Install CodeAlmanac with uv and run the interactive setup. See the Setup section for configuration options. ```bash uv tool install codealmanac@latest codealmanac setup ``` -------------------------------- ### Setup execution flow Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md Defines run_setup, which checks if anything needs installing, prints a banner, chooses a default agent, runs the global install step, builds the setup plan, and conditionally installs sync/garden automation, CLI auto-update, agent instructions, and sets auto_commit config. Finally prints done and next steps. ```python def run_setup(options): if nothing_to_install(options): print("almanac: nothing to install - use --help to see what setup does") return ok() print_banner("Set up local Almanac access") print_badge("Almanac") agent = choose_default_agent( requested=options.agent, requested_model=options.model, ) if not agent.ok: return error(agent.error) print_done(f"Agent: {agent.provider}") global_install = run_global_install_step(options) plan = build_setup_plan(options, interactive=is_terminal()) if plan["sync_automation"]: result = install_sync_and_garden_automation(options) if not result.ok: return result if plan["cli_auto_update"]: result = install_cli_auto_update(options) if not result.ok: return result if plan["agent_instructions"]: result = install_agent_instructions(options) if not result.ok: return result if plan["auto_commit"]: set_config("auto_commit", True) elif options.auto_commit is False: set_config("auto_commit", False) print_done("Setup complete") page_count = count_existing_pages(cwd()) print_next_steps(page_count) return ok() ``` -------------------------------- ### README quickstart commands (after change) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-65-readme-quickstart-dogfood.md The updated quickstart commands. The search command now uses 'getting' so that the first search returns 'getting-started' in the initialized starter wiki. ```bash codealmanac search "getting" ``` -------------------------------- ### First-time setup walkthrough Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/ingest-design.md Full walkthrough for setting up a new repo with no wiki, including install, scan, and creation of entity stubs. ```bash npx codealmanac # install + setup wizard cd ~/code/my-project almanac ingest . # scan the repo, create entity stubs # Agent explores package.json, docker-compose, README, source dirs # Creates .almanac/pages/nextjs.md, supabase.md, stripe.md, etc. # Creates .almanac/topics.yaml # Creates .almanac/README.md with notability bar ``` -------------------------------- ### Target directory structure for setup modules Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-14-long-term-architecture-cleanup.md Shows the intended file layout under src/commands/setup/ after extracting implementation slices from src/commands/setup.ts. Each file handles a specific step: output, agent choice, automation, guides, auto-commit, and global install. ```text src/commands/setup/ output.ts # banner, badge, step rendering, prompts agent-choice.ts # provider/model selection and config write input automation-step.ts # scheduler installation step guides-step.ts # Claude/Codex guide installation step auto-commit-step.ts # auto_commit config step global-install-step.ts # ephemeral npx durable install step ``` -------------------------------- ### Bare setup flags for codealmanac --yes shortcut Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/codealmanac-known-bugs.md Examples of bare setup flags handled by tryParseSetupShortcut. These need invocation-level verification across global install, npx, source/dev, and symlinked binary paths. ```bash codealmanac --yes codealmanac --skip-automation codealmanac --skip-guides ``` -------------------------------- ### Module split for setup instructions Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-130-setup-instruction-boundaries.md Shows the intended directory structure for the setup integration adapter, separating service-facing installer from provider-specific implementations. ```python integrations.setup.instructions # service-facing FileInstructionInstaller -> guide.py # packaged guide resource read -> codex.py # Codex AGENTS target install/uninstall -> claude.py # Claude guide/import install/uninstall -> managed_blocks.py # marker block text transforms -> text_files.py # narrow UTF-8 file helpers ``` -------------------------------- ### Verify public install path with uv tool install Source: https://github.com/almanaccode/codealmanac/blob/main/almanac/guides/release-package.md Install the package from PyPI into a clean environment and confirm the entrypoint works. This matches the README quickstart path. ```bash uv tool install codealmanac@latest codealmanac --version ``` -------------------------------- ### README quickstart (new) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md New README quickstart commands, emphasizing local querying. ```bash npx codealmanac cd your-repo almanac search "auth" almanac search --mentions src/auth/ almanac show ``` -------------------------------- ### Run CodeAlmanac setup with options Source: https://github.com/almanaccode/codealmanac/blob/main/README.md Run interactive setup, or use --yes for quick install with defaults (Codex) or --runner claude to use Claude. Installs agent instructions and three local macOS launchd jobs. ```bash # Interactive setup codealmanac setup # Quick install with recommended defaults; uses Codex as the AI runner codealmanac setup --yes # Quick install using Claude as the AI runner codealmanac setup --yes --runner claude ``` -------------------------------- ### Docs: setup model Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-06-three-operation-architecture.md Markdown snippet stating that `codealmanac setup` is machine-level onboarding. It installs agent instructions, scheduled wiki maintenance, product updates, and commit policy instructions. It does not initialize a repo. Run `codealmanac init` inside a repo. ```markdown `codealmanac setup` is machine-level onboarding. It installs agent instructions, scheduled wiki maintenance, product updates, and commit policy instructions. It does not initialize a repo. Run `codealmanac init` inside a repo. ``` -------------------------------- ### Example of automation install Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-10-user-toml-automation-preferences.md Example command that updates the macOS schedule but does not record the '8h' setting in user config. ```bash codealmanac automation install sync --every 8h ``` -------------------------------- ### Clone and setup CodeAlmanac repository Source: https://github.com/almanaccode/codealmanac/blob/main/CONTRIBUTING.md Clone the repository, install dependencies with uv sync, and run the CLI help command. Use `uv run codealmanac ...` for local testing. ```bash git clone https://github.com/AlmanacCode/codealmanac.git cd codealmanac uv sync uv run codealmanac --help ``` -------------------------------- ### README quickstart (old) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md Current README quickstart commands, to be replaced. ```bash npx codealmanac cd your-repo almanac init almanac search "auth" almanac show checkout-flow ``` -------------------------------- ### Interactive setup provider picker Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-07-agent-first-cli-surface.md Interactive setup output showing all providers with readiness and a recommended default. If a not-ready provider is chosen, setup can offer to run the login command. ```text Choose default agent 1. Claude recommended ready rohan@example.com 2. Codex ready ChatGPT 3. Cursor not ready run: cursor-agent login Choose agent [1]: ``` ```text Cursor is not ready. Run cursor-agent login now? [Y/n] ``` -------------------------------- ### Run CLI and setup tests Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-07-manual-ingest-command.md Runs the CLI and setup tests. Expected: command help and setup next steps match the new terminology. ```bash npm test -- test/cli.test.ts test/setup.test.ts ``` -------------------------------- ### README quickstart commands (before change) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-65-readme-quickstart-dogfood.md The original quickstart commands from the README. Running 'codealmanac search "auth"' immediately after 'init' returns '# 0 results' because the starter wiki only contains 'getting-started'. ```bash codealmanac init codealmanac search "auth" codealmanac show getting-started codealmanac serve ``` -------------------------------- ### Install scheduler command Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-scheduled-quiet-session-capture.md The command to install the scheduler, used in the setup 'yes' path. It installs the scheduler with a 5-hour interval. ```bash almanac automation install --every 5h ``` -------------------------------- ### Separate Install Commands Source: https://github.com/almanaccode/codealmanac/blob/main/docs/hosted-local-live-agreement/cloud-first-product-agreement-2026-07-01.md Separate install commands for setup and agents install, with cloud and local variants. Installing hooks changes privacy and source-capture behavior, so it requires an explicit command. ```text almanac setup cloud walkthrough: login, GitHub App, repo selection, environment defaults almanac agents install installs coding-agent capture hooks for cloud source collection almanac setup --local creates/configures local repo wiki and local state only almanac agents install --local installs local-lab capture hooks only if local capture is supported ``` -------------------------------- ### Setup prompt: old hook-based auto-capture question Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-scheduled-quiet-session-capture.md The old setup prompt that should be removed. It asks about installing auto-capture hooks for Claude, Codex, and Cursor. ```text Install auto-capture hooks for Claude, Codex, and Cursor? ``` -------------------------------- ### Dogfood Setup and Uninstall Commands Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-79-setup-uninstall-instructions.md Exercises the setup and uninstall commands with a temporary HOME directory, verifying idempotency and non-interactive behavior with --yes. ```bash HOME="$(mktemp -d)" uv run codealmanac setup --yes --target codex HOME="$HOME" uv run codealmanac setup --yes --target codex HOME="$HOME" uv run codealmanac uninstall --yes --target codex ``` -------------------------------- ### CLI setup commands with cloud-first default and local option Source: https://github.com/almanaccode/codealmanac/blob/main/docs/hosted-local-live-agreement/README.md Shows the CLI setup commands: `almanac setup` for cloud walkthrough by default, and `almanac setup --local` for local-only setup. The exact command names are not final. ```bash almanac setup # cloud walkthrough by default almanac setup --local # local-only setup ``` -------------------------------- ### List jobs with example output Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-10-harness-process-architecture.md Runs 'almanac jobs' to list all jobs, showing example output with columns for ID, Status, Operation, Provider, and Started. ```bash almanac jobs ``` ```text ID Status Operation Provider Started run_abc123 running garden claude/sonnet 2m ago run_def456 done absorb codex/gpt-5 1h ago run_ghi789 failed build claude/sonnet yesterday ``` -------------------------------- ### Setup with all options disabled Source: https://github.com/almanaccode/codealmanac/blob/main/notes.md Run setup with all optional features disabled to test runner readiness recording. Exits 0 even when the runner is unavailable. ```bash codealmanac setup --yes --skip-instructions --no-auto-update --sync-off --garden-off --json ``` -------------------------------- ### RunSetupRequest and RunUninstallRequest usage Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-87-setup-automation-options.md Shows how to invoke setup with automation flags and uninstall with keep_automation option. The setup call installs scheduled jobs via AutomationService, and uninstall removes them by default. ```python result = app.setup.run( RunSetupRequest( cwd=repo, install_automation=True, sync_every=timedelta(hours=5), sync_quiet=timedelta(minutes=45), garden_every=timedelta(hours=4), ) ) result.automation_install # scheduled jobs installed by AutomationService removed = app.setup.uninstall( RunUninstallRequest(keep_automation=False) ) removed.automation_uninstall # scheduler entries removed by AutomationService ``` -------------------------------- ### Setup and Uninstall Service Calls Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-79-setup-uninstall-instructions.md Shows the service-level API for running setup and uninstall with a target. The service owns the product command and result model. ```python result = app.setup.run(RunSetupRequest(targets=(SetupTarget.CODEX,))) result = app.setup.uninstall(RunUninstallRequest(targets=(SetupTarget.CODEX,))) ``` -------------------------------- ### Run default unattended setup Source: https://github.com/almanaccode/codealmanac/blob/main/almanac/guides/setup-local-automation.md Runs CodeAlmanac setup with default options, installing local agent instructions and scheduled sync, garden, and update tasks. Writes auto_commit, harness.default, and harness.model config keys when config is available. ```bash codealmanac setup --yes ``` -------------------------------- ### Capture command examples Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-08-wiki-agent-operations-and-cli-design.md Examples of using the capture command with various options for sessions, apps, and limits. ```bash # Capture the latest detectable coding session for this repo. almanac capture # Capture the latest Codex session for this repo. almanac capture --app codex # Capture the latest Claude Code session for this repo. almanac capture --app claude # Capture a specific session by id. almanac capture --app codex --session abc123 # Capture one explicit session file. almanac capture ~/.codex/sessions/2026/05/08/rollout-abc123.jsonl # Capture multiple explicit session files. almanac capture session-a.jsonl session-b.jsonl session-c.jsonl # Capture recent sessions from one app. almanac capture --app codex --since 7d # Capture recent sessions from all supported apps. almanac capture --all-apps --since 7d # Capture at most 5 recent Codex sessions. almanac capture --app codex --limit 5 # Capture Codex sessions since an exact date. almanac capture --app codex --since 2026-05-01 # Capture everything from Codex, explicitly confirmed. almanac capture --app codex --all --yes # Capture recent sessions, using Claude Sonnet as the wiki-writing model. almanac capture --app codex --since 7d --using claude/sonnet ``` -------------------------------- ### Run setup with configuration flags Source: https://github.com/almanaccode/codealmanac/blob/main/almanac/guides/setup-local-automation.md Runs setup with various flags to change initial policy: runner selection, sync interval or disable, garden disable, auto-update disable, auto-commit disable, and telemetry opt-out. Interactive setup asks about telemetry last with Yes recommended. ```bash codealmanac setup --yes --runner claude ``` ```bash codealmanac setup --yes --sync-every 5h ``` ```bash codealmanac setup --yes --sync-off ``` ```bash codealmanac setup --yes --garden-off ``` ```bash codealmanac setup --yes --no-auto-update ``` ```bash codealmanac setup --yes --no-auto-commit ``` ```bash codealmanac setup --yes --no-telemetry ``` -------------------------------- ### Setup automation commands Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-88-setup-automation-docs.md Commands that install, configure, and uninstall scheduled local automation. Use `--install-automation` to enable automation, `--sync-every` and `--sync-quiet` to set sync intervals, and `--keep-automation` to preserve automation during uninstall. ```bash codealmanac setup --yes --install-automation codealmanac setup --yes --sync-every 5h --sync-quiet 45m codealmanac uninstall --yes --keep-automation ``` -------------------------------- ### Agent Flow: Session Start Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/codebase-wiki.md Example of a user request and the agent's actions at session start, including running `almanac search --mentions` and reading relevant pages. Shows the expected output of the search command. ```text User: "fix the checkout timeout bug" Agent (per the skill): $ almanac search --mentions src/checkout/ → checkout-flow, inventory-lock-gotcha, stripe-async-migration Reads 2-3 relevant pages with Read tool. Follows [[wikilinks]] for context. Now knows: the flow, the known gotchas, recent changes. Starts working with full context. ``` -------------------------------- ### Non-interactive Setup (text) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-07-job-queue-harness-stream-architecture.md Text describing the behavior of `codealmanac setup --yes` for configured and not-configured runners. ```text codealmanac setup --yes if requested/default runner is configured: write config install selected setup pieces if requested/default runner is not configured: exit non-zero print the fix command ``` -------------------------------- ### Example CLI commands for init, capture, ingest Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-07-manual-ingest-command.md Shows example invocations for each CLI command. Use these to illustrate typical usage in documentation. ```bash almanac init almanac capture status almanac ingest docs/payment-outage.md almanac ingest docs/old-system/ ``` -------------------------------- ### Setup Service and Integration Directory Structure Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-79-setup-uninstall-instructions.md Outlines the file layout for the setup service and filesystem adapter. The service owns the product command and result model; the adapter owns agent-specific files. ```text services/setup/ models.py ports.py requests.py service.py integrations/setup/ instructions.py ``` -------------------------------- ### Install Dependencies for Building the Book Source: https://github.com/almanaccode/codealmanac/blob/main/docs/reference/cosmic-python/README.md Commands to install the required tools: asciidoctor, Pygments, pygments.rb, and asciidoctor-diagram. These are needed to build the book locally. ```sh gem install asciidoctor python2 -m pip install --user pygments gem install pygments.rb gem install asciidoctor-diagram ``` -------------------------------- ### User-facing hint to run almanac init Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-07-manual-ingest-command.md Example of user-facing wording that should be updated from 'bootstrap' to 'init' in help, diagnostics, README, concepts, setup next steps, and doctor fixes. ```text run: almanac init ``` -------------------------------- ### gh pr --help output example Source: https://github.com/almanaccode/codealmanac/blob/main/docs/research/2026-05-07-cli-surface-design.md Example help output from gh, showing the recommended pattern: headings, examples first, and most-used subcommands listed before less common ones. This is contrasted with git's dense help. ```text $ gh pr --help Work with GitHub pull requests. USAGE gh pr [flags] GENERAL COMMANDS create: Create a pull request list: List pull requests in a repository status: Show status of relevant pull requests ... EXAMPLES $ gh pr checkout 12 $ gh pr create --fill ``` -------------------------------- ### Old setup flags to keep Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md List of legacy setup flags that must continue to work. ```text --sync-every --sync-quiet --garden-every --garden-off --auto-commit --no-auto-commit ``` -------------------------------- ### Run setup variants Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-07-deployed-codealmanac-smoke-plan.md Test setup flags for target, instructions, automation, and scheduling. Each flag should only affect its promised surface. ```bash codealmanac setup --yes --target codex ``` ```bash codealmanac setup --yes --target claude ``` ```bash codealmanac setup --yes --target all ``` ```bash codealmanac setup --yes --skip-instructions ``` ```bash codealmanac setup --yes --no-auto-commit ``` ```bash codealmanac setup --yes --sync-off ``` ```bash codealmanac setup --yes --garden-off ``` ```bash codealmanac setup --yes --no-auto-update ``` ```bash codealmanac setup --yes --sync-every 1h --garden-every 2h ``` -------------------------------- ### Run focused tests for bootstrap and setup Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-almanac-naming-migration.md Run the test suite for global bootstrap and setup tests to verify failures or passes. ```bash npm test -- test/global-bootstrap.test.ts test/setup.test.ts ``` -------------------------------- ### Setup Answers (text) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-07-job-queue-harness-stream-architecture.md Text listing the questions setup answers and the questions it does not answer. ```text Can this machine run the selected Claude/Codex runner? Is the user logged in? What should they run if not? ``` ```text Should init queue build? Should ingest queue ingest? Should garden queue garden? ``` -------------------------------- ### Setup plan Python reading Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-agent-targets-contract.md Python dictionary representing the setup plan, with keys instruction_targets, cli_auto_update, self_managed_automation, and auto_commit. ```python setup_plan = { "instruction_targets": selected_instruction_targets, "cli_auto_update": user_answer_or_default_yes, "self_managed_automation": user_answer_or_default_no, "auto_commit": user_answer_or_default_no if self_managed_automation else explicit_auto_commit_only, } ``` -------------------------------- ### Foreground Rendering Examples Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-10-codex-app-server-provider.md Shows example foreground rendering output for tool events with structured display details. ```text [tool] Reading file .almanac/pages/foo.md [tool] Running command almanac health [tool] Editing file .almanac/pages/bar.md ``` -------------------------------- ### Setup prompt: new automatic wiki updates question Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-scheduled-quiet-session-capture.md The new setup prompt that should replace the old one. It asks about enabling automatic wiki updates and describes the scheduled sweep. ```text Enable automatic wiki updates? Runs a local scheduled sweep every 5 hours and captures new Claude/Codex session transcript updates for repos that have .almanac/. ``` -------------------------------- ### Explicit install and run with npm and almanac Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-almanac-naming-migration.md Install the package globally with npm, then run the 'almanac' command. This is the recommended explicit install/setup method. ```bash npm install -g codealmanac almanac ``` -------------------------------- ### How guides are loaded for mixed sources Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/ingest-design.md Shows the flow when combining a path and a session keyword. The CLI loads both the tool-specific and generic guides, includes both in the system prompt, and the agent processes both sources, cross-referencing where relevant. ```text almanac ingest . sessions --tool claude --deep ↓ 1. CLI detects: two sources — "." (path) and "sessions" (keyword) 2. CLI loads: guides/processing/claude-code.md + guides/processing/generic.md 3. System prompt includes BOTH guides 4. Agent receives: - "Explore the repo at /path/to/repo" (for the "." source) - "Process these Claude sessions: " (for the sessions source) 5. Agent handles both, cross-referencing where relevant ``` -------------------------------- ### Setup Gates Defaults Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md Lists the default values and visibility for setup gates: sync_automation, cli_auto_update, agent_instructions, and auto_commit. sync_automation and auto_commit are hidden in normal onboarding, while cli_auto_update and agent_instructions are asked. ```text sync_automation: default false, hidden in normal onboarding cli_auto_update: default true, ask in normal onboarding agent_instructions: default true, ask in normal onboarding auto_commit: default false, hidden in normal onboarding ``` -------------------------------- ### Normal key example Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-10-user-toml-automation-preferences.md Example for a normal key like auto_commit, showing no launchd effect. ```python store.set_value("auto_commit", False) load_user() # no launchd effect ``` -------------------------------- ### How guides are loaded for file paths Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/ingest-design.md Shows the flow when the source is a file or directory path. The CLI detects the source type, loads the generic guide, and the agent reads the file or explores the repo accordingly. ```text almanac ingest docs/plans/proposal.md ↓ 1. CLI detects: source is a file path 2. CLI loads: guides/processing/generic.md 3. Agent reads the file, extracts knowledge per the generic guide ``` -------------------------------- ### Current setup orchestration in index.ts Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md Current execution flow in index.ts that calls each setup step sequentially. ```ts const automation = await runAutomationSetupStep(...) ... await runAutoCommitSetupStep(...) ``` -------------------------------- ### Full onboarding with deep mode Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/ingest-design.md Walkthrough for ingesting multiple sources with deep mode, showing the cost estimate and phases. ```bash almanac ingest . sessions docs/plans/ --deep # Sources: repo scan + all sessions from all tools + design docs folder # Deep mode: thorough, cross-referencing across all sources # Estimated cost: ~$8.50 ($$$). Continue? [Y/n] # Phase 1: parallel research on each source # Phase 2: synthesis with full cross-referencing # Result: 30 pages, comprehensive wiki from scratch ``` -------------------------------- ### Initial Codebase Wiki Setup (pseudocode) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/research/2026-05-08-agentic-wiki-compilation.md Pseudo-code for the initial codebase case, where a repo needs orientation before absorption. It surveys the repo, creates a scaffold, chooses high-signal areas, and iteratively runs the gardener on each source, then finalizes the wiki. ```text function init_codebase_wiki(repo): map = survey_repo(repo) W = create_scaffold(map) sources = choose_high_signal_areas(repo, map) for source in sources: W = gardener(W, source, broader_context = repo) W = final_garden(W) return W ``` -------------------------------- ### Setup function to update config Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-10-user-toml-automation-preferences.md Python function `setup` updates user config with automation settings for sync, garden, and update tasks. It uses `UserConfigUpdate` and `AutomationConfig`. ```python def setup(request): config.update( UserConfigUpdate( auto_commit=request.auto_commit, harness=HarnessConfig(request.harness, request.model), automation=AutomationConfig( sync=TaskConfig(not request.sync_off, request.sync_every), garden=TaskConfig(not request.garden_off, request.garden_every), update=TaskConfig(request.auto_update, request.update_every), ), ) ) ``` -------------------------------- ### Stripe config.toml example Source: https://github.com/almanaccode/codealmanac/blob/main/docs/research/2026-05-07-cli-config-best-practices.md Example Stripe configuration file with default and project-specific profiles. Keys are stored in plaintext TOML by default. ```toml [default] device_name = "rohans-laptop" test_mode_api_key = "rk_test_..." test_mode_pub_key = "pk_test_..." live_mode_api_key = "rk_live_..." [my-project] test_mode_api_key = "rk_test_..." ``` -------------------------------- ### Setup final panel text Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-06-three-operation-architecture.md Shows the expected text in the setup final panel, which includes navigation instructions and the 'codealmanac init' command but does not list 'codealmanac build'. ```text Navigate to your repo of choice codealmanac init ``` -------------------------------- ### Streaming output example Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/slice-5-capture.md Example of streaming output during a capture run, showing writer and reviewer actions and final summary. ```text [capture] starting writer (session abc123) [writer] reading transcript [writer] searching for 'pydantic ai' [writer] reading .almanac/pages/pydantic-ai.md [writer] drafting updates to pydantic-ai.md [writer] invoking reviewer subagent [reviewer] reading proposed changes [reviewer] searching for related pages [reviewer] approved with 2 notes (missing wikilink; section needs cohesion pass) [writer] applying reviewer feedback [writer] wrote .almanac/pages/pydantic-ai.md [capture] done (1 page updated, 0 created, 0 archived, cost: $0.08) ``` -------------------------------- ### Python: instruction_targets install contract dictionary Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-agent-targets-contract.md Python dictionary mapping each target to its label and install instructions, describing how to write or import the configuration file. ```python instruction_targets = { "claude": { "label": "Claude Code", "install": "write ~/.claude/almanac.md and import it from ~/.claude/CLAUDE.md", }, "codex": { "label": "Codex", "install": "write managed inline block to ~/.codex/AGENTS.md", }, "cursor": { "label": "Cursor", "install": "write ~/.cursor/rules/almanac/RULE.md", }, "windsurf": { "label": "Windsurf", "install": "write managed inline block to ~/.codeium/windsurf/memories/global_rules.md", }, "opencode": { "label": "OpenCode", "install": "write managed inline block to ~/.config/opencode/AGENTS.md", }, } ``` -------------------------------- ### How guides are loaded for sessions Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/ingest-design.md Shows the step-by-step flow when running `almanac ingest sessions --tool codex`. The CLI resolves the tool, loads the corresponding guide, builds the system prompt with the guide contents and existing wiki state, then passes session file paths to the agent. ```text almanac ingest sessions --tool codex ↓ 1. CLI resolves: tool = codex 2. CLI loads: guides/processing/codex.md 3. CLI builds the agent's system prompt: "You are the codealmanac research agent. Your job is to extract knowledge from session transcripts. ## Processing guide ## Existing wiki state ## Your task Read the session files provided. Extract knowledge atoms. Follow the processing guide for what to keep, skip, and summarize." 4. Agent receives session file paths as its prompt: "Process these sessions: - ~/.codex/sessions/2026/04/15/rollout-...jsonl - ~/.codex/sessions/2026/04/14/rollout-...jsonl" 5. Agent reads each file using the Read tool, following the guide's instructions 6. Agent outputs structured knowledge atoms ``` -------------------------------- ### Run automation install Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-07-deployed-codealmanac-smoke-plan.md Run the automation install command to restore plists and load launchd jobs. Confirm plists are restored and loaded. ```bash automation install ``` -------------------------------- ### Change setup headline in output.ts Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md Changes the setup headline text from 'Set up your automatic codebase wiki' to 'Set up local Almanac access'. ```Text Set up your automatic codebase wiki ``` ```Text Set up local Almanac access ``` -------------------------------- ### README claim: npx codealmanac installs globally Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/codealmanac-install-audit.md The README claims that `npx codealmanac` installs globally and runs the setup wizard, but the audit shows this is not what happens. ```bash npx codealmanac # installs globally + runs the setup wizard ``` -------------------------------- ### Run provider and setup tests Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-14-provider-automation-boundary-refactor.md Execute the test suite for provider, agents command, setup, doctor, and auth tests to ensure all pass after removing legacy execution providers. ```bash npm test -- test/provider-view.test.ts test/agents-command.test.ts test/setup.test.ts test/doctor.test.ts test/auth.test.ts ``` -------------------------------- ### Calling normalizePageSources in runIndexer Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-28-source-provenance.md Example of invoking normalizePageSources with frontmatter data to get normalized sources. ```typescript const normalizedSources = normalizePageSources({ sources: fm.sources, legacyFiles: fm.files, legacySourceStrings: fm.legacySourceStrings, }); ``` -------------------------------- ### codealmanac ingest README.md --using codex (new example) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-66-readme-lifecycle-source-examples.md Updated README example that uses an existing file `README.md`, which resolves as `SourceKind.PATH_FILE`. ```bash codealmanac ingest README.md --using codex ``` -------------------------------- ### almanac doctor output example Source: https://github.com/almanaccode/codealmanac/blob/main/docs/research/2026-05-07-cli-config-best-practices.md Shows the expected output format for the agent readiness check, grouping by category with status glyphs and run commands. The example includes a warning for codex not logged in and cursor not installed. ```text agent ✓ active claude ✓ claude credentials present (claude auth status --json), model claude-sonnet-4-6 configured ⚠ codex not logged in (run: codex login) ⚠ cursor not installed (run: npm i -g cursor-agent) ``` -------------------------------- ### Setup Runner Choice (text UI) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-07-job-queue-harness-stream-architecture.md Text UI showing the setup runner choice with a ready Codex and a disabled Claude option, plus the error message when selecting a not-logged-in Claude. ```text codealmanac setup Choose runner [ Codex ready signed in as rohan@example.com ] [ Claude not logged in run: claude auth login ] disabled / gray Trying to select Claude while it is not logged in: Claude is not logged in. Run `claude auth login` and then choose it again. ``` -------------------------------- ### Example app and using flags Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-08-wiki-agent-operations-and-cli-design.md Illustrates the --app and --using flags with comments explaining their meaning. ```text --app codex Read Codex session history. --using claude/sonnet Use Claude Sonnet as the wiki-writing harness/model. ``` -------------------------------- ### Example run log entry for root actor Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-agent-thread-aware-run-logging.md Example JSONL entry showing a root actor with a provider-confirmed thread ID and label 'Main'. ```json { "version": 2, "sequence": 42, "actor": { "threadId": "019e1646-9ed0-7743-9421-8f866c786642", "role": "root", "confidence": "provider", "label": "Main" }, "event": { "type": "tool_use", "tool": "shell" } } ``` -------------------------------- ### Initialize and use CodeAlmanac wiki commands Source: https://github.com/almanaccode/codealmanac/blob/main/README.md Initialize a wiki in your repository, search for pages, view a page in the terminal, and serve the wiki locally. ```bash cd your-repo codealmanac init # Makes your wiki, if you don't have one codealmanac search "getting started" # Shows matching wiki pages. codealmanac show getting-started # Opens one page in the terminal codealmanac serve # Shows the wiki in local web viewer. ``` -------------------------------- ### Customize CodeAlmanac setup automation options Source: https://github.com/almanaccode/codealmanac/blob/main/README.md Customize automatic work during setup: adjust sync frequency, disable transcript sync, disable wiki cleanup, or disable auto-updates. ```bash # Change how often recent agent conversations are scanned codealmanac setup --yes --sync-every 5h # Do not install automatic transcript sync codealmanac setup --yes --sync-off # Do not install automatic wiki cleanup codealmanac setup --yes --garden-off # Do not install automatic CodeAlmanac updates codealmanac setup --yes --no-auto-update ``` -------------------------------- ### Local link smoke Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-almanac-naming-migration.md Runs a series of commands to verify the local link setup. Expects almanac and alm to resolve, codealmanac not to resolve from this package, version/help to work, and setup skip path to exit successfully with honest 'nothing to install' wording. ```bash npm link type -a almanac type -a alm type -a codealmanac || true almanac --version almanac --help almanac setup --yes --skip-automation --skip-guides ``` -------------------------------- ### Live setup smoke for Slice 86 Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/verification-matrix.md Runs the setup command in an isolated temp home with --yes --target codex and --yes --skip-instructions --json. Result: passed; text and JSON both showed default harness codex and sync/garden automation recommendations. ```bash uv --project /Users/rohan/Desktop/Projects/codealmanac run codealmanac setup --yes --target codex ``` ```bash setup --yes --skip-instructions --json ``` -------------------------------- ### Run focused tests and verify failures Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-05-11-almanac-naming-migration.md Command to run focused tests for setup, uninstall, and doctor, expecting failures around guide filenames and IMPORT_LINE. ```bash npm test -- test/setup.test.ts test/uninstall.test.ts test/doctor.test.ts ``` -------------------------------- ### Storage compatibility test manual setup Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-08-jobs-lifecycle-refactor.md Create a temporary repo with legacy run files to test compatibility with the new jobs system. ```text .almanac/runs/run_20260509195001_deadbeef.json .almanac/runs/run_20260509195001_deadbeef.jsonl .almanac/runs/run_20260509195001_deadbeef.spec.json ``` -------------------------------- ### Dogfooding commands for multi-wiki serve Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-81-multi-wiki-serve.md Initializes two wikis, starts the server, and curls the overview endpoint to verify multi-wiki behavior. ```bash HOME="$(mktemp -d)" uv run codealmanac init /tmp/wiki-a HOME="$HOME" uv run codealmanac init /tmp/wiki-b HOME="$HOME" uv run codealmanac serve --host 127.0.0.1 --port curl http://127.0.0.1:/api/overview ``` -------------------------------- ### Background worker spawn and drain example Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-76-background-worker-spawn.md Shows the public API for starting a background ingest and the child process entrypoint that drains the queue. The first call enqueues and spawns a worker; the second is invoked inside the worker process to drain the queue. ```python queued = app.workflows.queue.start_ingest_background( RunIngestRequest(cwd=repo, inputs=("note.md",), harness=HarnessKind.CODEX) ) # child process entrypoint app.workflows.queue.drain(DrainRunQueueRequest(cwd=repo)) ``` -------------------------------- ### Setup defaults and build_setup_plan function Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-rebias-contract.md Defines SETUP_DEFAULTS and build_setup_plan, which returns a dictionary of gate answers using answer_or_default. The answer_or_default function returns the default when answer is None, otherwise the answer. ```python SETUP_DEFAULTS = { "sync_automation": False, "cli_auto_update": True, "agent_instructions": True, "auto_commit": False, } def build_setup_plan(options, interactive): return { "sync_automation": answer_or_default( gate="sync_automation", default=SETUP_DEFAULTS["sync_automation"], answer=sync_automation_answer(options, interactive), ), "cli_auto_update": answer_or_default( gate="cli_auto_update", default=SETUP_DEFAULTS["cli_auto_update"], answer=cli_auto_update_answer(options, interactive), ), "agent_instructions": answer_or_default( gate="agent_instructions", default=SETUP_DEFAULTS["agent_instructions"], answer=agent_instructions_answer(options, interactive), ), "auto_commit": answer_or_default( gate="auto_commit", default=SETUP_DEFAULTS["auto_commit"], answer=auto_commit_answer(options, interactive), ), } def answer_or_default(gate, default, answer): if answer is None: return default return answer ``` -------------------------------- ### Flask app uses bootstrap (src/allocation/entrypoints/flask_app.py) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/reference/cosmic-python/chapter_13_dependency_injection.md Diff showing the Flask entrypoint changes: import bootstrap, call bootstrap.bootstrap() to get a ready message bus, and use bus.handle(cmd) instead of manually creating a UoW and calling messagebus.handle. The bootstrap script handles ORM start and default UoW configuration. ```diff -from allocation import views +from allocation import bootstrap, views app = Flask(__name__) -orm.start_mappers() #<1> +bus = bootstrap.bootstrap() @app.route("/add_batch", methods=["POST"]) @@ -19,8 +16,7 @@ def add_batch(): cmd = commands.CreateBatch( request.json["ref"], request.json["sku"], request.json["qty"], eta ) - uow = unit_of_work.SqlAlchemyUnitOfWork() #<2> - messagebus.handle(cmd, uow) + bus.handle(cmd) #<3> return "OK", 201 ``` -------------------------------- ### Install stable codealmanac with uv or pip Source: https://github.com/almanaccode/codealmanac/blob/main/RELEASE.md Install the stable release of codealmanac from PyPI using uv tool install or python -m pip install. ```bash uv tool install codealmanac python -m pip install codealmanac ``` -------------------------------- ### Start the local viewer with codealmanac serve Source: https://github.com/almanaccode/codealmanac/blob/main/README.md Starts the read-only local viewer, which renders pages, search, topics, backlinks, and file-reference navigation from local wiki data. Opens in the default browser once the server is ready; use --no-open for headless or scripted use, and --wiki to narrow to one wiki. ```bash codealmanac serve ``` -------------------------------- ### Final installed smoke output Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-61-final-package-rehearsal.md Final output of the installed smoke tests, indicating both wheel and sdist installs passed. ```text wheel-install: ok sdist-install: ok ``` -------------------------------- ### Setup screen copy for wiki updates Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-06-three-operation-architecture.md User-facing copy for the setup screen asking how wikis should be updated. The automatic side lists 'sync agent sessions' and 'garden wiki structure', while the manual side lists 'run them yourself' and 'no wiki schedules'. Avoid using 'operation' in this copy. ```text How should your wikis be updated? ``` ```text sync agent sessions garden wiki structure ``` ```text run them yourself no wiki schedules ``` -------------------------------- ### Install local automations command Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-06-26-cli-onboarding-agent-targets-contract.md The command equivalent to installing local automations, which installs both scheduled jobs for sync and garden. ```bash almanac automation install ``` -------------------------------- ### How guides are loaded for repo root Source: https://github.com/almanaccode/codealmanac/blob/main/docs/bugs/ingest-design.md Shows the flow when the source is `.` (the current directory). The CLI detects the repo root, loads the generic guide, and the agent explores the repository structure to decide what entity pages to create. ```text almanac ingest . ↓ 1. CLI detects: source is "." (the repo root) 2. CLI loads: guides/processing/generic.md (or a repo-specific section within it) 3. Agent explores: package.json, configs, README, source structure 4. Agent decides what entity pages to create based on what it finds ``` -------------------------------- ### Agent installation commands with cloud default and local option Source: https://github.com/almanaccode/codealmanac/blob/main/docs/hosted-local-live-agreement/README.md Shows the agent/source-capture installation commands: `almanac agents install` for cloud capture by default, and `almanac agents install --local` for local lab capture if supported. This is a distinct user action, not a side effect of basic CLI installation. ```bash almanac agents install # cloud capture by default almanac agents install --local # local lab capture, if supported ``` -------------------------------- ### Hosted conversation capture flow Source: https://github.com/almanaccode/codealmanac/blob/main/docs/cli-hosted-redesign-2026-06-27/product-boundary-notes.md This flow outlines the hosted conversation capture: after login and agent install, a Codex/Claude Stop hook fires, the hook command uploads transcript deltas, the server stores raw evidence and normalized events, and later runs attach relevant source ids. Capture records source evidence and does not start an update run. ```text codealmanac login codealmanac agents install Codex/Claude Stop hook fires hook command uploads transcript delta server stores raw evidence and normalized events later run attaches relevant source ids worker receives attached source references ``` -------------------------------- ### Setup renderer call shape Source: https://github.com/almanaccode/codealmanac/blob/main/docs/python-port/slice-80-setup-terminal-renderer.md Shows the intended call shape for the setup renderer: the setup service returns a result, and the renderer formats it for terminal output, optionally as JSON. ```python result = app.setup.run(request) render_setup_result(result, json_output=args.json) ``` -------------------------------- ### Expected next steps text Source: https://github.com/almanaccode/codealmanac/blob/main/docs/plans/2026-07-06-three-operation-architecture.md The expected next steps shown after setup, including only the 'cd' and 'codealmanac init' commands. ```text cd /path/to/your/repo codealmanac init ``` -------------------------------- ### CLI commands with posture flags Source: https://github.com/almanaccode/codealmanac/blob/main/docs/hosted-local-live-agreement/README.md Shows example CLI commands that make the posture visible, with flags to force local or cloud. ```text codealmanac runs # current posture codealmanac runs --local # force local codealmanac runs --cloud # force cloud codealmanac status # show posture, repo, account, root, triggers ``` -------------------------------- ### Our Dockerfile (Dockerfile) Source: https://github.com/almanaccode/codealmanac/blob/main/docs/reference/cosmic-python/appendix_project_structure.md Dockerfile for building the application image. It installs Python dependencies, copies and installs the source, and configures a default Flask startup command. Install order is optimized for Docker build cache reuse. ```dockerfile FROM python:3.9-slim-buster <1> # RUN apt install gcc libpq (no longer needed bc we use psycopg2-binary) <2> COPY requirements.txt /tmp/ RUN pip install -r /tmp/requirements.txt <3> RUN mkdir -p /src COPY src/ /src/ RUN pip install -e /src COPY tests/ /tests/ <4> WORKDIR /src ENV FLASK_APP=allocation/entrypoints/flask_app.py FLASK_DEBUG=1 PYTHONUNBUFFERED=1 CMD flask run --host=0.0.0.0 --port=80 ```