|
| 1 | +# StrayMark — Loom & the Architecture Map (Experimental) |
| 2 | + |
| 3 | +**See your project: the document web, and the "you are here" map of where the work is happening.** |
| 4 | + |
| 5 | +[](https://strangedays.tech) |
| 6 | + |
| 7 | +> ⚠️ **EXPERIMENTAL — Loom v0 (N=1).** Loom is an opt-in, unstable experiment. Its API, CLI surface, on-disk model format, and very existence may change or be removed without a deprecation cycle until it graduates. It is **not** part of the supported Framework or CLI contract — don't build automation against it yet. The `architecture` model and `status --where` ship in the CLI but carry the same experimental caveat. |
| 8 | +
|
| 9 | +--- |
| 10 | + |
| 11 | +## What Loom is |
| 12 | + |
| 13 | +Loom is StrayMark's third component (alongside the Framework and the CLI): a loopback-only, read-only **development dashboard** that makes a StrayMark project legible to the human eye. It has two surfaces over the same project: |
| 14 | + |
| 15 | +1. **Knowledge Graph** — the web of your StrayMark *documents*, rendered as a live force-directed graph from their frontmatter links (`related`, `originating_ailogs`, …). Select a node and its whole thread of relationships lights up. This view is self-explanatory and needs no setup. |
| 16 | +2. **Architecture Map** — the *system's* implementation map: components and layers (your real architecture), with a live **"you are here" status overlay** computed from governance state (active Charters, drift, closed work, open technical debt). It answers the daily *"where are we?"* visually. **This view is driven by a model you author + refine** — the rest of this guide is about that. |
| 17 | + |
| 18 | +Loom never writes into your project — it only *visualizes* what the CLI computes. The CLI commands (`validate`, `audit`, `charter drift`) remain the source of truth and the gate. |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## The mental model: one model, many views (BIM) |
| 23 | + |
| 24 | +The Architecture Map borrows the **BIM "one model, many views"** idea. There is **one** model, expressed as two linked files under `.straymark/architecture/`: |
| 25 | + |
| 26 | +| File | What it holds | Who owns it | |
| 27 | +|---|---|---| |
| 28 | +| `model.yml` | The **semantics** — components → file globs, layers, links | You (seeded by the CLI) | |
| 29 | +| `plan.drawio` | The **layout** — the boxes-and-arrows diagram (DrawIO/mxGraph) | You (seeded by the CLI) | |
| 30 | + |
| 31 | +From that one model, StrayMark renders **three projections**, all from the *same* status computation so they can't disagree: |
| 32 | + |
| 33 | +- **Textual** — `straymark status --where` (the terminal "you are here"). |
| 34 | +- **2D plan** — Loom's Architecture tab (your `plan.drawio`, overlaid with live status). |
| 35 | +- **3D axonometric** — Loom's `2D | 3D` toggle (an exploded, BIM-style view). |
| 36 | + |
| 37 | +The **status overlay is computed live, never hand-maintained.** You author *structure* (which files belong to which component, how components relate); StrayMark colors it (`active` / `in-progress` / `implemented` / `has-debt` / `uncharted`) from governance signals every time you look. |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## The recommended workflow |
| 42 | + |
| 43 | +``` |
| 44 | +generate → refine (human or AI) → validate → sync (as code grows) → loom serve |
| 45 | + draft the real model CI gate append-only visualize |
| 46 | +``` |
| 47 | + |
| 48 | +### 1. Generate — a first-draft seed |
| 49 | + |
| 50 | +```bash |
| 51 | +straymark architecture generate |
| 52 | +``` |
| 53 | + |
| 54 | +Mines your codebase structure (one component per source directory) and enriches it from your ADRs (C4 diagrams + "Affected Components" tables improve labels and add links). It writes `model.yml` + `plan.drawio` with every component in a placeholder `unassigned` layer and the `.straymark` stages 00–09 as placeholder layers. |
| 55 | + |
| 56 | +The seed is **language- and structure-aware** (it descends through `internal/`, `src/`, `pkg/`, … and skips Maven/Gradle scaffolding so a Java module isn't one `main` box). For non-default stacks you can extend it with an `architecture:` section in `.straymark/config.yml` — see [CLI-REFERENCE](./CLI-REFERENCE.md#straymark-architecture-generatesyncvalidate-cli-3250-experimental). |
| 57 | + |
| 58 | +**The seed is a draft, not the answer.** It captures the shape; you make it meaningful in the next step. |
| 59 | + |
| 60 | +### 2. Refine — the phase that matters (human *or* AI) |
| 61 | + |
| 62 | +This is where a generated map becomes a real one. `model.yml` is plain YAML and `plan.drawio` is a standard DrawIO file, so refinement can be done **by a person, by an AI agent, or both**: |
| 63 | + |
| 64 | +- **Rename the layers** from the placeholder stages to your real architecture (e.g. `entrypoints`, `domain`, `persistence`, `web`). |
| 65 | +- **Reassign components** out of `unassigned` into those layers. |
| 66 | +- **Fix labels** to human names (`internal-modules-commshub` → "CommsHub"). |
| 67 | +- **Tighten globs** so each component owns exactly its files. |
| 68 | +- **Add `links`** between components to capture real dependencies. |
| 69 | +- **Lay out the diagram** in DrawIO (open `plan.drawio`) so the 2D plan reads well. |
| 70 | + |
| 71 | +> **AI-assisted refinement.** Because the model is just YAML + DrawIO XML, an AI coding agent can do this directly: point it at `model.yml` and your codebase and ask it to assign layers, fix labels, and add dependency links. It operates the same CLI (`generate` / `validate` / `sync`) and edits the same files you would. The refinement is a normal review-and-edit loop — keep what's right, correct what's wrong. |
| 72 | +
|
| 73 | +### 3. Validate — catch model↔plan drift |
| 74 | + |
| 75 | +```bash |
| 76 | +straymark architecture validate # text; exits 1 on any signal (CI-gateable) |
| 77 | +straymark architecture validate --output json |
| 78 | +``` |
| 79 | + |
| 80 | +Reports integrity signals: **undrawn** (a component with no diagram cell), **unmodeled** (a diagram cell missing from the model), **empty** (globs that match no files). Errors are now legible (they name the exact cause — e.g. a component id colliding with a layer id), so a malformed model tells you what to fix. |
| 81 | + |
| 82 | +### 4. Sync — keep up as the code grows (append-only) |
| 83 | + |
| 84 | +```bash |
| 85 | +straymark architecture sync # dry-run: shows what's new |
| 86 | +straymark architecture sync --apply # appends new dirs / ADR components |
| 87 | +``` |
| 88 | + |
| 89 | +Detects new source directories and ADR components not yet in the model and **appends** them — it **never** clobbers your edits or your DrawIO geometry. Run it when you add a module; refine the new entries the same way. |
| 90 | + |
| 91 | +### 5. Serve — see it live |
| 92 | + |
| 93 | +```bash |
| 94 | +straymark loom serve # downloads the loom-* binary on first use, opens the browser |
| 95 | +``` |
| 96 | + |
| 97 | +Opens both views on `localhost`. The Architecture tab shows your refined plan with the live overlay; the `2D | 3D` toggle gives the axonometric view. Edits to `.straymark/` (or the model) update the open browser in under a second. There's also a terminal-only answer that needs no server: |
| 98 | + |
| 99 | +```bash |
| 100 | +straymark status --where # the textual "you are here" |
| 101 | +``` |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## Honest limitations (it's a seed, not authoritative output) |
| 106 | + |
| 107 | +- The **generated seed is a starting point.** It will not infer your intended layers or component boundaries — that's the refinement phase, by design. |
| 108 | +- **Coverage depends on your stack.** The scan recognizes ~25 languages by default and handles common layouts (Go `internal/`, JS `src/`, multi-module Maven/Gradle). A non-default language or an unusual layout needs an `architecture:` config entry and more hand-refinement — but the seed never *misleads*; it just gives less of a head start. |
| 109 | +- The **`has-debt` overlay is as precise as your debt records.** Debt is attributed to the components an open TDE's referenced AILOGs actually modified; coarse `files_modified` lists spread it wider than the debt itself. |
| 110 | +- **Loom is N=1.** It has been validated by dogfooding on this project and the Sentinel reference. Expect rough edges; report them. |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## See also |
| 115 | + |
| 116 | +- [CLI-REFERENCE](./CLI-REFERENCE.md) — `straymark architecture <generate|sync|validate>`, `status --where`, and `loom serve` flags + the `architecture:` config section. |
| 117 | +- [WORKFLOWS](./WORKFLOWS.md) — how the architecture map fits the day-to-day StrayMark cadence. |
| 118 | +- [ADOPTION-GUIDE](./ADOPTION-GUIDE.md) — getting StrayMark into a project in the first place. |
0 commit comments