ores.compass

Table of Contents

Diagram

ores.compass component diagram

Figure 1: ores.compass

Summary

ores.compass is a small Python command-line tool that orients a contributor (human or LLM) inside the ORE Studio repository. It answers three questions against the project's org-roam documentation graph: where are we in time?, which documents are relevant to X?, and how do I add a new agile artefact?. It is the executable counterpart to the documentation Compass — the doc map tells a reader where things are; the tool computes the answer on demand from cached data. The search slice is implemented today; temporal orientation and agile scaffolding are planned (see the story).

Capabilities

Pillars (the first three drawn from the Sprint 18 capture * Tools):

  1. Locate — "where are we in time?" Report the current version, the current sprint, and the stories / tasks currently in flight (State STARTED). Implemented as where / status — see the Locate story.
  2. Search — semantic document retrieval. Given a query, return the most relevant documents from a cached index of the graph. Today this is SQLite FTS5 over the text of every org node; future work may add embedding-based ranking. Implemented.
  3. Scaffold — agile authoring. Add a story to a sprint, a task to a story, a sprint, a recipe, a capture, etc. Calls codegen as a library rather than re-implementing it. Implemented as add — see the Scaffold story.
  4. Fleet — "what is every worktree doing?" List each git worktree with its branch, mapped story + task (via the task #+branch: field), and open PR + live state, so parallel checkouts/agents don't collide. Implemented as fleet — see the Fleet story.
  5. Goto — "start a unit of work." Fetch main, create a feature branch, scaffold the task (and, for a new story, the story too) via Scaffold/codegen with the task's #+branch: set, and print the remaining manual steps — the "start a story" ritual in one command. Two modes: new story (story new --slug/--title/--description) or add a task to an existing story (task new --story <id-or-slug> --slug --title). Implemented as story new / task new (formerly goto) — see the Goto story.

Inputs

  • .org-roam.db (or org-roam.db) at the repository root — the EmacSQL database produced by M-x org-roam-db-sync. The single source of truth for node text, titles, tags, outline paths, and links.
  • The agile document tree under doc/agile/versions/ — versions, sprints, stories, tasks and the State value in each doc's * Status table (consumed by Locate).
  • A search query string (consumed by Search).

Outputs

  • .compass.db at the repository root — a local SQLite FTS5 cache (compass_fts + compass_meta) rebuilt incrementally by mtime. Git ignored.
  • Search results in three formats: pretty (default, human), line (UUID "path" "match", scriptable), and json (for tooling such as the knowledge-graph site).
  • Planned: a temporal-orientation report, and new v2 .org artefacts (via codegen) for the scaffold pillar.

Entry points

  • projects/ores.compass/compass.sh — bootstraps the virtualenv (and installs requirements.txt if present) and forwards to the Python CLI.
  • projects/ores.compass/src/compass.py — the CLI. Subcommands: index [--rebuild], search <query> [-l N] [-f FMT], debug [-f FILE] (Search); where / status [=-f pretty|json=] (Locate); list [filters] and show <uuid> (Navigate); add <type> [flags] (Scaffold); fleet [-f pretty|json] (Fleet); and story new / task new (Goto) — new story (--slug/--title/--description) or existing story (--story <id-or-slug> --slug --title); --dry-run for both.

Temporal model

Compass's temporal commands sit on a 2×2 grid — subject (me ↔ everyone) × time (now ↔ past):

  now past
me journal where journal log
everyone fleet timeline

Two substrates feed the grid, and which one a command may read is a rule, not an accident:

  • Live substrate — per-worktree .journal.org files, branch and PR state. Approximate but immediate; only ever visible to the checkout it lives in. Now-views (fleet, journal) read this.
  • Consistent substrate — the agile documents on origin/main, their git history, and the GitHub PR record. Identical from any fresh checkout. Past-views (timeline, sprint charts) read this and nothing else, so the same window always reconstructs the same history.

Other temporal commands are projections: where=/=status and sprint audit are sprint-scoped now-views; sprint charts aggregates the consistent substrate. New temporal features should be placed on this grid — and assigned a substrate — rather than added beside it. See the temporal command coherence investigation for the full analysis.

Commands

Each command pillar groups the subcommands that share a purpose. The shell entry point for all commands is projects/ores.compass/compass.sh; run it from the repository root.

Locate

Reports temporal position: which version, which sprint, and which stories and tasks are currently in flight (State: STARTED). Reads the agile tree directly — no database or org-roam sync needed.

Form Description
compass where Print current version, sprint, and all STARTED stories and tasks (human-readable).
compass status -f json Same output as structured JSON for tooling or LLM consumption.
Recipe Description
How do I see where we are? Full walkthrough of where and status.

Search

Full-text search over the org-roam documentation graph via a local SQLite FTS5 cache (.compass.db). The cache must be built with index before the first search, and refreshed whenever docs change. find is an alias for search.

Form Description
compass search "query" Return the top matching docs (default: 10, pretty format).
compass search "query" -l 5 Cap results at 5.
compass search "query" -f line Machine-readable output: one UUID "path" "match" per line.
compass search "query" -f json Structured JSON array (uuid, path, title, olp, tags, snippet).
compass index Build or incrementally refresh the FTS5 cache from org-roam.db.
compass index --rebuild Discard the cache and rebuild from scratch.
compass debug Inspect the raw cache contents.
compass debug -f glossary Show cache in glossary format.
Recipe Description
How do I search docs with compass? Query syntax, output formats, and FTS5 tips.
How do I index notes for compass? When and how to run index and index --rebuild.

Navigate

Inspect and filter the live documentation graph without a search query. list filters by metadata; show dives into one document. Neither requires org-roam.db or the FTS5 cache.

Form Description
compass list List every addressable doc in the standard two-line format: icon + type + title + description, then a compass show UUID hint. --oneline keeps the old machine-friendly format.
compass list --type recipe Filter by #+type:.
compass list --tag sprint_18 Filter by filetag.
compass list --regex "sql" Filter by regex against title or description.
compass list --under doc/recipes Restrict to docs under a path prefix.
compass list --sort updated Sort by #+updated: date.
compass list --paths One path per line — useful for piping into grep / xargs.
compass show <uuid-or-prefix> Print one doc: metadata, blurb, outgoing links, incoming links.

Scaffold

Creates new documents by calling ores.codegen as a library. Two subcommands: add scaffolds any doc type from a template; capture creates and files captures into the product backlog inbox.

Form Description
compass add story --slug S --title "T" --description "D" Scaffold a story in the current sprint.
compass add task --parent-dir <story-dir> --slug S --title "T" Scaffold a task under an existing story.
compass add sprint --slug sprint_NN --title "Sprint NN" Scaffold a new sprint.
compass add recipe --slug how_do_i_x --title "How do I X?" Scaffold a recipe doc.
compass capture --note "..." Parse freeform text and create a structured capture in inbox/.
compass capture file <slug> next Move a capture from inbox/ to next/.
compass capture file <slug> deferred Move a capture to deferred/.
compass capture file <slug> discarded Move a capture to discarded/.
Recipe Description
How do I add a doc with compass? Scaffold stories, tasks, sprints, and recipes via add.
How do I capture ideas from freeform text? Parse raw notes into filed captures via capture.

Fleet

Gives a cross-worktree status snapshot: for each git worktree, shows the current branch, the story and task it maps to (via #+branch: in the task doc), and the open PR with its live CI state. Useful for coordinating parallel work across multiple checkouts or LLM agents.

Form Description
compass fleet Human-readable worktree status table.
compass fleet -f json Structured JSON array for tooling consumption.
Recipe Description
How do I see what every worktree is doing? Walkthrough of fleet output and when to use it.

Goto

Starts a unit of work in one command: fetches main, creates a feature branch, scaffolds the linked story and task (via Scaffold/codegen), and prints the remaining manual steps. Two modes: new story, or add a task to an existing story.

Form Description
compass story new --slug S --title "T" --description "D" --tags "t" New story mode: create story + task, branch, and print next steps.
compass task new --story <id-or-slug> --slug S --title "T" Add-task mode: add a task to an existing story and branch.
compass story new ... --dry-run / compass task new ... --dry-run Preview all actions without making changes.
compass story new ... --base <ref> / compass task new ... --base <ref> Override the base branch (default: origin/main).
Recipe Description
How do I start a unit of work with compass? Full walkthrough of story new and task new.

Backlog

Lists captures from the product backlog buckets. Read-only views — use capture file (Scaffold pillar) to move entries between buckets.

Form Description
compass inbox List captures in product_backlog/inbox/.
compass next List captures in product_backlog/next/.
compass deferred List captures in product_backlog/deferred/.
compass discarded List captures in product_backlog/discarded/.

Dependencies

  • Python 3 standard library for everything except Scaffold (sqlite3, argparse, json, pathlib, re, dataclasses, subprocess).
  • pystache — for add and story new / task new (Scaffold), which import codegen's Mustache-based generator. Declared in requirements.txt; the other commands run without it.
  • git (fleet uses git worktree list; story new / task new use git fetch + git switch -c) and gh (live PR state in fleet and where --prs). fleet degrades gracefully when gh is unavailable.
  • org-roam (in Emacs) to populate .org-roam.db, used only by the Search pillar. Compass never writes to it; it opens it read-only. Locate, Navigate and Fleet read the working tree directly and need neither org-roam.db nor org-roam-db-sync.
  • ores.codegen — the division of labour is: codegen generates, compass navigates. Doc navigation (doc_index / list / show) was folded out of codegen into compass. Doc generation stays in codegen; the Scaffold pillar (add) calls codegen as a library (doc_generate.main(...)) to make stories, tasks and sprints — not shell out to, nor re-implement, generate_doc.sh.

Structure

projects/ores.compass/
├── compass.sh                 # venv bootstrap + CLI entry wrapper
├── requirements.txt           # pystache (only `add` needs it)
├── src/
│   ├── __init__.py
│   ├── compass.py             # CLI dispatcher: index/search/debug/where/list/show/add/fleet/story/task
│   ├── doc_index.py           # canonical .org parser (walks the repo)
│   ├── doc_list.py            # `list` — filter the doc graph
│   └── doc_show.py            # `show` — one doc + inbound/outbound links
└── modeling/
    ├── component_overview.org # this document
    └── ores.compass.puml      # component diagram source

The doc-navigation modules (doc_index, doc_list, doc_show) were moved here from ores.codegen so a single tool owns repository orientation. As the Scaffold pillar lands, compass.py may split into per-pillar modules behind a thin dispatcher.

Open questions

  • Codegen boundary. Resolved. Doc navigation (doc_index / list / show) now lives in compass; codegen keeps only code/doc generation (generate_doc.sh, which Scaffold will call). No parsing is duplicated across the two.
  • Cache freshness. Search reads .compass.db, which is only as fresh as the last index run / org-roam-db-sync; decide how to refresh (manual, pre-command auto-index, or a git hook). Locate is unaffected — it reads the agile tree directly, always fresh.
  • Name overlap. The tool shares its name with the documentation Compass. Intentional (both orient the reader) but should be called out wherever both are referenced. Action: update doc/compass.org to distinguish the two senses — ores.compass, the executable tool in projects/, versus "compass" the general orienting concept (the doc map, and the cybernetic notion of a device that tells a system where it is and which way it is heading). The doc map should note the tool as its executable counterpart and link to the ores.compass story.

See also

Emacs 29.1 (Org mode 9.6.6)