一键导入
nous-resolve
Resolve brain-sync conflict files via AI-prose merge with prototype-aware structural reasoning. Invoke as /nous-resolve <brain-root>.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Resolve brain-sync conflict files via AI-prose merge with prototype-aware structural reasoning. Invoke as /nous-resolve <brain-root>.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when invoking a nous-provided tool (cmd/<name> — e.g. cmd/gmail for Gmail access) OR when writing a new tool whose Go code calls OAuth-protected APIs. Tool users invoke `cmd/<name>` directly; tool authors need the embedded proxy protocol via `nous instructions`.
Provision the Google refresh token that grounds the OAuth shim's fake against real Google, and run the certification. Use when the conformance test skips ("no Google conformance refresh token"), on ~monthly re-cert, or when porting this to a new OAuth provider (nous#48 Microsoft).
Use proactively for any single-shot LLM call that doesn't need tool use or multi-turn conversation — classification, labelling, summarization, structured extraction, simple rewrites. Routes the work to a LOCAL Ollama model instead of a remote API call. Right answer when the task is bulk/cheap (1k+ items) or doesn't justify a remote-model invocation.
Search Gmail and read threads via Charon proxy. Use when the user asks to search email, check Gmail, find threads, or enrich data from email correspondence.
| name | nous-resolve |
| description | Resolve brain-sync conflict files via AI-prose merge with prototype-aware structural reasoning. Invoke as /nous-resolve <brain-root>. |
Resolve conflict files left by brain-sync (format: <stem>.conflict-<peer>-<YYYYMMDDTHHMMSSZ>.<ext>, e.g. paris.conflict-xianxu-mbp-20260507T221604Z.md) by reading both versions, the file's prototype if any, and ambient context, then producing a merged version. Pre-merge versions are preserved under .brain/merges/ as a safety floor; the merged result is committed explicitly.
/nous-resolve <brain-root> # resolve conflict files
/nous-resolve <brain-root> undo # revert the most recent merge
<brain-root> is the absolute path to the brain repo (must contain .brain/config.md). One brain at a time.
When invoked without undo, the skill walks the 7-step resolve procedure below. Heavy lifting — context loading, structural reasoning, the actual merge — is done by the agent; helper scripts (preserve.py, find-conflicts.sh) handle deterministic mechanical steps only.
When invoked with undo, the skill walks the undo procedure at the bottom — git revert on the most recent merge commit, restoring canonical + conflict file + removing the snapshot in one operation.
<brain-root><brain-root>/.brain/config.md must exist. If not, refuse:
brain-root must contain .brain/config.md — that's how a brain is identified.
Got <path>; no manifest found.
bash <skill-dir>/find-conflicts.sh <brain-root>
Output: tab-separated tuples <canonical>\t<conflict-file>\t<peer>\t<utc-ts> per line.
peer + utc-ts, ask which to resolve (or all to do them in timestamp order).For each pair to resolve:
Both versions in full: read <canonical> and <conflict-file>. Print the file lengths and a 1-line diff summary so the user sees the magnitude.
The prototype if any: read <canonical>'s YAML frontmatter for a type: field. If present, search for the prototype:
<brain-root>/construct/datatype/<type>.md<brain-root>/../nous/construct/datatype/<type>.md (sibling-repo lookup)<brain-root> looking for any construct/datatype/<type>.md ancestor (max 4 levels)If found, read it. The prototype documents per-section semantics — that's what makes structural merge correct rather than guessed.
Recent commits to the canonical: git -C <brain-root> log -p --follow -n 5 -- <canonical-relative-path>. Reveals which sections were recently active and who-changed-what.
Inline references: scan canonical and conflict for markdown links ([text](path)) and frontmatter sources: / references: / deps:. For paths inside this brain, read the referenced files (depth 1, no recursion).
Loading depth is your judgment — a one-line scalar conflict doesn't need 5 commits of history; a contested itinerary section does.
This is the load-bearing step. Walk the file from frontmatter through body sections, classifying each element and applying the merge rule.
Identification taxonomy (from prototype if available; else from heuristics):
scalar — single value (destination: "Rome", status: planning)enum scalar — restricted vocabulary (status: planning|booked|in-progress|done)list — inline [a, b, c] or block - a\n- b\n- ckey-anchored list — heading-keyed entries like ### 2026-08-01 under ## Itinerary, or ### nous-3-m1 detail blockstable — markdown table with a discoverable primary-key columnprose — heading followed by paragraphsDefault merge rules per element type (override with prototype declarations when they contradict):
updated: timestamp if both files have a meaningful one. Otherwise surface the conflict to the user with both values + your recommendation.id/name/key). Union rows by key, preserving canonical's order; append peer-only rows. If no primary key is discoverable, treat the whole table as prose.<!-- from peer --> if confusion is likely). If both peers edited the same paragraph (same first ~10 words), surface to user with both versions.Prototype as contract: when the prototype documents a section's purpose ("Travelers is the list of trip participants"), trust the prototype over heuristics. The prototype is what makes "Travelers" a list even if a peer accidentally wrote it as a paragraph.
Surface, don't guess: any case where the merge isn't obvious — both edited the same scalar with no updated: discriminator, both modified an unknown section, prose paragraphs that overlap in subject — present both options + your recommendation. The pensive's failure mode is the LLM dissolving structure; surfacing prevents that.
Show the user:
canonical → merged<conflict-file> → mergedtravelers: as union: kept alice, added bob"; "Itinerary: kept all of canonical's days; added peer's 2026-08-04 entry")Ask:
Apply this merge?
[y]es — preserve, write, commit
[n]o — abort, leave files untouched
[s]how-full — print the full merged content before deciding
In order, no ambiguity:
python3 <skill-dir>/preserve.py <canonical> <conflict-file>
# writes <brain-root>/.brain/merges/<utc-iso>-<canonical-slug>/{canonical<ext>, peer<ext>, meta.json}
Then write merged content to <canonical>. Then rm <conflict-file>. Order matters: preserve runs before any destructive write.
git -C <brain-root> add <canonical> .brain/merges
git -C <brain-root> rm <conflict-file> # already deleted on disk; this stages the deletion
git -C <brain-root> commit -m "merge: <canonical-relative> via /nous-resolve
peer: <peer-id-from-conflict-filename>
conflict-ts: <utc-ts-from-conflict-filename>
preserved at: .brain/merges/<utc-iso>-<canonical-slug>/
structural choices:
- <choice 1>
- <choice 2>
..."
brain-sync will pick the new commit up via its ref-watcher and push.
If multiple pairs were chosen for resolution in step 2, repeat steps 3–7 per pair, in utc-ts order.
When invoked as /nous-resolve <brain-root> undo, revert the most recent merge committed by this skill. The safety floor: any /nous-resolve merge can be undone with one command, restoring canonical + conflict file + removing the snapshot directory.
<brain-root>Same as resolve step 1: <brain-root>/.brain/config.md must exist.
git -C <brain-root> log --grep '^merge: .* via /nous-resolve$' -1 --format='%H %ai %s'
If empty: report "no /nous-resolve merge commits in this brain — nothing to undo." Stop.
If found: print the commit summary so the user sees what's about to be reverted:
git -C <brain-root> log -1 --format=%B <sha>Revert this merge?
[y]es — restores canonical, restores conflict file, removes .brain/merges snapshot
[n]o — abort
Note: if commits landed AFTER the merge that depend on the merged content,
git revert may produce conflicts. In that case the revert is aborted and
the brain is left untouched; resolve manually.
git -C <brain-root> revert <sha> --no-edit
git revert produces a new commit whose diff is the inverse of the merge commit. Result:
.brain/merges/<ts>-<slug>/canonical.<ext>, peer.<ext>, meta.json → removed (git tracks files, may leave empty parent dir; harmless, optionally rmdir it)If git revert reports conflicts (subsequent commits modified the same lines), it leaves the working tree mid-revert. Abort with git -C <brain-root> revert --abort, tell the user to resolve manually, and stop. Don't try to auto-fix.
The new revert commit triggers brain-sync's ref-watcher; it pushes to origin on the next cycle. No explicit push needed.
Snapshots persist under .brain/merges/<utc-iso>-<slug>/ until manually pruned. Useful queries:
# All /nous-resolve merge commits in this brain
git log --grep '^merge: .* via /nous-resolve$' --format='%h %ai %s'
# Merges in the last week
git log --grep '^merge: .* via /nous-resolve$' --since '1 week ago'
# Merges of a specific path
git log --grep '^merge: data/life/travel/.* via /nous-resolve$'
# Snapshots on disk (newest first)
ls -1 <brain-root>/.brain/merges/ | sort -r | head
To revert a specific older merge (not the most recent), pass the SHA explicitly: git -C <brain-root> revert <older-sha> --no-edit. The skill's undo subcommand only handles the most-recent case; older targeted reverts are a manual git operation.
To prune old snapshots: rm -rf <brain-root>/.brain/merges/<utc-iso>-<slug>/. No automated prune yet; revisit if .brain/merges/ becomes large.
<file>.conflict-peerB-... AND <file>.conflict-peerC-...): resolve in utc-ts order, treating each as a successive merge against the current canonical..png, .pdf, etc.): refuse — "binary conflict needs manual resolution. Choose canonical or peer manually with mv, then commit." AI-prose merge doesn't apply to bytes.git status post-merge — if the working tree shows changes to canonical that aren't yours, abort and ask the user to re-run.merge: rules in prototype frontmatter — conditional M4, ships only if the M3 dogfood reveals real structural failures the prompt-guided merger can't be coaxed out of.undo subcommand reverts only the most recent /nous-resolve commit. Older targeted reverts are manual git revert <sha> operations..brain/merges/<ts>-<slug>/ directories persist until manually removed. Add a prune subcommand if it becomes a real problem.## Travelers as the trip-participants list, treat it as a list even if a peer wrote it as prose — that's a structural error to merge into list shape, not a competing format to preserve.done_when for the /brain-resolve work is "human-confirmed without data loss" — confirmation is cheap, silent dissolution is expensive.git log should see what was kept from each side and why.