Move AI artifacts outside project repositories #17

Merged
alexion merged 5 commits from ai-artifacts into main 2026-07-30 00:34:02 -04:00
8 changed files with 41 additions and 49 deletions
Showing only changes of commit 6bb3242e7f - Show all commits

View File

View File

View File

@@ -1 +0,0 @@
../.agents/spec

View File

@@ -1 +0,0 @@
../.agents/tasks

View File

@@ -1,12 +1,12 @@
# skills
Personal agent skills packaged through Nix.
The domain glossary lives in `.agents/CONTEXT.md`.
The domain glossary lives at `$(xdg-user-dir DOCUMENTS)/ai-artifacts/projects/skills/CONTEXT.md`.
## Conventions
- `AGENTS.md` and `.agents/` are canonical for agent-facing project instructions, context, ADRs, specs, tasks, and project-local skill links.
`CLAUDE.md` and `.claude/` exist only as Claude Code compatibility surfaces.
- `AGENTS.md` is canonical for project instructions.
Context, ADRs, specs, and tasks live under `$(xdg-user-dir DOCUMENTS)/ai-artifacts/projects/skills/`.
- Skill source lives under `skills/<name>/`.
Do not edit generated links under `.agents/skills/` or `.claude/skills/` as source.
- Run `nix flake check` before considering a repository-wide change complete.
@@ -16,5 +16,5 @@ The domain glossary lives in `.agents/CONTEXT.md`.
## Gotchas
- The vault write area remains `01 sources/claude/` for now.
That path is a historical vault taxonomy and is not the canonical project metadata namespace.
- The development environment does not provide `python3` by default.
Use available project tools instead of assuming Python is installed.

View File

@@ -1,15 +1,15 @@
---
name: consume
description: "Consume a project (or, later, another source) into the agent's personal wiki — distil generalized, transferable knowledge from it into the Obsidian vault's agent-owned area, then clear the consumed scaffolding. Deliberate: run as /skill:consume [target], never automatically."
description: "Consume a project (or, later, another source) into the agent's AI-managed wiki — distil generalized, transferable knowledge into the artifact store, then clear the consumed scaffolding. Deliberate: run as /skill:consume [target], never automatically."
disable-model-invocation: true
---
# consume
Mine a source for its knowledge, routing each fact to the agent's own wiki or the target's always-loaded docs, then clear the consumed scaffolding once the knowledge is safely captured.
Mine a source for its knowledge, routing each fact to the agent's AI-managed wiki or the target's always-loaded docs, then clear the consumed scaffolding once the knowledge is safely captured.
`/consume [target]` ingests one target — a filesystem path, defaulting to the current directory — and distils what it mines into two channels.
It is the write side of a pair with the read-only `/wiki`, which it invokes to read the rest of the vault.
It is the write side of a pair with the read-only `/wiki`, which it invokes to read the rest of the AI-managed wiki.
The **pull channel** is the wiki — reusable knowledge a future agent retrieves on demand — and a fact earns a note there only if it both **generalizes** past the target it came from and is **trigger-able**, meaning some symptom, error, or task would send that agent looking for it.
The **push channel** is the target's own always-loaded documentation, its `AGENTS.md`, which carries what is useful but not wiki-shaped: a concrete repo-specific answer, or a proactive rule whose value is firing unprompted.
@@ -21,21 +21,20 @@ Nothing is written and nothing is deleted until the user approves the plan.
Consume writes to two channels and nowhere else.
The vault lives at `$(xdg-user-dir DOCUMENTS)/notes`.
Resolve it, and if it does not exist report that the vault is unreachable and stop.
Inside the vault, write only under `01 sources/claude/`, treating every other vault path as off-limits to writes.
Outside the vault, the sanctioned content write is the target's own always-loaded documentation, its `AGENTS.md` — the push channel of step 6.
If the target has Claude Code markers such as `.claude/` or `CLAUDE.md`, `consume` may also create or update `CLAUDE.md` as a compatibility shim pointing to `AGENTS.md`.
Everything else in the target is read-only, save for that shim and for the scaffolding step 7 deletes.
The AI-managed wiki lives at `$(xdg-user-dir DOCUMENTS)/ai-artifacts/wiki`.
Resolve it, and if it does not exist report that the wiki is unreachable and stop.
Write pull-channel notes only directly under that flat directory.
Outside the wiki, the sanctioned content write is the target's own always-loaded documentation, its `AGENTS.md` — the push channel of step 6.
Everything else in the target is read-only.
The harness does not apply the vault's own permission rules when you run from outside it, so enforcing the vault boundary is the skill's job.
All reading of the wider vault goes through `/wiki` (step 3), which enforces the vault's read boundary itself.
All reading of the wider AI-managed wiki goes through `/wiki` (step 3).
## 1. Select the branch
Resolve the artifact project directory as `$(xdg-user-dir DOCUMENTS)/ai-artifacts/projects/<project>`, where `<project>` is the lowercase basename of the target directory.
Route the target through this ladder, first match wins:
- A directory containing `.agents/spec/`, `.agents/tasks/`, `.claude/spec/`, or `.claude/tasks/` → a project: follow [`project.md`](project.md).
- An artifact project directory containing `spec/` or `tasks/` → a project: follow [`project.md`](project.md).
- No rung matches → report that the target is not something consume knows how to read, write nothing, and stop.
Done when a branch file is selected, or consume has stopped on an unsupported target.
@@ -51,8 +50,8 @@ Done when you understand what the target actually is now, from its branch's sour
Two reads with different jobs:
- Invoke `/wiki` on the concepts the target raised, to learn what the whole vault already holds — so new notes link to existing notes and hubs, and you do not re-capture knowledge the vault already has.
- Scan `01 sources/claude/` directly for the concept notes you may need to enrich.
- Invoke `/wiki` on the concepts the target raised, to learn what the whole AI-managed wiki already holds — so new notes link to existing notes and hubs, and you do not re-capture knowledge the wiki already has.
- Scan the AI-managed wiki directly for the concept notes you may need to enrich.
Done when you know which existing notes bear on what you are about to write.
@@ -88,16 +87,16 @@ Done when every mined fact has a decided destination — pull note, push item, o
Write the plan as a self-contained HTML file to the session's scratchpad directory and give the user its path.
The report is a complete ledger of every mined fact's disposition, not only of what gets written, so the selection bar itself can be reviewed:
1. **Vault write-set (pull)** — each note to write or update, with its **trigger line**: one sentence naming the symptom, error, or task that would send a reader to retrieve it, and the `[[hub]]` wikilinks it belongs under.
1. **Wiki write-set (pull)** — each note to write or update, with its **trigger line**: one sentence naming the symptom, error, or task that would send a reader to retrieve it, and the `[[hub]]` wikilinks it belongs under.
2. **Contribution map** — for every consumed file, the notes it feeds and the exact contributing sections, including any file that fed nothing.
3. **Push write-set (target `AGENTS.md`)** — each proactive rule and each specific residue to add, each existing entry to trim to its residue, and each pure-general entry to remove, with the exact text and where it lands.
4. **Ref-fixes** — each file holding a reference to a spec or task file about to be deleted, and how the reference is fixed or removed. These accompany the scaffolding deletion of step 7, not the target write-set.
5. **Flagged, not authored** — any `[[hub]]` a note links that does not yet exist under `02 tags/` or `03 index/`, and any push knowledge whose home is a hook or checklist rather than `AGENTS.md` — surfaced for the user to act on by hand.
5. **Flagged, not authored** — any `[[hub]]` a note links that does not yet exist under `tags/`, and any push knowledge whose home is a hook or checklist rather than `AGENTS.md` — surfaced for the user to act on by hand.
6. **Drops** — every mined fact considered and cut, one line of why each.
The vault write-set and the target-`AGENTS.md` write-set are approved independently: the user may accept one and decline the other.
The wiki write-set and the target-`AGENTS.md` write-set are approved independently: the user may accept one and decline the other.
A declined target write-set degrades to flagged suggestions — reported for the user to apply by hand, written nowhere.
The ref-fixes and the scaffolding deletion are not a write-set to accept or decline — they follow from proceeding with the run and execute in step 7, gated only behind the vault writes.
The ref-fixes and the scaffolding deletion are not a write-set to accept or decline — they follow from proceeding with the run and execute in step 7, gated only behind the wiki writes.
Stop and wait for the user's explicit approval.
Write nothing and delete nothing until they approve.
@@ -106,16 +105,16 @@ Done when the user has ruled on each write-set.
## 6. Write the notes and reconcile the push channel
Write the approved vault write-set first.
Write each new note and update each changed one under the output area the branch declares, using the vault's note template (`99 meta/templates/note.md`): fill its `Tags:` line with the `[[hub]]` wikilinks the note belongs under, and its body with the distilled knowledge.
Write the approved wiki write-set first.
Write each new note directly under the output area the branch declares as distilled markdown.
When updating an existing note, preserve its format.
Link a hub whether or not its note exists yet — a dangling `[[hub]]` is a valid link and still feeds `/wiki` recall.
Then, if the target write-set was approved, reconcile the target's `AGENTS.md`: add the proactive rules and any specific residue the file does not already hold, trim mixed entries to their specific residue, and remove the pure-general entries.
When Claude Code markers are present, create or update `CLAUDE.md` as a compatibility shim to `AGENTS.md` rather than duplicating the push-channel content.
Removal is gated on capture — trim or remove an entry only when its general part is present in the wiki, written just now in this run or confirmed already there via `/wiki`, never on the intention to write a note.
If the target write-set was declined, write nothing to the target and leave its items as the flagged suggestions of step 5.
Done when the approved vault notes are written and, if approved, the target's `AGENTS.md` is reconciled.
Done when the approved wiki notes are written and, if approved, the target's `AGENTS.md` is reconciled.
## 7. Clear the consumed scaffolding
@@ -126,7 +125,7 @@ Done when the branch's cleanup has run.
## 8. Report
Tell the user what you created, updated, and left untouched across both channels — vault notes written or updated, and the target's `AGENTS.md` reconciliation applied or, if declined, left as flagged suggestions.
Repeat the suggested new hubs and any hook-or-checklist items from the report, so the vault's `02 tags/` and `03 index/` and the target's other channels can be filled in by hand.
Tell the user what you created, updated, and left untouched across both channels — wiki notes written or updated, and the target's `AGENTS.md` reconciliation applied or, if declined, left as flagged suggestions.
Repeat the suggested new hubs and any hook-or-checklist items from the report, so the wiki's `tags/` and the target's other channels can be filled in by hand.
Done when the summary names every note written or updated, every target edit applied or flagged, and every suggested hub.

View File

@@ -1,7 +1,7 @@
# project branch
How consume reads a project target, and what it clears afterward.
Reached from step 1 of [`SKILL.md`](SKILL.md) when the target is a directory containing `.agents/spec/`, `.agents/tasks/`, `.claude/spec/`, or `.claude/tasks/`.
Reached from step 1 of [`SKILL.md`](SKILL.md) when the target's artifact project directory contains `spec/` or `tasks/`.
## Read the source, mine the specs
@@ -10,8 +10,7 @@ Read it thoroughly enough to understand its current state and to surface the reu
A gotcha usually carries two separable things — a transferable principle and a concrete repo-specific answer — so surface both.
Step 4 of SKILL.md routes the principle to the pull channel and the residue to the target's push channel.
`.agents/spec/` and `.agents/tasks/` are the canonical record of *why* — the reasoning, trade-offs, and intent behind what the code became.
Claude Code compatibility paths under `.claude/spec/` and `.claude/tasks/` count as the same record only when they resolve to the canonical `.agents/` paths.
The artifact project's `spec/` and `tasks/` directories are the canonical record of *why* — the reasoning, trade-offs, and intent behind what the code became.
They are the richest source of the generalizable lessons, and cleanup destroys them, so mine their reasoning now or lose it.
But they are not current fact: where a spec or task disagrees with the source, the source wins, and where one describes work later abandoned or changed, the source is what actually happened.
@@ -21,19 +20,14 @@ Done when you understand the project's current state from its source and have mi
## Output location
Project notes land flat under `01 sources/claude/projects/`, this branch's own area within the vault write boundary.
This is the source-type carve — other consume source types get their own sibling areas later, so project output never mixes with them.
Keep the area flat by default and never reorganize it.
If the user has already grouped some notes into subfolders under `projects/`, write a new note into the matching group rather than at the top level.
Project notes land flat under `$(xdg-user-dir DOCUMENTS)/ai-artifacts/wiki/`.
Do not create subdirectories there.
## Cleanup
After the notes are written (step 6 of SKILL.md), delete the spec and task files that were present under `.agents/spec/` and `.agents/tasks/` when you read the project in step 2 — the scaffolding this run consumed.
If a target only has legacy `.claude/spec/` or `.claude/tasks/`, consume those paths instead.
If both canonical `.agents/` scaffolding and real distinct legacy `.claude/` scaffolding exist, stop and ask which is authoritative.
A `.claude/` compatibility symlink to `.agents/` is not a distinct tree.
After the notes are written (step 6 of SKILL.md), delete the spec and task files that were present under the artifact project's `spec/` and `tasks/` directories when you read the project in step 2 — the scaffolding this run consumed.
A file added after that read is not swept up.
Leave the now-empty `.agents/spec/` and `.agents/tasks/` directories in place, along with any compatibility symlinks under `.claude/`.
Remove `spec/` or `tasks/` when the cleanup leaves it empty.
Deleting those files can strand references to them.
Scan the target for pointers to each file about to be deleted — in `AGENTS.md`, `CLAUDE.md`, `CONTEXT.md`, ADRs, and sibling specs — and fix or remove each one, following the pointer wherever it lands rather than checking the push channel alone.
Scan the target and its artifact project directory for pointers to each file about to be deleted — in `AGENTS.md`, `CONTEXT.md`, ADRs, and sibling specs — and fix or remove each one, following the pointer wherever it lands rather than checking the push channel alone.

View File

@@ -12,17 +12,18 @@ The caller may be the user directly, a subagent, or another skill such as `/cons
## 1. Resolve the wiki
The wiki lives at `$(xdg-user-dir DOCUMENTS)/ai-artifacts/wiki`.
If that path does not resolve or does not exist, report that the wiki is unreachable and stop.
The artifact root lives at `$(xdg-user-dir DOCUMENTS)/ai-artifacts`.
Its notes live under `wiki/` and its topic hubs live under `tags/`.
If either directory does not resolve or does not exist, report that the wiki is unreachable and stop.
Done when you have the wiki path.
Done when you have the wiki and tag paths.
## 2. Gather candidate notes
Expand the question into several search terms — synonyms, related concepts, and named entities — so a note worded differently than the question is still found.
Search with ripgrep over the Markdown files directly, not obsidian-cli, so retrieval works whether or not Obsidian is running: `rg -l -i` each term over `*.md` under the wiki.
Search with ripgrep over the Markdown files directly, not obsidian-cli, so retrieval works whether or not Obsidian is running: `rg -l -i` each term over `*.md` under `wiki/`.
Then widen for recall through the wiki's topic hubs.
Then widen for recall through the topic hubs under `tags/`.
Each note in `tags/` names a topic, and every note on that topic links to it with a bare `[[topic]]` wikilink, so for any hub matching the question, add its members — the notes containing `[[<hub-name>]]` — to the candidates.
Done when you have a candidate set of note paths.