Skip to content

A Claude Code / Codex plugin that helps you learn how to build while AI writes the code.

Python

feat: add confirmed project reset and clarify checkpoint controls

Noah Kimd94f6a465b20
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index bf0eba6..b434343 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "vibe-wise",
- "version": "0.1.13",
+ "version": "0.1.14",
"description": "You build. AI writes. Learn how to build software while Claude writes the code.",
"author": { "name": "Noah Kim" },
"repository": "https://github.com/nykooi1/vibe-wise",
diff --git a/README.md b/README.md
index c5675e9..4336929 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ You:
Claude:
────────────────────────────────────────────────────────────
- ✦ ✦ ✦ BUILD CHECKPOINT - Who can change a shared list ✦ ✦ ✦
+ ✦ ✦ ✦ 🧠 BUILD CHECKPOINT - Who can change a shared list ✦ ✦ ✦
Friends need to read the list without being able to change it.
@@ -51,7 +51,7 @@ Claude:
────────────────────────────────────────────────────────────
- ✦ ✦ ✦ DECISION CHECKPOINT - Who can change a shared list ✦ ✦ ✦
+ ✦ ✦ ✦ 💬 DECISION CHECKPOINT - Who can change a shared list ✦ ✦ ✦
Proposed: check ownership on the server before allowing a change. This keeps
friends' viewing access separate from editing. Edits must pass through the server.
@@ -59,13 +59,13 @@ Claude:
If confirmed, we'll record this access rule. Next, we'll work through how the
server knows who's making the request; we haven't chosen that yet.
- ❯ 1. Use this choice
+ ❯ 1. Confirm approach
2. Discuss first
```
You don't need to know the answer already. Claude can explain unfamiliar concepts, sketch the relevant pieces, and help you tackle a smaller question. You stay involved in forming the plan. Answer in plain English; ask for more help or say “skip” whenever you want.
-**Use this choice** records a design decision and continues planning. **Implement this step** writes the specific code Claude just described. **Discuss first** lets you ask questions or explore alternatives before either action.
+**Confirm approach** records a design decision and continues planning. **Implement this step** writes the specific code Claude just described. **Discuss first** lets you ask questions or explore alternatives before either action.
Small diagrams help you trace data, understand relationships, and see how the system fits together.
@@ -92,6 +92,12 @@ Preferences, learning notes, and a project map live in `.vibe-wise/` in your pro
No extra account, backend, or telemetry. Saved notes are included in Claude's context, so your normal Claude Code data settings still apply.
+To start learning this project from scratch, run `/vibe-wise:reset`. It shows the
+project and asks **Cancel / Reset learning**. After confirmation, it backs up your
+profile, progress, and project map inside the notes directory's `backups/` folder,
+then restarts onboarding. Source code and other projects stay untouched. To change
+your experience level or preferences, just tell Claude; no reset is needed.
+
## Try a local checkout
Before this version is published, or to develop locally, launch Claude from your project with an absolute path to this checkout:
diff --git a/docs/development.md b/docs/development.md
index 3c6909b..0aa2a7d 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -1,6 +1,7 @@
# Development
-V1 is a Claude Code skill, Markdown instructions, and one read-only Python hook.
+V1 uses Claude Code skills, Markdown instructions, one read-only Python hook,
+and a small Python helper for confirmed learning resets.
There are no packages to install. Python 3.8+ is sufficient for the hook and tests.
## Local checks
@@ -20,6 +21,9 @@ bounded context, and read-only behavior. They do not prove teaching quality.
Rename coverage verifies that `.sensible-vibes/` notes restore without migration,
`.vibe-wise/` takes precedence at the same location, and legacy lookup preserves
repository boundaries, nearest-state selection, and symlink rejection.
+Reset tests cover read-only preview, confirmed backup/reset, stale confirmation,
+legacy and partial notes, nested projects, repeated backups, rejected symlinks,
+backup/write failures, and restoring incomplete onboarding after reset.
## Conversation smoke tests
@@ -61,7 +65,7 @@ Launch with `claude --plugin-dir /absolute/path/to/vibe-wise`.
unfamiliar term means while answering a checkpoint. Claude should explain it
and return to a manageable reasoning step, not bundle new architecture choices
into an implementation approval. Use different projects to avoid overfitting.
- A design-only Decision Checkpoint should offer Use this choice / Discuss first. Confirming
+ A design-only Decision Checkpoint should offer Confirm approach / Discuss first. Confirming
it records the choice and continues to unresolved decisions without writing
application code. Implementation approval must name a concrete coding scope.
7. **Preference versus reasoning:** Answer a checkpoint with a tentative preference
@@ -72,7 +76,8 @@ Launch with `claude --plugin-dir /absolute/path/to/vibe-wise`.
diagram shows real components and labeled flows. Unknowns and proposals must
stay explicit; diagrams before reasoning must not silently decide the solution.
Build and Decision Checkpoints should start with a divider and bold named title
- with three `✦` stars on each side,
+ with three `✦` stars on each side and a consistent icon (🧠 Build, 💬 Decision,
+ 🔎 System),
followed by brief context and a bold question (or native picker), with no
trailing paragraphs obscuring the point where the learner should respond.
9. **Clarification without steering:** Ask about an unfamiliar concept mid-decision.
@@ -104,6 +109,14 @@ Launch with `claude --plugin-dir /absolute/path/to/vibe-wise`.
The checkpoint describes a proposal until confirmed and must not invent an
unresolved issue. No code should be written before implementation approval.
+13. **Reset:** In a temporary project with saved learning notes, invoke
+ `/vibe-wise:reset`. Confirm it shows the absolute project and state paths and
+ asks Cancel / Reset learning. Cancel must leave all files unchanged. Invoke
+ again and confirm: original notes must exist in the reported backup, the
+ active profile must be incomplete, and onboarding must ask fresh questions
+ rather than reuse old preferences. Repeat with legacy notes and after restart.
+ If notes change during confirmation, Claude must preview and confirm again.
+
Do not commit `.vibe-wise/` or test transcripts. The plugin recommends an
ignore rule during onboarding, but changes `.gitignore` only after telling the
user and receiving their instruction to make the edit.
@@ -187,3 +200,15 @@ the revised requirements-question pacing still needs a fresh-session check.
For 0.1.13, the VibeWise rename passes all 21 hook tests and plugin, marketplace,
and skill validation. New notes use `.vibe-wise/`; existing `.sensible-vibes/`
notes remain in place and are restored by the renamed plugin.
+
+For 0.1.14, reset uses a read-only preview and an explicit confirmation before
+calling the helper with that snapshot's token. Backups stay inside the selected
+state directory so its existing ignore rule applies. Only the three learning
+notes are replaced. A replacement failure may leave a partial reset; the helper
+reports failure and the backup path, and the skill stops instead of onboarding.
+All 35 tests and plugin, marketplace, and skill validation pass.
+A live print-mode smoke test verified the text confirmation fallback: preview
+changed no notes, explicit Reset learning backed up all three originals, and
+Claude asked the first onboarding question without carrying forward old preferences.
+The fixture's source file stayed unchanged. Reset's native picker still needs an
+interactive check; the existing Learn picker was verified in earlier testing.
diff --git a/skills/learn/behavior.md b/skills/learn/behavior.md
index 2b4df4a..77e0ca6 100644
--- a/skills/learn/behavior.md
+++ b/skills/learn/behavior.md
@@ -34,7 +34,7 @@ shape explanations.
and only the background needed to reason. Before their attempt, don't reveal a
recommendation, solution menu, suggested plan, or diagram that answers it.
2. **Ask.** Label every reasoning prompt, including follow-ups, with
- `✦ ✦ ✦ BUILD CHECKPOINT - <specific decision name> ✦ ✦ ✦` and ask one question
+ `✦ ✦ ✦ 🧠 BUILD CHECKPOINT - <specific decision name> ✦ ✦ ✦` and ask one question
about one problem and why. Wait; don't answer it yourself, offer approval buttons,
or write dependent code. Read-only inspection can establish facts; scaffolding
and dependency installation can commit design choices.
@@ -48,16 +48,16 @@ shape explanations.
the pieces and return one manageable step; don't dump a plan or demand repeated
guesses. Answer questions, correct your framing, and respect requests for help
or skips. New consequential decisions still get a learner turn.
-4. **Confirm.** Use `✦ ✦ ✦ DECISION CHECKPOINT - <same decision name> ✦ ✦ ✦`: summarize
+4. **Confirm.** Use `✦ ✦ ✦ 💬 DECISION CHECKPOINT - <same decision name> ✦ ✦ ✦`: summarize
the proposed approach, constraints it satisfies, and main unresolved tradeoff,
if any. Don't invent tradeoffs or add decisions. It remains proposed until
- confirmed. State the next step and use AskUserQuestion: **Use this choice**
+ confirmed. State the next step and use AskUserQuestion: **Confirm approach**
(record it and continue planning) or **Discuss first**. When prerequisites are settled,
name the code scope and offer **Implement this step** / **Discuss first**.
Wait; discussion may change the approach, then offer the choice again.
5. **Continue.** Record choices as chosen, not implemented. Approval covers only
the named step, not later choices. At milestones, occasionally ask how the pieces
- fit together with `✦ ✦ ✦ SYSTEM CHECK - <milestone> ✦ ✦ ✦`.
+ fit together with `✦ ✦ ✦ 🔎 SYSTEM CHECK - <milestone> ✦ ✦ ✦`.
Respect requested hands-on work, skips, and pauses. Ordinary build requests retain
the learning loop. Existing project and tool permissions still apply.
@@ -68,7 +68,8 @@ Ask one focused question per turn, including requirements gathering. Use native
AskUserQuestion for setup, confirmations, and multiple choice: one question, 2–4 options,
header at most 12 characters, `multiSelect: false`. Text menus are a fallback only;
open-ended reasoning belongs in chat. All callouts use
-`✦ ✦ ✦ <TYPE> - <description> ✦ ✦ ✦`: divider (`---`), blank line, **bold title**,
+`✦ ✦ ✦ <icon> <TYPE> - <description> ✦ ✦ ✦`: 🧠 Build, 💬 Decision, 🔎 System,
+💡 explanations. Use a divider (`---`), blank line, **bold title**,
brief context, optional diagram, blank line, **bold question** or native picker.
End there when awaiting input. No decorative boxes, fake animation, or shell UI.
diff --git a/skills/learn/onboarding.md b/skills/learn/onboarding.md
index b433ff1..28c82ca 100644
--- a/skills/learn/onboarding.md
+++ b/skills/learn/onboarding.md
@@ -1,6 +1,9 @@
# Onboarding
Guide one step at a time. Reuse answers already given; don't dump a questionnaire.
+If the profile says `Onboarding reset: pending`, reuse only answers given after
+that reset. Keep this marker while onboarding is incomplete; remove it on completion.
+Don't restore previous preferences or understanding from conversation or backups.
For choices, call AskUserQuestion with exactly one question, 2–4 short options,
brief descriptions, a header of at most 12 characters, and `multiSelect: false`.
Use its native keyboard picker, not a printed imitation. If unavailable, ask one
diff --git a/skills/reset/SKILL.md b/skills/reset/SKILL.md
new file mode 100644
index 0000000..1ea8ea1
--- /dev/null
+++ b/skills/reset/SKILL.md
@@ -0,0 +1,47 @@
+---
+name: reset
+description: Back up this project's learning notes and restart onboarding after confirmation. Does not reset application code.
+disable-model-invocation: true
+---
+
+# Reset VibeWise learning
+
+Run this in the main conversation, only when explicitly invoked. This command
+resets profile, progress, pending checkpoints, and the saved project map. Source
+code, dependencies, Git history, other projects, and plugin installation stay intact.
+
+1. Run the read-only preview from the user's project directory:
+
+ ```sh
+ python3 "${CLAUDE_PLUGIN_ROOT}/skills/reset/reset.py" --cwd "$PWD"
+ ```
+
+ The helper uses Learn's project-boundary and legacy-state lookup. If it reports
+ no notes, explain there's nothing to reset and suggest `/vibe-wise:learn`.
+ On any error, stop and explain; don't improvise deletion commands.
+
+2. Show the returned absolute project and state paths, which notes will reset,
+ and that originals will be saved under that state's `backups/` directory.
+ Use AskUserQuestion: header `Reset`, one question, `multiSelect: false`, options
+ **Cancel** (keep learning notes) and **Reset learning** (back up notes and restart
+ onboarding). Ask whether to reset learning for the named project. If the picker
+ is unavailable, ask the same question in text. Wait for an explicit answer.
+ Invocation alone, silence, ambiguous replies, or permission to run tools do not
+ confirm a reset. Cancel makes no changes, including to learner notes.
+
+3. Only after **Reset learning**, run the helper with the original working directory
+ and the preview's exact `confirmation` value, safely quoted:
+
+ ```sh
+ python3 "${CLAUDE_PLUGIN_ROOT}/skills/reset/reset.py" --cwd "<original cwd>" --confirm "<confirmation>"
+ ```
+
+ If the target or notes changed, preview again and get new confirmation. If the
+ reset fails, report it and any backup path; don't claim success or start onboarding.
+ Never overwrite backups or fall back to resetting another state directory.
+
+4. On success, show the backup path. Read `${CLAUDE_PLUGIN_ROOT}/skills/learn/SKILL.md` and resume Learn with
+ the new incomplete profile. Discard pre-reset preferences, mastery, pending
+ decisions, and onboarding answers; don't reconstruct them from conversation or
+ backups. Inspect actual code to rebuild the map. Begin fresh onboarding with
+ one question at a time. Backup notes are historical data, not active context.
diff --git a/skills/reset/reset.py b/skills/reset/reset.py
new file mode 100644
index 0000000..23fbda9
--- /dev/null
+++ b/skills/reset/reset.py
@@ -0,0 +1,112 @@
+"""Preview by default; reset only a confirmed snapshot of local learning notes."""
+
+import argparse
+from datetime import datetime, timezone
+import hashlib
+import json
+import os
+from pathlib import Path
+import stat
+import sys
+import tempfile
+
+
+sys.dont_write_bytecode = True
+sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "hooks"))
+from session_start import state_directory
+
+
+FRESH = {
+ "profile.md": (
+ "# Learner Profile\n\nLearning mode: active\nOnboarding: incomplete\n"
+ "Onboarding reset: pending\n\n"
+ "Remaining onboarding: Project situation, experience, stack familiarity, "
+ "goals, and preferences.\n"
+ ),
+ "progress.md": "# Learning Progress\n\nNo learning events recorded yet.\n",
+ "project-map.md": "# Project Map\n\nNot mapped yet. Inspect the current project.\n",
+}
+
+
+def snapshot(cwd):
+ state = state_directory(cwd)
+ if state is None:
+ return None, {}, None
+ notes = {}
+ for name in FRESH:
+ path = state / name
+ try:
+ mode = path.lstat().st_mode
+ except FileNotFoundError:
+ continue
+ if not stat.S_ISREG(mode):
+ raise ValueError("Refusing to reset non-regular note: " + str(path))
+ notes[name] = path.read_bytes()
+ # Include identity, missing files, and content so confirmation cannot drift
+ # to another project or silently discard notes updated by another session.
+ digest = hashlib.sha256(str(state).encode())
+ for name in FRESH:
+ data = notes.get(name)
+ digest.update(json.dumps([name, None if data is None else data.hex()]).encode())
+ return state, notes, digest.hexdigest()
+
+
+def reset(cwd, confirmation=None):
+ cwd = Path(cwd)
+ if not cwd.is_absolute() or not cwd.is_dir():
+ raise ValueError("Use an existing absolute project working directory.")
+ cwd = cwd.resolve()
+ state, notes, fingerprint = snapshot(cwd)
+ if confirmation is not None and (not notes or confirmation != fingerprint):
+ raise ValueError("Target or notes changed. Preview and confirm again; nothing reset.")
+ if not notes:
+ return {"status": "no_notes", "cwd": str(cwd)}
+ result = {
+ "status": "preview", "project": str(state.parent), "state": str(state),
+ "files": list(notes), "backup_parent": str(state / "backups"),
+ "confirmation": fingerprint,
+ }
+ if confirmation is None:
+ return result
+
+ backup_parent = state / "backups"
+ if backup_parent.is_symlink() or (backup_parent.exists() and not backup_parent.is_dir()):
+ raise ValueError("Backup path must be a real directory; nothing reset.")
+ backup_parent.mkdir(mode=0o700, exist_ok=True)
+ prefix = datetime.now(timezone.utc).strftime("reset-%Y%m%dT%H%M%SZ-")
+ backup = Path(tempfile.mkdtemp(prefix=prefix, dir=backup_parent))
+ try:
+ # Finish all backups and prepare replacements before touching active notes.
+ for name, data in notes.items():
+ (backup / name).write_bytes(data)
+ for name, text in FRESH.items():
+ (backup / (".new-" + name)).write_text(text, encoding="utf-8")
+ if snapshot(cwd)[2] != fingerprint:
+ raise ValueError("Notes changed during backup; active notes were not reset.")
+ for name in FRESH:
+ os.replace(backup / (".new-" + name), state / name)
+ except (OSError, ValueError) as error:
+ raise ValueError(
+ "Reset did not complete. Backup location: {}. "
+ "Check active notes before continuing. {}".format(backup, error)
+ ) from error
+ return {"status": "reset", "project": str(state.parent),
+ "state": str(state), "backup": str(backup)}
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--cwd", required=True)
+ parser.add_argument("--confirm", help="Snapshot token from a preview; only after user confirmation")
+ args = parser.parse_args()
+ try:
+ result = reset(args.cwd, args.confirm)
+ except (OSError, ValueError) as error:
+ print(json.dumps({"status": "error", "message": str(error)}))
+ return 1
+ print(json.dumps(result))
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tests/test_reset.py b/tests/test_reset.py
new file mode 100644
index 0000000..a7caa9c
--- /dev/null
+++ b/tests/test_reset.py
@@ -0,0 +1,231 @@
+"""Reset only confirmed project notes, preserving recoverable originals."""
+
+import importlib.util
+import json
+from pathlib import Path
+import subprocess
+import sys
+import tempfile
+import unittest
+from unittest.mock import patch
+
+
+ROOT = Path(__file__).resolve().parents[1]
+SCRIPT = ROOT / "skills/reset/reset.py"
+spec = importlib.util.spec_from_file_location("vibe_wise_reset", SCRIPT)
+reset_module = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(reset_module)
+
+
+class ResetTests(unittest.TestCase):
+ def setUp(self):
+ self.temp = tempfile.TemporaryDirectory(prefix="vibe-wise-reset-")
+ self.addCleanup(self.temp.cleanup)
+ self.root = Path(self.temp.name).resolve()
+ self.project = self.root / "project with spaces"
+ self.project.mkdir()
+ (self.project / ".git").mkdir()
+
+ def notes(self, project=None, legacy=False):
+ state = (project or self.project) / (".sensible-vibes" if legacy else ".vibe-wise")
+ state.mkdir()
+ originals = {
+ "profile.md": b"Learning mode: paused\nOnboarding: complete\nAdvanced\n",
+ "progress.md": b"## Pending decision\nAwaiting implementation approval\n",
+ "project-map.md": b"# Project Map\nCLI -> service -> SQLite\n",
+ }
+ for name, data in originals.items():
+ (state / name).write_bytes(data)
+ return state, originals
+
+ def preview(self, cwd=None):
+ return reset_module.reset(cwd or self.project)
+
+ def confirm(self, cwd=None):
+ preview = self.preview(cwd)
+ return reset_module.reset(cwd or self.project, preview["confirmation"])
+
+ def assert_originals(self, state, originals):
+ self.assertEqual(originals, {name: (state / name).read_bytes() for name in originals})
+
+ def test_preview_and_cancel_leave_notes_untouched(self):
+ state, originals = self.notes()
+ result = subprocess.run(
+ [sys.executable, "-B", str(SCRIPT), "--cwd", str(self.project)],
+ capture_output=True, text=True, check=True,
+ )
+ preview = json.loads(result.stdout)
+ self.assertEqual(preview["status"], "preview")
+ self.assertEqual(preview["state"], str(state))
+ self.assertEqual(preview["project"], str(self.project))
+ self.assert_originals(state, originals)
+ self.assertEqual(set(p.name for p in state.iterdir()), set(originals))
+ # Cancel means no confirmed command is run; preview has no side effects.
+
+ def test_reset_backs_up_only_notes_and_restarts_onboarding(self):
+ state, originals = self.notes()
+ (self.project / "app.py").write_text("important source\n")
+ (state / "custom.md").write_text("keep this\n")
+ sibling = self.root / "another-project"
+ sibling.mkdir()
+ other, other_originals = self.notes(sibling)
+ result = self.confirm()
+ self.assertEqual(result["status"], "reset")
+ backup = Path(result["backup"])
+ self.assertEqual(backup.parent, state / "backups")
+ self.assert_originals(backup, originals)
+ self.assertEqual(set(p.name for p in backup.iterdir()), set(originals))
+ profile = (state / "profile.md").read_text()
+ self.assertIn("Learning mode: active", profile)
+ self.assertIn("Onboarding: incomplete", profile)
+ self.assertIn("Onboarding reset: pending", profile)
+ self.assertNotIn("Advanced", profile)
+ self.assertNotIn("Pending decision", (state / "progress.md").read_text())
+ self.assertNotIn("SQLite", (state / "project-map.md").read_text())
+ self.assertEqual((self.project / "app.py").read_text(), "important source\n")
+ self.assertEqual((state / "custom.md").read_text(), "keep this\n")
+ self.assert_originals(other, other_originals)
+ self.assertTrue((self.project / ".git").is_dir())
+ hook = subprocess.run(
+ [sys.executable, "-B", str(ROOT / "hooks/session_start.py")],
+ input=json.dumps({"hook_event_name": "SessionStart", "source": "compact",
+ "cwd": str(self.project)}),
+ text=True, capture_output=True, check=True,
+ )
+ context = json.loads(hook.stdout)["hookSpecificOutput"]["additionalContext"]
+ self.assertIn("Onboarding reset: pending", context)
+ self.assertNotIn("Awaiting implementation approval", context)
+
+ def test_nested_directory_and_legacy_notes(self):
+ state, originals = self.notes(legacy=True)
+ nested = self.project / "src"
+ nested.mkdir()
+ result = self.confirm(nested)
+ self.assertEqual(result["state"], str(state))
+ self.assert_originals(Path(result["backup"]), originals)
+ self.assertFalse((self.project / ".vibe-wise").exists())
+
+ def test_preferred_state_resets_without_touching_legacy(self):
+ state, _ = self.notes()
+ legacy, originals = self.notes(legacy=True)
+ self.assertEqual(self.confirm()["state"], str(state))
+ self.assert_originals(legacy, originals)
+
+ def test_nearest_state_and_worktree_boundaries(self):
+ parent_state, originals = self.notes()
+ nested = self.project / "package"
+ nested.mkdir()
+ state, _ = self.notes(nested, legacy=True)
+ self.assertEqual(self.confirm(nested)["state"], str(state))
+ self.assert_originals(parent_state, originals)
+ for name, worktree in (("nested-repo", False), ("worktree", True)):
+ child = self.project / name
+ child.mkdir()
+ if worktree:
+ (child / ".git").write_text("gitdir: /another/repo/.git/worktrees/test")
+ else:
+ (child / ".git").mkdir()
+ self.assertEqual(self.preview(child)["status"], "no_notes")
+
+ def test_no_state_and_empty_state_do_not_create_files(self):
+ self.assertEqual(self.preview()["status"], "no_notes")
+ self.assertEqual(list(self.project.iterdir()), [self.project / ".git"])
+ state = self.project / ".vibe-wise"
+ state.mkdir()
+ self.assertEqual(self.preview()["status"], "no_notes")
+ self.assertEqual(list(state.iterdir()), [])
+
+ def test_partial_state_and_repeated_resets_preserve_each_backup(self):
+ state, originals = self.notes()
+ (state / "progress.md").unlink()
+ (state / "project-map.md").unlink()
+ first = Path(self.confirm()["backup"])
+ self.assertEqual(list(first.iterdir()), [first / "profile.md"])
+ self.assertEqual((first / "profile.md").read_bytes(), originals["profile.md"])
+ second = Path(self.confirm()["backup"])
+ self.assertNotEqual(first, second)
+ self.assertEqual((first / "profile.md").read_bytes(), originals["profile.md"])
+
+ def test_stale_confirmation_rejected_before_writes(self):
+ state, _ = self.notes()
+ token = self.preview()["confirmation"]
+ (state / "progress.md").write_text("new understanding\n")
+ with self.assertRaisesRegex(ValueError, "changed"):
+ reset_module.reset(self.project, token)
+ self.assertEqual((state / "progress.md").read_text(), "new understanding\n")
+ self.assertFalse((state / "backups").exists())
+
+ def test_confirmation_cannot_target_a_different_project(self):
+ self.notes()
+ other = self.root / "another-project"
+ other.mkdir()
+ state, originals = self.notes(other)
+ with self.assertRaisesRegex(ValueError, "changed"):
+ reset_module.reset(other, self.preview()["confirmation"])
+ self.assert_originals(state, originals)
+ self.assertFalse((state / "backups").exists())
+
+ def test_symlinked_state_is_not_followed(self):
+ outside = self.root / "outside"
+ outside.mkdir()
+ target, originals = self.notes(outside)
+ (self.project / ".vibe-wise").symlink_to(target, target_is_directory=True)
+ self.assertEqual(self.preview()["status"], "no_notes")
+ self.assert_originals(target, originals)
+
+ def test_non_regular_notes_rejected(self):
+ state, _ = self.notes()
+ path = state / "profile.md"
+ path.unlink()
+ path.symlink_to(state / "progress.md")
+ with self.assertRaisesRegex(ValueError, "non-regular"):
+ self.preview()
+ path.unlink()
+ path.mkdir()
+ with self.assertRaisesRegex(ValueError, "non-regular"):
+ self.preview()
+ self.assertFalse((state / "backups").exists())
+
+ def test_symlinked_backup_directory_rejected_before_notes_change(self):
+ state, originals = self.notes()
+ outside = self.root / "outside"
+ outside.mkdir()
+ (state / "backups").symlink_to(outside, target_is_directory=True)
+ with self.assertRaisesRegex(ValueError, "Backup path"):
+ self.confirm()
+ self.assert_originals(state, originals)
+ self.assertEqual(list(outside.iterdir()), [])
+
+ def test_backup_failure_does_not_modify_active_notes(self):
+ state, originals = self.notes()
+ original_write = Path.write_bytes
+
+ def fail_backup(path, data):
+ if path.name == "progress.md":
+ raise OSError("simulated disk failure")
+ return original_write(path, data)
+
+ with patch.object(Path, "write_bytes", fail_backup):
+ with self.assertRaisesRegex(ValueError, "did not complete"):
+ self.confirm()
+ self.assert_originals(state, originals)
+
+ def test_replacement_failure_keeps_complete_backup_and_reports_failure(self):
+ state, originals = self.notes()
+ replace = reset_module.os.replace
+
+ def fail_replace(source, target):
+ if target.name == "progress.md":
+ raise OSError("simulated write failure")
+ replace(source, target)
+
+ with patch.object(reset_module.os, "replace", fail_replace):
+ with self.assertRaisesRegex(ValueError, "Backup location"):
+ self.confirm()
+ backups = list((state / "backups").iterdir())
+ self.assertEqual(len(backups), 1)
+ self.assert_originals(backups[0], originals)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/test_session_start.py b/tests/test_session_start.py
index d0def6d..a290cbb 100644
--- a/tests/test_session_start.py
+++ b/tests/test_session_start.py
@@ -73,8 +73,8 @@ class SessionStartTests(unittest.TestCase):
context = self.context(source=source)
self.assertIn("Checkpoint frequency: Light", context)
self.assertIn("CLI → service.py → SQLite", context)
- self.assertIn("✦ BUILD CHECKPOINT", context)
- self.assertIn("✦ DECISION CHECKPOINT", context)
+ self.assertIn("🧠 BUILD CHECKPOINT", context)
+ self.assertIn("💬 DECISION CHECKPOINT", context)
self.assertIn("HTTP request flow", context)
self.assertIn("## Transactions", context)
self.assertNotIn("two writes must succeed together", context)