cc-continuity 0.3.65__tar.gz → 0.3.67__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/PKG-INFO +1 -1
  2. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/README.md +7 -7
  3. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/__init__.py +1 -1
  4. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/cli.py +116 -0
  5. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/skills.py +36 -3
  6. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity.egg-info/PKG-INFO +1 -1
  7. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/pyproject.toml +1 -1
  8. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_cli.py +171 -0
  9. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_install.py +1 -1
  10. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_skills.py +27 -7
  11. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_uninstall.py +1 -1
  12. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/LICENSE +0 -0
  13. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/__main__.py +0 -0
  14. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/atomic.py +0 -0
  15. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/blink.py +0 -0
  16. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/blink_watch.py +0 -0
  17. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/bootstrap.py +0 -0
  18. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/checkpoint.py +0 -0
  19. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/config.py +0 -0
  20. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/daemon_supervisor.py +0 -0
  21. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/doctor.py +0 -0
  22. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/gitsnap.py +0 -0
  23. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/__init__.py +0 -0
  24. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/common.py +0 -0
  25. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/pre_compact.py +0 -0
  26. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/pre_tool_use.py +0 -0
  27. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/session_end.py +0 -0
  28. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/session_start.py +0 -0
  29. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/stop.py +0 -0
  30. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/task.py +0 -0
  31. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/tool_use.py +0 -0
  32. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hooks/user_prompt.py +0 -0
  33. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/hosting.py +0 -0
  34. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/install.py +0 -0
  35. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/launch.py +0 -0
  36. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/ledger.py +0 -0
  37. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/lock.py +0 -0
  38. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/managed.py +0 -0
  39. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/naming.py +0 -0
  40. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/notify.py +0 -0
  41. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/overflow.py +0 -0
  42. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/paths.py +0 -0
  43. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/power_plug.py +0 -0
  44. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/progress_pane.py +0 -0
  45. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/project.py +0 -0
  46. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/redact.py +0 -0
  47. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/rotator.py +0 -0
  48. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/settings_merge.py +0 -0
  49. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/state.py +0 -0
  50. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/statusline.py +0 -0
  51. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/thresholds.py +0 -0
  52. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/transcript.py +0 -0
  53. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/validate.py +0 -0
  54. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/watchdog.py +0 -0
  55. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/watchdog_digest.py +0 -0
  56. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity/watchdogd.py +0 -0
  57. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity.egg-info/SOURCES.txt +0 -0
  58. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity.egg-info/dependency_links.txt +0 -0
  59. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity.egg-info/entry_points.txt +0 -0
  60. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/cc_continuity.egg-info/top_level.txt +0 -0
  61. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/setup.cfg +0 -0
  62. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_atomic.py +0 -0
  63. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_blink.py +0 -0
  64. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_blink_watch.py +0 -0
  65. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_bootstrap.py +0 -0
  66. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_changelog_notes.py +0 -0
  67. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_checkpoint.py +0 -0
  68. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_cli_ledger.py +0 -0
  69. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_cli_log.py +0 -0
  70. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_config.py +0 -0
  71. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_daemon_supervisor.py +0 -0
  72. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_doctor.py +0 -0
  73. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_gitsnap.py +0 -0
  74. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_common.py +0 -0
  75. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_pre_compact.py +0 -0
  76. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_pre_tool_use.py +0 -0
  77. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_session_end.py +0 -0
  78. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_session_start.py +0 -0
  79. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_stop.py +0 -0
  80. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_task.py +0 -0
  81. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_tool_use.py +0 -0
  82. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hooks_user_prompt.py +0 -0
  83. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hosting.py +0 -0
  84. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_hygiene.py +0 -0
  85. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_integration_phase5.py +0 -0
  86. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_integration_phase6.py +0 -0
  87. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_integration_phase7.py +0 -0
  88. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_launch.py +0 -0
  89. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_ledger.py +0 -0
  90. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_lock.py +0 -0
  91. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_managed.py +0 -0
  92. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_naming.py +0 -0
  93. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_notify.py +0 -0
  94. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_notify_integration.py +0 -0
  95. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_overflow.py +0 -0
  96. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_paths.py +0 -0
  97. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_power_plug.py +0 -0
  98. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_progress_pane.py +0 -0
  99. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_project.py +0 -0
  100. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_readme_badges.py +0 -0
  101. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_readme_gif.py +0 -0
  102. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_redact.py +0 -0
  103. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_rotator.py +0 -0
  104. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_settings_merge.py +0 -0
  105. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_state.py +0 -0
  106. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_status.py +0 -0
  107. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_statusline.py +0 -0
  108. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_statusline_cache.py +0 -0
  109. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_thresholds.py +0 -0
  110. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_tmux_host.py +0 -0
  111. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_transcript.py +0 -0
  112. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_transcript_finalize.py +0 -0
  113. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_validate.py +0 -0
  114. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_watchdog.py +0 -0
  115. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_watchdog_digest.py +0 -0
  116. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_watchdog_integration.py +0 -0
  117. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_watchdogd.py +0 -0
  118. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_wsl_doctor.py +0 -0
  119. {cc_continuity-0.3.65 → cc_continuity-0.3.67}/tests/test_wsl_install.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cc-continuity
3
- Version: 0.3.65
3
+ Version: 0.3.67
4
4
  Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -41,11 +41,11 @@ The five most recent updates, newest first. Each line links to its
41
41
  commit, so you can see what changed lately without digging through the
42
42
  log:
43
43
 
44
+ - **2026-11-24**: Handoff search is now a first-class surface. `cc-continuity search <query>` takes the search phrase directly, without typing `history` first, and the new `/continuity-search <phrase>` skill makes the invocation argument itself the query (invoked bare it asks for the keyword once); both reuse the read-only keyword engine from v0.3.66 verbatim, the `--nnn` and `--since`/`--until` filters keep working and `cc-continuity history <query>` continues to work unchanged, with four tests written first ([commit](https://github.com/pqant/claude-continuity/commit/b05b31c)).
45
+ - **2026-11-24**: `cc-continuity history` now searches the checkpoint archive. `cc-continuity history <query>` finds every handoff whose text contains the keyword (case-insensitive substring) and prints session number, creation date, the first objective line and the matched line; `--nnn` and `--since`/`--until` filter the result, and the `/continuity-history` skill teaches the same usage; the search is read-only and deterministic, the checkpoint write path and the session index are untouched, and eight tests were written first ([commit](https://github.com/pqant/claude-continuity/commit/be179fe)).
44
46
  - **2026-11-24**: A rotation no longer splits the successor identity. The rotator predicted the next session name as strict `nnn+1` while the claim mints `max(counter, old_nnn) + 1`, so once stale records had advanced the counter the pane title and the old session's ledger froze a name the claim never minted (seen live: the ledger said connector-259 while the real successor session was connector-267); the prediction now mirrors the claim allocator, the completion paths reconcile the ledger entry and log line with the claimed record before writing them, and a claim whose own never-attached `BOOTSTRAPPING` successor already exists adopts it at the same index instead of minting a second name, with three tests written first to pin all three fixes ([commit](https://github.com/pqant/claude-continuity/commit/b60c518)).
45
47
  - **2026-11-24**: A deferred rotation no longer buries the fresh-prompt recovery evidence. Recovery re-attaches a verified-checkpoint session only when the newest user prompt in the ledger post-dates the checkpoint verification stamp, but a deferred rotation used to append an out-of-band rollback (ROTATING -> CHECKPOINT_VERIFIED) that re-stamped the verification after the user came back: the prompt looked stale, the watchdog kept reporting the session as skipped and the context-400 rotation never dispatched; a rollback entering from ROTATING no longer counts as a new verification, the ledger stays the single source of truth, and a test written first pins that a deferred re-stamp neither buries the fresh prompt nor gates recovery out ([commit](https://github.com/pqant/claude-continuity/commit/203578b)).
46
48
  - **2026-11-24**: Context-400 recovery now actually completes the rotation. The dispatch works since v0.3.62, but the spawned rotator kept deferring every time: the API 400 kills the turn without firing the Stop hook, so the turn flag was never cleared and the rotator's idle gate read the dead turn as live work, deferred and waited for a Stop that could never come; the recovery now records the finished turn itself (flag off, stop timestamp) right after logging the recovery, the rotator and its idle gate stay untouched, and two tests written first pin the field write and the unlocked idle gate ([commit](https://github.com/pqant/claude-continuity/commit/129422a)).
47
- - **2026-11-23**: Sessions stuck in `CHECKPOINT_VERIFIED` are now actually dispatched to context-400 recovery. The recovery gate accepted `CHECKPOINT_VERIFIED` since v0.3.61, but the watchdog still only reached that gate through screen classification: records outside `ACTIVE`/`WARNED` are skipped as not live, and recovery ran only for sessions classified as alive, turn-dead, stalled or frozen, so a stalled verified checkpoint was never scanned and stayed parked on the oversized prompt; the tick loop now also runs recovery for a skipped verified-checkpoint session while its turn is still in flight, the recovery gate itself (full-auto, one attempt, transcript-tail scan, fresh-prompt check) stays the single source of truth, and three tick-loop integration tests written first pin the dispatch ([commit](https://github.com/pqant/claude-continuity/commit/ff58ebc)).
48
- - **2026-11-23**: Sessions stuck in `CHECKPOINT_VERIFIED` now recover from context-400 too. A rotation that verifies its checkpoint and then fails partway leaves the session in `CHECKPOINT_VERIFIED` with the stale oversized prompt still in the pane: the recovery gate only accepted the pre-rotation states and `recover_400` refused to re-attach a session that already had a fresh prompt, so these sessions stayed stuck and 400ed every request. `CHECKPOINT_VERIFIED` now joins the recovery gate, `recover_400` re-attaches such sessions with the fresh prompt, and a scan that skips a session leaves the one-shot recovery gate unarmed so the recovery still fires when the user returns ([commit](https://github.com/pqant/claude-continuity/commit/f9a1e1a)).
49
49
  ## How it works
50
50
 
51
51
  The whole flow in one picture: the automatic session loop, the optional
@@ -67,8 +67,8 @@ rotations → a completed task, captured end to end. It is a long,
67
67
  video-style GIF, so it is offered as a download rather than embedded
68
68
  in the page:
69
69
 
70
- - [demo-high-res.gif](https://github.com/pqant/claude-continuity/releases/download/v0.1.1/demo-high-res.gif) — 896x1920, 20 fps (~20 MB)
71
- - [demo-low-res.gif](https://github.com/pqant/claude-continuity/releases/download/v0.1.1/demo-low-res.gif) — 700x1500, 12 fps (~12 MB)
70
+ - [demo-high-res.gif](https://github.com/pqant/claude-continuity/releases/download/v0.1.1/demo-high-res.gif) - 896x1920, 20 fps (~20 MB)
71
+ - [demo-low-res.gif](https://github.com/pqant/claude-continuity/releases/download/v0.1.1/demo-low-res.gif) - 700x1500, 12 fps (~12 MB)
72
72
 
73
73
  The demo itself is recorded by
74
74
  [`tools/demo_gif.sh`](tools/demo_gif.sh) (it needs a local-model
@@ -92,8 +92,8 @@ path end to end.
92
92
  ## Windows (via WSL)
93
93
 
94
94
  cc-continuity runs inside a Windows Subsystem for Linux distro: the
95
- Linux side is unchanged — same rotation, same watchdog, same ntfy
96
- pushes — and only the daemon hosting differs. Where macOS uses
95
+ Linux side is unchanged: same rotation, same watchdog, same ntfy
96
+ pushes, and only the daemon hosting differs. Where macOS uses
97
97
  launchd, the distro uses a detached tmux session (default) or systemd
98
98
  user units (WSL 2 with systemd enabled), plus one optional Windows
99
99
  logon task so the daemons come back when the WSL VM restarts.
@@ -101,7 +101,7 @@ logon task so the daemons come back when the WSL VM restarts.
101
101
  - **WSL 2 recommended; WSL 1 works too** (minus the systemd option).
102
102
  - **Ubuntu 24.04 recommended**; Ubuntu 22.04 works with `python3.11`
103
103
  from deadsnakes.
104
- - **Native Windows is out of scope** — the distro is the runtime.
104
+ - **Native Windows is out of scope**; the distro is the runtime.
105
105
 
106
106
  Full guide (requirements, install, watchdog, autostart,
107
107
  troubleshooting): [`docs/WINDOWS.md`](docs/WINDOWS.md). An end-to-end
@@ -4,4 +4,4 @@ Spec: docs/PRD.md (v1.0). Platform facts verified in docs/VERIFICATION.md.
4
4
  Standard library only at runtime; pytest is dev-only.
5
5
  """
6
6
 
7
- __version__ = "0.3.65"
7
+ __version__ = "0.3.67"
@@ -69,6 +69,25 @@ def build_parser() -> argparse.ArgumentParser:
69
69
  help="show at most N most recent sessions (default 20)")
70
70
  p_hist.add_argument("--json", action="store_true",
71
71
  help="print the session chain as one JSON array")
72
+ p_hist.add_argument("query", nargs="?",
73
+ help="search this literal substring in checkpoint handoffs")
74
+ p_hist.add_argument("--nnn", type=int, default=None,
75
+ help="with a query: only this session number")
76
+ p_hist.add_argument("--since", default=None,
77
+ help="with a query: sessions created on/after YYYY-MM-DD")
78
+ p_hist.add_argument("--until", default=None,
79
+ help="with a query: sessions created on/before YYYY-MM-DD")
80
+
81
+ p_search = sub.add_parser(
82
+ "search", help="search checkpoint handoffs for a keyword")
83
+ p_search.add_argument("query",
84
+ help="literal substring to search for (required)")
85
+ p_search.add_argument("--nnn", type=int, default=None,
86
+ help="only this session number")
87
+ p_search.add_argument("--since", default=None,
88
+ help="sessions created on/after YYYY-MM-DD")
89
+ p_search.add_argument("--until", default=None,
90
+ help="sessions created on/before YYYY-MM-DD")
72
91
 
73
92
  p_ratio = sub.add_parser("ratio",
74
93
  help="print the live context ratio of a project")
@@ -622,6 +641,8 @@ def cmd_history(args: argparse.Namespace) -> int:
622
641
  print(f"cc-continuity history: unreadable project record: {e}",
623
642
  file=sys.stderr)
624
643
  return 1
644
+ if getattr(args, "query", None):
645
+ return _history_search(args, key, record)
625
646
  if getattr(args, "json", False):
626
647
  rows = []
627
648
  for s in (record.get("sessions") or [])[-args.n:]:
@@ -648,6 +669,99 @@ def cmd_history(args: argparse.Namespace) -> int:
648
669
  return 0
649
670
 
650
671
 
672
+ def _clip(text: str, limit: int) -> str:
673
+ return text if len(text) <= limit else text[: limit - 3] + "..."
674
+
675
+
676
+ def _history_search(args: argparse.Namespace, key: str,
677
+ record: dict) -> int:
678
+ """Issue #84: read-only literal search over the checkpoint handoffs.
679
+
680
+ Scans sessions/<nnn>/checkpoint/handoff.md only; never touches the
681
+ checkpoint write path, the rotator or the session index. Unreadable
682
+ handoffs are skipped silently; the command is display-only.
683
+ """
684
+ try:
685
+ since = (datetime.strptime(args.since, "%Y-%m-%d").date()
686
+ if args.since else None)
687
+ until = (datetime.strptime(args.until, "%Y-%m-%d").date()
688
+ if args.until else None)
689
+ except ValueError:
690
+ print("cc-continuity history: --since/--until need YYYY-MM-DD",
691
+ file=sys.stderr)
692
+ return 2
693
+ needle = args.query.lower()
694
+ rows = []
695
+ for s in (record.get("sessions") or []):
696
+ if not isinstance(s, dict):
697
+ continue
698
+ nnn = s.get("nnn") if isinstance(s.get("nnn"), int) else 0
699
+ if args.nnn is not None and nnn != args.nnn:
700
+ continue
701
+ date_str = "-"
702
+ created = s.get("created")
703
+ if isinstance(created, str):
704
+ try:
705
+ created_d = datetime.fromisoformat(created).date()
706
+ date_str = created_d.isoformat()
707
+ if since and created_d < since:
708
+ continue
709
+ if until and created_d > until:
710
+ continue
711
+ except ValueError:
712
+ pass
713
+ hpath = paths.session_dir(key, nnn) / "checkpoint" / "handoff.md"
714
+ try:
715
+ lines = hpath.read_text(encoding="utf-8").splitlines()
716
+ except OSError:
717
+ continue
718
+ match = next((ln.strip() for ln in lines if needle in ln.lower()),
719
+ None)
720
+ if match is None:
721
+ continue
722
+ objective = "-"
723
+ after = False
724
+ for ln in lines:
725
+ if not after:
726
+ after = ln.strip().startswith("## Objective")
727
+ continue
728
+ if ln.strip():
729
+ objective = ln.strip()
730
+ break
731
+ rows.append((f"{nnn:03d}", date_str, objective, match))
732
+ if not rows:
733
+ print(f"history search: no matches for {args.query!r}")
734
+ return 0
735
+ print(f"{'NNN':<4} {'DATE':<10} {'OBJECTIVE':<40} MATCH")
736
+ for nnn_str, date_str, objective, match in rows:
737
+ print(f"{nnn_str:<4} {date_str:<10} {_clip(objective, 40):<40} "
738
+ f"{_clip(match, 100)}")
739
+ return 0
740
+
741
+
742
+ def cmd_search(args: argparse.Namespace) -> int:
743
+ """Issue #97: top-level keyword search - the query is the whole argument.
744
+
745
+ Thin wrapper over the #84 engine: same read-only, deterministic scan of
746
+ the checkpoint handoffs; no behavior fork, single source of truth.
747
+ """
748
+ cwd = Path.cwd()
749
+ root = project.resolve_root(cwd)
750
+ key = project.project_key_for_root(root)
751
+ pfile = paths.project_dir(key) / "project.json"
752
+ if not pfile.is_file():
753
+ print(f"No cc-continuity project for {root} "
754
+ f"(a project registers itself on its first hook).")
755
+ return 0
756
+ try:
757
+ record = json.loads(pfile.read_text(encoding="utf-8"))
758
+ except (OSError, json.JSONDecodeError) as e:
759
+ print(f"cc-continuity search: unreadable project record: {e}",
760
+ file=sys.stderr)
761
+ return 1
762
+ return _history_search(args, key, record)
763
+
764
+
651
765
  def _project_record(key: str) -> dict | None:
652
766
  pfile = paths.project_dir(key) / "project.json"
653
767
  try:
@@ -1825,6 +1939,8 @@ def main(argv: list[str] | None = None) -> int:
1825
1939
  return cmd_hook(args)
1826
1940
  if args.command == "history":
1827
1941
  return cmd_history(args)
1942
+ if args.command == "search":
1943
+ return cmd_search(args)
1828
1944
  if args.command == "ratio":
1829
1945
  return cmd_ratio(args)
1830
1946
  if args.command == "ledger":
@@ -1,11 +1,13 @@
1
1
  """The seven /continuity-* user skills (PRD §16, P7-D11).
2
2
 
3
- Six skills are a thin instruction: run one exact command and report its
3
+ Seven skills are a thin instruction: run one exact command and report its
4
4
  output verbatim. continuity-excellence is a behavior skill: it carries a
5
5
  custom ``body`` (no shell command) that pins the prompt-perfection loop.
6
+ continuity-search is a second behavior skill: the invocation argument IS
7
+ the search phrase, passed straight to ``cc-continuity search`` (issue #97).
6
8
  rotate/off/on/excellence carry ``disable-model-invocation: true``
7
9
  so the model can never toggle continuity on its own (PRD §16).
8
- Uninstall removes EXACTLY these seven directories; foreign skills
10
+ Uninstall removes EXACTLY these eight directories; foreign skills
9
11
  (e.g. graphify) are never touched.
10
12
  """
11
13
 
@@ -46,8 +48,20 @@ SKILLS: dict[str, dict] = {
46
48
  },
47
49
  "continuity-history": {
48
50
  "command": "cc-continuity history",
49
- "description": "Show the cc-continuity session chain (history) for the current project.",
51
+ "description": ("Show the cc-continuity session chain (history) for "
52
+ "the current project, or search checkpoint handoffs "
53
+ "for a keyword."),
50
54
  "disable_model_invocation": False,
55
+ "body": (
56
+ "Run the exact command below and report its output verbatim to "
57
+ "the user. Do not paraphrase or add commentary.\n\n```bash\n"
58
+ "cc-continuity history\n```\n\nTo search this project's "
59
+ "checkpoint handoffs (issue #84), run the same command with a "
60
+ "literal keyword (case-insensitive substring), optionally "
61
+ "filtered by session number or date range:\n\n```bash\n"
62
+ "cc-continuity history <query> [--nnn N] "
63
+ "[--since YYYY-MM-DD] [--until YYYY-MM-DD]\n```\n"
64
+ ),
51
65
  },
52
66
  "continuity-excellence": {
53
67
  "body": (
@@ -77,6 +91,25 @@ SKILLS: dict[str, dict] = {
77
91
  "polished and executed."),
78
92
  "disable_model_invocation": True,
79
93
  },
94
+ "continuity-search": {
95
+ "description": (
96
+ "Search the cc-continuity checkpoint handoffs of the current "
97
+ "project for a keyword. The invocation argument IS the search "
98
+ "phrase; pass it straight to the command (example: "
99
+ "/continuity-search rotation). Use when the user asks what "
100
+ "past sessions did."),
101
+ "disable_model_invocation": False,
102
+ "body": (
103
+ "The user's invocation argument is the search phrase itself; "
104
+ "treat it as the query verbatim and do not add words like "
105
+ "'history' around it. Run:\n\n```bash\n"
106
+ "cc-continuity search <query>\n```\n\nIf no argument came "
107
+ "with the invocation, ask once for the keyword and wait. "
108
+ "Report the printed table verbatim. The same command accepts "
109
+ "the optional filters --nnn N, --since YYYY-MM-DD and "
110
+ "--until YYYY-MM-DD.\n"
111
+ ),
112
+ },
80
113
  }
81
114
 
82
115
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cc-continuity
3
- Version: 0.3.65
3
+ Version: 0.3.67
4
4
  Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cc-continuity"
7
- version = "0.3.65"
7
+ version = "0.3.67"
8
8
  description = "Zero-touch session rotation for Claude Code (local large-context model)"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
@@ -1428,3 +1428,174 @@ def test_cmd_install_dry_run_nonzero_on_missing_prereqs(tmp_path, monkeypatch,
1428
1428
  rc = cli.cmd_install(_install_ns(dry_run=True))
1429
1429
  assert rc == 1
1430
1430
  assert "tmux" in capsys.readouterr().err
1431
+
1432
+
1433
+ # ------------------------------------------------ history search (issue #84)
1434
+
1435
+
1436
+ def _write_handoff(key, nnn, objective, body_lines):
1437
+ """Minimal handoff.md for the read-only #84 search (checkpoint dir)."""
1438
+ cdir = paths.session_dir(key, nnn) / "checkpoint"
1439
+ cdir.mkdir(parents=True, exist_ok=True)
1440
+ text = (f"# Handoff cp-{nnn:03d}\n\n"
1441
+ "## Objective\n\n"
1442
+ f"{objective}\n\n"
1443
+ "## Current Task and Exact Stopping Point\n\n"
1444
+ + "\n".join(body_lines) + "\n")
1445
+ (cdir / "handoff.md").write_text(text, encoding="utf-8")
1446
+
1447
+
1448
+ def _set_created(key, nnn, iso):
1449
+ pfile = paths.project_dir(key) / "project.json"
1450
+ pref = json.loads(pfile.read_text(encoding="utf-8"))
1451
+ for s in pref["sessions"]:
1452
+ if s["nnn"] == nnn:
1453
+ s["created"] = iso
1454
+ pfile.write_text(json.dumps(pref), encoding="utf-8")
1455
+
1456
+
1457
+ def test_history_search_finds_match_and_shows_table(cc_home, tmp_path,
1458
+ monkeypatch, capsys):
1459
+ repo = make_repo(tmp_path)
1460
+ key, nnn = register_session(repo)
1461
+ key2, nnn2 = register_session(
1462
+ repo, session_id="22222222-2222-2222-2222-222222222222")
1463
+ _write_handoff(key, 1, "Ship the rotation threshold fix.",
1464
+ ["thresholds raised to warn 0.65 yesterday"])
1465
+ _write_handoff(key2, 2, "Unrelated docs work.",
1466
+ ["nothing interesting here"])
1467
+ monkeypatch.chdir(repo)
1468
+ assert cli.main(["history", "0.65"]) == 0
1469
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1470
+ assert lines[0].startswith("NNN") and "MATCH" in lines[0]
1471
+ assert len(lines) == 2 # only session 1 matched
1472
+ row = lines[1]
1473
+ assert row.startswith("001")
1474
+ assert "Ship the rotation threshold fix." in row # objective column
1475
+ assert "warn 0.65" in row # matched-line snippet
1476
+
1477
+
1478
+ def test_history_search_is_case_insensitive(cc_home, tmp_path, monkeypatch,
1479
+ capsys):
1480
+ repo = make_repo(tmp_path)
1481
+ key, nnn = register_session(repo)
1482
+ _write_handoff(key, 1, "Ship the rotation threshold fix.",
1483
+ ["thresholds raised to warn 0.65 yesterday"])
1484
+ monkeypatch.chdir(repo)
1485
+ assert cli.main(["history", "WARN"]) == 0
1486
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1487
+ assert len(lines) == 2 and lines[1].startswith("001")
1488
+
1489
+
1490
+ def test_history_search_nnn_filter(cc_home, tmp_path, monkeypatch, capsys):
1491
+ repo = make_repo(tmp_path)
1492
+ key, nnn = register_session(repo)
1493
+ key2, nnn2 = register_session(
1494
+ repo, session_id="22222222-2222-2222-2222-222222222222")
1495
+ _write_handoff(key, 1, "Ship the rotation threshold fix.", ["x"])
1496
+ _write_handoff(key2, 2, "Rotation cleanup.", ["y"])
1497
+ monkeypatch.chdir(repo)
1498
+ assert cli.main(["history", "rotation", "--nnn", "2"]) == 0
1499
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1500
+ assert len(lines) == 2
1501
+ assert lines[1].startswith("002")
1502
+ assert "Rotation cleanup." in lines[1]
1503
+
1504
+
1505
+ def test_history_search_date_range(cc_home, tmp_path, monkeypatch, capsys):
1506
+ repo = make_repo(tmp_path)
1507
+ key, nnn = register_session(repo)
1508
+ key2, nnn2 = register_session(
1509
+ repo, session_id="22222222-2222-2222-2222-222222222222")
1510
+ _write_handoff(key, 1, "Old work.", ["threshold note one"])
1511
+ _write_handoff(key2, 2, "New work.", ["threshold note two"])
1512
+ _set_created(key, 1, "2026-11-01T10:00:00+00:00")
1513
+ _set_created(key, 2, "2026-11-20T10:00:00+00:00")
1514
+ monkeypatch.chdir(repo)
1515
+ assert cli.main(["history", "threshold", "--since", "2026-11-10"]) == 0
1516
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1517
+ assert len(lines) == 2 and lines[1].startswith("002")
1518
+ capsys.readouterr()
1519
+ assert cli.main(["history", "threshold",
1520
+ "--until", "2026-11-10"]) == 0
1521
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1522
+ assert len(lines) == 2 and lines[1].startswith("001")
1523
+
1524
+
1525
+ def test_history_search_no_match_message(cc_home, tmp_path, monkeypatch,
1526
+ capsys):
1527
+ repo = make_repo(tmp_path)
1528
+ key, nnn = register_session(repo)
1529
+ _write_handoff(key, 1, "Ship the rotation threshold fix.", ["x"])
1530
+ monkeypatch.chdir(repo)
1531
+ assert cli.main(["history", "zebra-not-there"]) == 0
1532
+ assert "no matches" in capsys.readouterr().out
1533
+
1534
+
1535
+ def test_history_search_unreadable_handoff_skipped(cc_home, tmp_path,
1536
+ monkeypatch, capsys):
1537
+ repo = make_repo(tmp_path)
1538
+ key, nnn = register_session(repo)
1539
+ key2, nnn2 = register_session(
1540
+ repo, session_id="22222222-2222-2222-2222-222222222222")
1541
+ _write_handoff(key, 1, "Ship the rotation threshold fix.", ["x"])
1542
+ # session 2: handoff.md is a directory -> unreadable, must be skipped
1543
+ (paths.session_dir(key2, nnn2) / "checkpoint").mkdir(parents=True,
1544
+ exist_ok=True)
1545
+ (paths.session_dir(key2, nnn2) / "checkpoint" / "handoff.md").mkdir()
1546
+ monkeypatch.chdir(repo)
1547
+ assert cli.main(["history", "threshold"]) == 0
1548
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1549
+ assert len(lines) == 2 and lines[1].startswith("001")
1550
+
1551
+
1552
+ def test_history_search_without_project(cc_home, tmp_path, monkeypatch,
1553
+ capsys):
1554
+ repo = make_repo(tmp_path)
1555
+ monkeypatch.chdir(repo)
1556
+ assert cli.main(["history", "anything"]) == 0
1557
+ assert "No cc-continuity project" in capsys.readouterr().out
1558
+
1559
+
1560
+ # ------------------------------------------------ top-level search (issue #97)
1561
+
1562
+
1563
+ def test_search_command_shows_history_table(cc_home, tmp_path, monkeypatch,
1564
+ capsys):
1565
+ repo = make_repo(tmp_path)
1566
+ key, nnn = register_session(repo)
1567
+ key2, nnn2 = register_session(
1568
+ repo, session_id="22222222-2222-2222-2222-222222222222")
1569
+ _write_handoff(key, 1, "Ship the rotation threshold fix.",
1570
+ ["thresholds raised to warn 0.65 yesterday"])
1571
+ _write_handoff(key2, 2, "Unrelated docs work.", ["nothing here"])
1572
+ monkeypatch.chdir(repo)
1573
+ assert cli.main(["search", "0.65"]) == 0
1574
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1575
+ assert lines[0].startswith("NNN") and "MATCH" in lines[0]
1576
+ assert len(lines) == 2 and lines[1].startswith("001")
1577
+ assert "Ship the rotation threshold fix." in lines[1]
1578
+
1579
+
1580
+ def test_search_command_honors_filters(cc_home, tmp_path, monkeypatch,
1581
+ capsys):
1582
+ repo = make_repo(tmp_path)
1583
+ key, nnn = register_session(repo)
1584
+ key2, nnn2 = register_session(
1585
+ repo, session_id="22222222-2222-2222-2222-222222222222")
1586
+ _write_handoff(key, 1, "Rotation cleanup.", ["a"])
1587
+ _write_handoff(key2, 2, "Rotation polish.", ["b"])
1588
+ monkeypatch.chdir(repo)
1589
+ assert cli.main(["search", "rotation", "--nnn", "2"]) == 0
1590
+ lines = [l for l in capsys.readouterr().out.splitlines() if l.strip()]
1591
+ assert len(lines) == 2 and lines[1].startswith("002")
1592
+ capsys.readouterr()
1593
+ assert cli.main(["search", "bad-date", "--since", "11/2026"]) == 2
1594
+
1595
+
1596
+ def test_search_command_without_project(cc_home, tmp_path, monkeypatch,
1597
+ capsys):
1598
+ repo = make_repo(tmp_path)
1599
+ monkeypatch.chdir(repo)
1600
+ assert cli.main(["search", "anything"]) == 0
1601
+ assert "No cc-continuity project" in capsys.readouterr().out
@@ -49,7 +49,7 @@ def test_install_fresh_home_creates_all(fake_home):
49
49
  assert (h / ".claude" / "CLAUDE.md").is_file()
50
50
  ztext = (h / ".zshrc").read_text(encoding="utf-8")
51
51
  assert "cc-continuity launch --" in ztext
52
- assert len(list((h / ".claude" / "skills").iterdir())) == 7
52
+ assert len(list((h / ".claude" / "skills").iterdir())) == 8
53
53
  link = h / ".local" / "bin" / "cc-continuity"
54
54
  assert link.is_symlink()
55
55
  launcher = Path(manifest["launcher"])
@@ -1,13 +1,13 @@
1
- """skills.py: the seven /continuity-* user skills (PRD section 16)."""
1
+ """skills.py: the eight /continuity-* user skills (PRD section 16)."""
2
2
 
3
3
  from cc_continuity import skills
4
4
 
5
5
 
6
- def test_skill_names_seven():
6
+ def test_skill_names_eight():
7
7
  assert skills.skill_names() == (
8
8
  "continuity-status", "continuity-checkpoint", "continuity-rotate",
9
9
  "continuity-off", "continuity-on", "continuity-history",
10
- "continuity-excellence")
10
+ "continuity-excellence", "continuity-search")
11
11
 
12
12
 
13
13
  def test_skill_text_frontmatter_and_command():
@@ -60,9 +60,9 @@ def test_excellence_pins_the_perfection_loop():
60
60
  assert "```bash" not in text
61
61
 
62
62
 
63
- def test_install_creates_seven_files(tmp_path):
63
+ def test_install_creates_eight_files(tmp_path):
64
64
  paths = skills.install_skills(tmp_path / "skills")
65
- assert len(paths) == 7
65
+ assert len(paths) == 8
66
66
  for name in skills.skill_names():
67
67
  f = tmp_path / "skills" / name / "SKILL.md"
68
68
  assert f.is_file()
@@ -75,13 +75,13 @@ def test_install_idempotent(tmp_path):
75
75
  assert once == twice
76
76
 
77
77
 
78
- def test_uninstall_removes_exactly_seven(tmp_path):
78
+ def test_uninstall_removes_exactly_eight(tmp_path):
79
79
  d = tmp_path / "skills"
80
80
  skills.install_skills(d)
81
81
  (d / "graphify").mkdir() # foreign skill must survive
82
82
  (d / "graphify" / "SKILL.md").write_text("x")
83
83
  removed = skills.uninstall_skills(d)
84
- assert len(removed) == 7
84
+ assert len(removed) == 8
85
85
  assert (d / "graphify" / "SKILL.md").is_file()
86
86
  assert not (d / "continuity-status").exists()
87
87
 
@@ -95,3 +95,23 @@ def test_all_descriptions_carry_the_continuity_keyword():
95
95
  # skill must carry "cc-continuity" so it stays discoverable (issue 82)
96
96
  for name in skills.skill_names():
97
97
  assert "cc-continuity" in skills.SKILLS[name]["description"]
98
+
99
+
100
+ def test_history_skill_pins_search_usage():
101
+ # issue #84: the skill text must teach the keyword search so the /cc
102
+ # filter and the invoking agent both see it.
103
+ text = skills.skill_text("continuity-history")
104
+ assert "cc-continuity history <query>" in text
105
+ assert "search" in text.lower()
106
+ # the plain-chain command fence (test_command_mapping) still holds
107
+ assert "```bash\ncc-continuity history\n```" in text
108
+
109
+
110
+ def test_search_skill_pins_raw_argument_usage():
111
+ # issue #97: /continuity-search takes the search phrase directly as its
112
+ # argument (no extra word like "history"); the raw prompt IS the query.
113
+ text = skills.skill_text("continuity-search")
114
+ assert "cc-continuity search <query>" in text
115
+ assert "argument" in text.lower()
116
+ # the model may run it when the user asks for a search
117
+ assert "disable-model-invocation" not in text
@@ -80,7 +80,7 @@ def test_byte_for_byte_roundtrip_on_seeded_home(seeded_home):
80
80
  assert (h / ".zshrc").is_symlink()
81
81
  assert not (h / ".local" / "bin" / "cc-continuity").exists()
82
82
  assert not (h / ".claude-continuity" / "app").exists()
83
- # skills: the seven gone, foreign ones survive
83
+ # skills: the eight gone, foreign ones survive
84
84
  names = {p.name for p in (h / ".claude" / "skills").iterdir()}
85
85
  assert names == {"graphify"}
86
86
 
File without changes
File without changes