# 2. Orient an agent with Soma

Source: https://usecns.dev/use-case-orientation/

[Use Cases](https://usecns.dev/use-cases/) · [1. Find](https://usecns.dev/use-case-axon/) → **2. Orient** → [3. Add product knowledge](https://usecns.dev/use-case-product-knowledge/)

**You want to:** give a coding agent an inch-deep, mile-wide view before it dives into a task.

**You leave with:** a local Markdown inventory of modules and important symbols, plus an orientation prompt that turns the inventory into a focused investigation. Axon provides the structural facts; Soma renders them for reading.

## Keep the project, add only Soma

Continue in the clean `cns-use-cases` repository from [case 1](https://usecns.dev/use-case-axon/). Its two application tests should pass. This exercise adds Soma (run with Soma 1.2.3): `brew install ivannovak/cns/soma`. See [installation and access](https://usecns.dev/install/).

```
soma init --curator '@maintainer'
git add .gitignore soma.toml docs/soma
git commit -m 'Initialize Soma for the orientation map'
axon index --full --json
soma docs render --axon-db .axon/axon.db
```

Initialization writes local documentation, configuration and ignore rules. Review those writes in a real project; do not run this fixture setup over an existing Soma configuration without checking it first.

The explicit `--axon-db` makes the input clear. Ordinary rendering can fall back to workspace facts without an index, but that is not the indexed, symbol-aware workflow demonstrated here.

## Read wide before reading deep

```
cat .soma/codemap.md
cat .soma/modules/billing.md
cat .soma/modules/checkout.md
```

**Check:** the codemap lists `billing` with one file and two symbols, and `checkout` with one file and one symbol. Its billing summary highlights `processInvoice`, which has two incoming references. The inventory looks like this (excerpt):

```
| Module | Files | Symbols |
|---|---:|---:|
| [billing](#billing) | 1 | 2 |
| [checkout](#checkout) | 1 | 1 |

Key symbols: `src/billing/invoices.js#processInvoice` (2 refs)
```

The billing module page also identifies checkout as a dependent. Key-symbol lists favor symbols with incoming references; this fixture's `retryInvoice` and `checkoutInvoice` are not listed as key symbols. Use Axon search and tracing to find those callers, as in case 1. This is a selective orientation map, not an exhaustive function listing.

The toy project has only two modules; a real project supplies the breadth. Do not mistake its compact map for a measured context budget or a promise that every language feature is represented.

| Local artifact | Use it for |
| --- | --- |
| `.soma/codemap.md` | Broad module inventory and key symbols; start here. |
| `.soma/modules/<module>.md` | A narrower module summary and structural relationships. |
| `.soma/overview.md` | Generated inventory and links to the maps. |
| `.soma/arteries.md` | Execution-path candidates when extraction supports them—not a guaranteed trace of every runtime path. |

These are generated files under the default, Git-ignored `.soma/` directory. Give an agent explicit permission and file paths to read them: tools that omit ignored files may not discover them automatically. No Engram import or model request occurs when you render a map.

## Hand the map to an agent

Open or attach the local codemap through your agent's normal file/context mechanism. Then give it a task like this:

```
Read .soma/codemap.md for broad orientation; do not read the whole repository.
Our task concerns invoice retry behavior. Identify the likely module and key symbols.
Read the relevant .soma/modules/ page, then use Axon to find the implementation
and incoming callers. Confirm the relationships in source.
Return a short reading plan with file paths, the tests to run, and any unknowns.
Do not edit code yet. Do not infer product guarantees from names or graph edges.
```

**A useful result:** billing is the starting point, `processInvoice` and `retryInvoice` deserve inspection, checkout is a caller to consider, and `node --test` checks this example. Check the answer against the files; the map does not ensure an agent followed the instruction.

The value is a two-stage reading strategy: broad, inexpensive orientation followed by narrow source inspection. This is not a benchmark claim about model speed or token savings.

## Refresh rather than hand-edit

After source or branch changes, refresh the index and render again:

```
axon index --full --json
soma docs render --axon-db .axon/axon.db
node --test
```

Inspect index freshness and the regenerated maps before handing them off. `soma verify` alone is not a full regeneration comparison of every map. Keep corrections to generated structure in its inputs; do not teach product policy by editing `.soma/codemap.md`, because the next render replaces it.

You now have the breadth, but not the reason the retry key matters. [Add a person's product knowledge as an authored concern →](https://usecns.dev/use-case-product-knowledge/).