# /brain-ingest

Ingest a new source into the wiki.

Drop a file into `raw-sources/articles/`, `raw-sources/pdfs/`, or `raw-sources/personal/`, or give it a URL, then run `/brain-ingest`. Your agent will:

1. **Check the log** in `wiki/log.md`. If this source was already ingested and hasn't changed, it says so and stops. If the file changed, it ingests it as an update.
2. **Read** the source in full. A URL is first saved as markdown in `raw-sources/articles/`, so the original survives even if the page changes.
3. **Summarize** it in 3–5 bullets and ask you what matters most.
4. **Create** a `wiki/sources/[slug].md` page with abstract, key claims, notable quotes, and your synthesis note.
5. **Update** or create topic/entity pages that the source touches, integrating it as prose (not copy-paste) with source attribution.
6. **Flag contradictions** with `[!WARNING]` callouts on any page where the new source disagrees with existing claims.
7. **Log** the ingest in `wiki/log.md`, with the source's path and a content hash.
8. **Commit** the ingest to git on its own, so you can review it or undo it with `git revert`.

## Ingesting only what's new

The log is the record of what has been ingested. Each ingest entry ends with a `source:` line:

```
## [2026-11-30] ingest | My Article

[[wiki/sources/my-article]] | Pages touched: [[wiki/topic-a]], [[wiki/topic-b]]
source: raw-sources/articles/my-article.md | hash: 1a2b3c4d5e6f
```

The hash is the first 12 characters of the file's SHA-256. A saved web page also gets `| url: <url>` at the end of that line, and the URL is checked before anything is fetched.

* **Same file, same hash**: skipped.
* **Same file, new hash**: ingested again as an update. The existing source summary page is revised, not duplicated, and the log entry says `reingest`.
* **Force it**: say "reingest" or "force" to ingest again even when nothing changed.
* **Catch up**: say "ingest everything new" to check every file in `raw-sources/`. Your agent lists the new and changed ones, confirms, then ingests each with its own log entry and commit.

## Commits

When the brain is a git repo, each ingest ends with one commit of `wiki/` and the source file, with a subject like `ingest: My Article` (`reingest:` for an update). Other changes in the vault are left out of it. The skill doesn't push; [obsidian-git](https://jessepinkman9900.github.io/claude-second-brain/integrations/obsidian-git) or you do that. To undo an ingest, `git revert` its commit.

Scope: global skill, installed once at `~/.agents/skills/brain-ingest/SKILL.md` and symlinked into each selected agent's global skills dir (e.g. `~/.claude/skills/brain-ingest`). Paths resolve at call time via `npx claude-second-brain path` and `npx claude-second-brain qmd` — both read `~/.claude-second-brain/config.toml` to find the default brain. Source: [template/.claude/skills/brain-ingest/SKILL.md](https://github.com/jessepinkman9900/claude-second-brain/blob/main/template/.claude/skills/brain-ingest/SKILL.md).
