Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/corridor-gather.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@anarchitecture/ghost": minor
---

Recompose `gather` on a corridor + hub-and-spoke model and fix a sibling-surface
context leak. A surface's slice is now: a **spine** of full-body nodes from every
file on the corridor (the package root down to the surface's own folder — folders
are walls, so sibling folders never leak in), the **edges** reachable in one hop
from any spine node's `relates` (so a broad rule authored once high in the tree —
e.g. `relates: { to: arcade }` on `features/` — reaches every descendant), and a
set of **spokes**: pointer entries (id + description) for the surface's own
descendants and any edge hub's subtree, which the agent pulls on demand. The
`GraphSlice` JSON gains a `spokes` array; graph nodes carry their file `folder`.
Grounding for `checks`/`review` remains the full-body spine + edges.
2 changes: 1 addition & 1 deletion .changeset/cross-package-extends.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@anarchitecture/ghost": minor
---

Add cross-package inheritance via `extends`. A package's `manifest.yml` can declare `extends: { <id>: <dir> }`, mapping another contract's identity to where it lives. Node refs then reference inherited context by identity, never path — `under: brand:core` or `relates: [{ to: brand:core-trust }]` (the `<package-id>:<node>` form replaces the earlier npm-style `<pkg>#<id>` ref grammar). Inherited nodes load read-only and flow into gather and validate like local ones. `ghost validate` resolves cross-package refs and reports unresolved refs, packages not declared in `extends`, identity mismatches, and cross-package cycles. This delivers the shared-brand story: one brand contract extended by many products, without copy-paste or merge. One level of `extends` in v1 (no transitive); location is an explicit relative dir (identity-based discovery is a future upgrade that keeps refs unchanged).
Add cross-package inheritance via `extends`. A package's `manifest.yml` can declare `extends: { <id>: <dir> }`, mapping another contract's identity to where it lives. Node refs then reference inherited context by identity, never path — `relates: [{ to: brand:core/trust }]` (the `<package-id>:<path>` form replaces the earlier npm-style `<pkg>#<id>` ref grammar). Inherited nodes load read-only and flow into gather and validate like local ones. `ghost validate` resolves cross-package refs and reports unresolved refs, packages not declared in `extends`, identity mismatches, and cross-package cycles. This delivers the shared-brand story: one brand contract extended by many products, without copy-paste or merge. One level of `extends` in v1 (no transitive); location is an explicit relative dir (identity-based discovery is a future upgrade that keeps refs unchanged).
2 changes: 1 addition & 1 deletion .changeset/described-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@anarchitecture/ghost": minor
---

Make `description` a first-class node field — the retrieval payload an agent matches a task against, the way a tool is selected by name + description. `ghost gather` with no argument now lists nodes by id + description (the catalog), built from the graph rather than a separate surface menu. Node frontmatter is now passthrough: free-form descriptive keys (`audience`, `stage`, …) are allowed and ride along untouched. The surface composition-edge vocabulary (`composes`/`governed-by`) is removed — lateral composition lives on node `relates`; `surfaces.yml` is now an optional terse spine file (id + parent + optional description) that folds into the node id space, not a distinct content concept.
Make `description` a first-class node field — the retrieval payload an agent matches a task against, the way a tool is selected by name + description. `ghost gather` with no argument now lists nodes by id + description (the catalog), built from the graph rather than a separate surface menu. Node frontmatter is now passthrough: free-form descriptive keys (`audience`, `stage`, …) are allowed and ride along untouched. The surface composition-edge vocabulary (`composes`/`governed-by`) is removed — lateral composition lives on node `relates`.
18 changes: 18 additions & 0 deletions .changeset/directory-tree-nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"@anarchitecture/ghost": minor
---

Collapse the on-disk node model into the directory tree: the layout *is* the
graph. A node's id is its file path (`marketing/email.md` → `marketing/email`)
and its parent is its containing directory; a surface is just a directory, and a
directory's own prose lives in its `index.md` (the package-root `index.md` is
the implicit `core` node). The `surfaces.yml` spine file and the `nodes/`
directory are removed, along with the node frontmatter `id` and `under` fields —
identity and containment now come from where a file sits, never from frontmatter
or a declared spine. Node frontmatter carries descriptive properties only
(`description`, `relates`, `incarnation`, plus passthrough keys); `relates` and
cross-package `extends` refs are path ids (`core/trust`, `brand:core/trust`).
`ghost init` scaffolds `manifest.yml` + a core `index.md`; `ghost migrate`
writes a directory tree; any `*.md` outside the reserved `checks/` subtree lints
as a node. Moving a node is a rename — `ghost validate` reports `relates` that no
longer resolve.
6 changes: 6 additions & 0 deletions .changeset/docs-node-model-refresh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@anarchitecture/ghost": patch
---

Refresh the README and docs site onto the current command set (drop the removed
`lint`/`verify`/`relay`/`describe`/`survey`/`emit` commands).
2 changes: 1 addition & 1 deletion .changeset/facet-removal.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@anarchitecture/ghost": minor
---

Remove the facet model — the graph is now the only fingerprint model. The `intent.yml`/`inventory.yml`/`composition.yml` schemas, the `GhostFingerprintDocument`, the facet→node load-time projection, and the dormant facet slice/grounding are deleted; the loader folds `nodes/*.md` + `surfaces.yml` directly into the graph. `ghost lint` and `ghost verify` are replaced by one `ghost validate` verb (artifact shape pass + node-graph pass: links resolve, one root, acyclic); `ghost emit` is removed. `ghost scan` now reports node/surface contribution instead of facet contribution. Legacy facet packages no longer load directly — `ghost validate`/load fail with guidance to run `ghost migrate`. Structured exemplar-path and evidence verification is dropped (evidence lives in node prose, per the prose-node model).
Remove the facet model — the graph is now the only fingerprint model. The `intent.yml`/`inventory.yml`/`composition.yml` schemas, the `GhostFingerprintDocument`, the facet→node load-time projection, and the dormant facet slice/grounding are deleted; the loader folds the package's directory tree of prose nodes directly into the graph. `ghost lint` and `ghost verify` are replaced by one `ghost validate` verb (artifact shape pass + node-graph pass: links resolve, one root, acyclic); `ghost emit` is removed. `ghost scan` now reports node/surface contribution instead of facet contribution. Legacy facet packages no longer load directly — `ghost validate`/load fail with guidance to run `ghost migrate`. Structured exemplar-path and evidence verification is dropped (evidence lives in node prose, per the prose-node model).
7 changes: 4 additions & 3 deletions .changeset/migrate-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"@anarchitecture/ghost": minor
---

Add `ghost migrate`: transform a legacy `.ghost/` package onto the surface model
— derive `surfaces.yml` from old `topology.scopes`, place single-scope nodes via
`surface:`, and report (never guess) any node it cannot place unambiguously.
Add `ghost migrate`: transform a legacy `.ghost/` package onto the directory-tree
node model — derive surface directories from old `topology.scopes`, place
single-scope nodes inside them, and report (never guess) any node it cannot place
unambiguously.
2 changes: 1 addition & 1 deletion .changeset/node-authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@anarchitecture/ghost": minor
---

`ghost init` now scaffolds a node package (`manifest.yml` + `surfaces.yml` spine + a seed `nodes/*.md`) via a template registry (`--template <name>`, `default` for now) instead of emitting `intent.yml`/`inventory.yml`/`composition.yml`; the `--reference` flag is removed. `ghost migrate` now performs a one-way conversion of legacy/facet packages into `surfaces.yml` + `nodes/*.md` (the facet→node projection becomes the writer) and removes the old facet files. The authoring skill (`capture.md`, `SKILL.md`) teaches node authoring with intent/inventory/composition as authoring lenses rather than facet files.
`ghost init` now scaffolds a node package (`manifest.yml` + a core `index.md` node) via a template registry (`--template <name>`, `default` for now) instead of emitting `intent.yml`/`inventory.yml`/`composition.yml`; the `--reference` flag is removed. `ghost migrate` now performs a one-way conversion of legacy/facet packages into a directory tree of nodes (the facet→node projection becomes the writer) and removes the old facet files. The authoring skill (`capture.md`, `SKILL.md`) teaches node authoring with intent/inventory/composition as authoring lenses rather than facet files.
2 changes: 1 addition & 1 deletion .changeset/remove-compare-drift-fleet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@anarchitecture/ghost": minor
---

Remove `compare`, `drift`, `ack`, `track`, and `diverge` commands and the direct `fingerprint.md` machinery (parser, writer, semantic diff, decisions/dimensions, embeddings, perceptual prior). These rested on a quantified visual-design-system model (fixed dimensions + decision embeddings) that the context-graph reframe abandoned; the concepts are parked for a graph-native rethink (see docs/ideas/compare-drift-fleet-rethink.md). The `./compare` and `./drift` package subpaths and the root `compare`/`drift` exports are removed. `ghost lint` now validates `.ghost/` packages and node/surface/check artifacts only (direct `fingerprint.md` is no longer linted); a `nodes/*.md` file lints as a `ghost.node/v1` node.
Remove `compare`, `drift`, `ack`, `track`, and `diverge` commands and the direct `fingerprint.md` machinery (parser, writer, semantic diff, decisions/dimensions, embeddings, perceptual prior). These rested on a quantified visual-design-system model (fixed dimensions + decision embeddings) that the context-graph reframe abandoned; the concepts are parked for a graph-native rethink (see docs/ideas/compare-drift-fleet-rethink.md). The `./compare` and `./drift` package subpaths and the root `compare`/`drift` exports are removed. `ghost lint` now validates `.ghost/` packages and node/surface/check artifacts only (direct `fingerprint.md` is no longer linted); a `*.md` node file lints as a `ghost.node/v1` node.
6 changes: 6 additions & 0 deletions .changeset/skill-bundle-prose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@anarchitecture/ghost": patch
---

Clean em dashes out of the shipped skill bundle and package README prose,
rewriting them as plain sentences, colons, or parentheticals.
4 changes: 2 additions & 2 deletions .changeset/surface-coordinate-space.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"@anarchitecture/ghost": minor
---

Replace topology/applies_to/surface_type/scope coordinates with a surfaces.yml
coordinate space and a single `surface:` placement per node. Remove the
Replace topology/applies_to/surface_type/scope coordinates with a surface
coordinate space and a single surface placement per node. Remove the
`ghost.map/v1` (`map.md`) coordinate and routing system; checks now route by
`applies_to.paths`.
117 changes: 66 additions & 51 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Agents can assemble UI. What they cannot reliably preserve is the product
surface composition behind that UI: hierarchy, density, restraint, repetition,
trust, flow, and the choices that make a surface feel intentional.

Ghost keeps that surface composition in a repo-local `.ghost/` fingerprint package. The public npm shape
is one package, `@anarchitecture/ghost`, with one user-facing bin, `ghost`.
The CLI validates, computes, compares, and emits deterministic packets. The
host agent does the interpretive BYOA work through the installed `ghost` skill.
Ghost keeps that surface composition in a repo-local `.ghost/` fingerprint
package, a graph of prose nodes. The public npm shape is one package,
`@anarchitecture/ghost`, with one user-facing bin, `ghost`. The CLI validates
the node graph, composes context, routes checks, and emits deterministic
packets. The host agent does the interpretive BYOA work through the installed
`ghost` skill.

## Build & Run

Expand All @@ -29,74 +31,85 @@ pnpm --filter @anarchitecture/ghost exec ghost <command>
## Architecture

Ghost is **BYOA (bring your own agent)**. Claude Code, Codex, Cursor, Goose, or
another host agent reads, decides, and writes. Ghost is the deterministic
calculator the agent reaches for: schema validation, repo-signal helpers,
structural diffs, drift checks, comparison math, and handoff packets.
another host agent reads, decides, and writes. Ghost grounds that work with two
things. A **deterministic CLI** does the repeatable parts with no LLM: schema
and graph validation, repo-signal helpers, context composition, check routing,
and advisory review packets. An **interpretive skill bundle** teaches the agent
how to author and use the fingerprint.

The canonical root `.ghost/` package follows:
The canonical root `.ghost/` package is a directory tree of prose nodes:

```text
manifest.yml
intent.yml
inventory.yml
composition.yml
validate.yml
manifest.yml # schema + id
index.md # the core node, true everywhere (optional)
<surface>/index.md # a surface's own prose (the directory is the surface)
<surface>/<node>.md # a prose node placed in that surface
checks/*.md # optional ghost.check/v1 checks
```

The three root facet files are the core model:

- `intent.yml` for surface intent.
- `inventory.yml` for curated material, exemplars, and source links.
- `composition.yml` for experience patterns.

`validate.yml` validates output through deterministic checks; it is not
generation input.
Ordinary Git review is the approval boundary for fingerprint edits.

Legacy `resources.yml`, `map.md`, `survey.json`, and `patterns.yml` may still
appear in older repos or as migration source material. They are not canonical
fingerprint input for new Ghost work.
The **directory tree is the graph**. A node is a markdown file: descriptive
frontmatter (`description`, `relates`, `incarnation`) plus a prose body. A
node's identity is its path (`marketing/email.md` → `marketing/email`) and its
parent is its containing directory. A surface is just a directory, and a
directory's own prose lives in its `index.md`. The package-root `index.md` is
the implicit `core` node. The body is written through three authoring lenses
(they guide what to capture, they are not fields):

- **intent**: the why and the stance.
- **inventory**: the materials, and pointers to code the agent can inspect.
- **composition**: the patterns that make the surface feel intentional.

`description` is the retrieval payload; `relates` links nodes laterally;
`incarnation` tags a medium-bound expression. Reserved at the package root:
`manifest.yml` and the `checks/` subtree; every other `*.md` is a node. Moving a
node is a rename. `checks/*.md` validate output, routed by surface; they are not
generation input. Ordinary Git review is the approval boundary for fingerprint
edits.

A package may `extend` another by identity (the shared-brand pattern): the
manifest's `extends` maps a package id to where it lives, and nodes reference
inherited context by identity (`relates: [{ to: brand:core/trust }]`), never by
path.

## Packages

| Package | Published? | Description |
| --- | --- | --- |
| `packages/ghost` | yes: `@anarchitecture/ghost` | Unified public package. Ships the `ghost` CLI, fingerprint package authoring, checks, advisory review packets, comparison, drift stance verbs, and the unified skill bundle. |
| `packages/ghost` | yes: `@anarchitecture/ghost` | Unified public package. Ships the `ghost` CLI, node authoring, graph validation, check routing, advisory review packets, and the unified skill bundle. |
| `packages/ghost-core` | no | Private historical shared package. Runtime code needed by npm is folded into `packages/ghost/src/ghost-core`. |
| `packages/ghost-fleet` | no | Private fleet view across many Ghost bundles. Consumes workspace exports from `@anarchitecture/ghost`. |
| `packages/ghost-ui` | no | Reference design system: shadcn registry plus `ghost-mcp` MCP server. |
| `packages/ghost-ui` | no | Parked. A standalone shadcn component registry plus `ghost-mcp` MCP server, developed in this monorepo. Not coupled to Ghost and not referenced by the docs site or public surfaces. |
| `apps/docs` | no | Docs site. |

## CLI Commands

Core workflow:

| Command | Description |
| --- | --- |
| `ghost init` | Scaffold `.ghost/` with a manifest and a core `index.md` node. |
| `ghost scan` | Report node and surface contribution. |
| `ghost validate` | Validate the package: artifact shape and the node graph (links resolve, one root, acyclic). |
| `ghost gather` | List nodes by id + description, or compose a surface's context slice (own + inherited + edges). |
| `ghost checks` | Select and ground the markdown checks governing the named surfaces. |
| `ghost review` | Emit an advisory review packet: touched surfaces, routed checks, fingerprint grounding, and the diff. |
| `ghost skill install` | Install the unified `ghost` skill bundle. |

Advanced/maintenance:

| Command | Description |
| --- | --- |
| `ghost init` | Create `.ghost/` with manifest, facets, and deterministic checks. |
| `ghost scan` | Report fingerprint contribution facets and BYOA next-step guidance. |
| `ghost signals` | Emit raw repo signals as JSON for fingerprint authoring. |
| `ghost lint` | Validate a fingerprint package or single artifact. |
| `ghost verify` | Validate fingerprint evidence and exemplar paths, and typed check refs. |
| `ghost describe` | Print direct markdown section ranges. |
| `ghost diff` | Structural direct-fingerprint prose diff between direct fingerprints. |
| `ghost survey <op>` | Legacy survey helpers for optional `ghost.survey/v1` workflows. |
| `ghost check` | Run active `ghost.validate/v1` deterministic gates against a diff. |
| `ghost review` | Emit an evidence-routed advisory review packet grounded in fingerprint facets, inventory exemplars, checks, and the diff. |
| `ghost compare` | Pairwise or composite comparison over packages or direct fingerprints. |
| `ghost ack` | Record stance toward the tracked fingerprint in `.ghost-sync.json`. |
| `ghost track` | Shift the tracked fingerprint. |
| `ghost diverge` | Declare intentional divergence on a dimension. |
| `ghost emit <kind>` | Emit `review-command`. |
| `ghost skill install` | Install the unified `ghost` agentskills.io bundle. |

`ghost scan --format json` is deterministic contribution and source-signal state.
It does not run an LLM.
| `ghost migrate` | Migrate a legacy `.ghost/` package onto the node-graph surface model. |

`ghost scan --format json` is deterministic contribution state. It does not run
an LLM.

## Public Exports

- `@anarchitecture/ghost` for the combined surface.
- `@anarchitecture/ghost/scan` for scan contribution, source signals, and stack discovery.
- `@anarchitecture/ghost/fingerprint` for fingerprint package authoring, linting, verification, parsing, and serialization.
- `@anarchitecture/ghost/drift` for check/review/compare/stance helpers.
- `@anarchitecture/ghost/scan` for scan contribution and source signals.
- `@anarchitecture/ghost/fingerprint` for node package authoring, validation, parsing, and serialization.
- `@anarchitecture/ghost/core` for shared schemas, types, and loaders.
- `@anarchitecture/ghost/cli` for `buildCli()`.

Expand Down Expand Up @@ -132,8 +145,10 @@ Use `patch` for fixes and docs, `minor` for new commands/flags/exports, and

- Keep publishable runtime code self-contained in `packages/ghost`; no
`workspace:*` runtime dependencies in the packed public artifact.
- The canonical on-disk form is a flat `.ghost/` package.
- Direct `fingerprint.md` remains only for legacy/direct compare workflows.
- The canonical on-disk form is a `.ghost/` directory tree: `manifest.yml` plus
prose nodes (`index.md` and `<surface>/<node>.md`) and optional `checks/*.md`.
The directory layout is the graph; ids and parents come from paths, never a
spine file.
- Skill recipes live in `packages/ghost/src/skill-bundle/references/`; install
them with `ghost skill install`.
- The CLI manifest at `apps/docs/src/generated/cli-manifest.json` is generated
Expand Down
Loading