How do I find docs matching a pattern?

Table of Contents

For the companion lookup "show me one doc by UUID" see How do I show a doc by UUID?.

Question

How do I find documents in the repo when I know a fragment of the title, a tag, the doctype, or roughly which folder it lives in?

Answer

Run ./projects/ores.compass/compass.sh list with one or more filters. Each filter narrows the result; combining filters AND's them.

  1. Regex on title or description (case-insensitive):

    ./projects/ores.compass/compass.sh list --regex 'currency'
    
  2. /By #+type: / — recipe, knowledge, task, story, sprint, version, component, capture, function, skill, meta, …:

    ./projects/ores.compass/compass.sh list --type recipe
    ./projects/ores.compass/compass.sh list --type knowledge
    
  3. By filetag (repeatable; multiple tags are AND'd):

    ./projects/ores.compass/compass.sh list --tag cli
    ./projects/ores.compass/compass.sh list --tag build_quality --tag task
    
  4. Under a path prefix — restrict to one subtree (repeatable):

    ./projects/ores.compass/compass.sh list --under doc/agile/versions/v0
    ./projects/ores.compass/compass.sh list --under doc/recipes/cli
    
  5. Combine filters for a precise lookup:

    ./projects/ores.compass/compass.sh list \
        --type recipe --tag cli --regex 'list'
    
  6. Just count how many docs match — useful for sanity checks:

    ./projects/ores.compass/compass.sh list --type recipe --count
    
  7. Pipe paths into grep/xargs when you want to read or edit the matched files:

    ./projects/ores.compass/compass.sh list --tag cli --paths | \
        xargs grep -l 'compute_host'
    
  8. Sort by recency — most recently touched first:

    ./projects/ores.compass/compass.sh list --sort updated | tail -20
    

Output format

Each match is one line:

<uuid> | <type> | <title>  —  <description>   (rel/path)

The --paths mode emits one path per line for use in pipes; --count emits a single integer.

Script

The wrapper is projects/ores.compass/compass.sh list. It delegates to projects/ores.compass/src/doc_list.py, which uses the shared doc_index.py library (see How do I show a doc by UUID? for the model).

Tested by

Manual usage — these scripts are read-only over the doc tree, so the #+type:, #+filetags:, and :ID: contract enforced by document types and audited by lifecycle is what guarantees correctness.

See also

Emacs 29.1 (Org mode 9.6.6)