cortexshift 0.1.0__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 (234) hide show
  1. cortexshift-0.1.0/.gitignore +71 -0
  2. cortexshift-0.1.0/AGENTS.md +101 -0
  3. cortexshift-0.1.0/CHANGELOG.md +55 -0
  4. cortexshift-0.1.0/CONTRIBUTING.md +159 -0
  5. cortexshift-0.1.0/LICENSE +21 -0
  6. cortexshift-0.1.0/PKG-INFO +202 -0
  7. cortexshift-0.1.0/README.md +165 -0
  8. cortexshift-0.1.0/SECURITY.md +49 -0
  9. cortexshift-0.1.0/docs/architecture.md +679 -0
  10. cortexshift-0.1.0/docs/decisions/ADR-0001-core-architecture.md +75 -0
  11. cortexshift-0.1.0/docs/decisions/ADR-0002-safe-provider-discovery.md +90 -0
  12. cortexshift-0.1.0/docs/decisions/ADR-0003-project-local-persistence.md +88 -0
  13. cortexshift-0.1.0/docs/decisions/ADR-0004-git-repository-context.md +98 -0
  14. cortexshift-0.1.0/docs/decisions/ADR-0005-native-provider-runtime.md +103 -0
  15. cortexshift-0.1.0/docs/decisions/ADR-0006-canonical-agent-handoff.md +237 -0
  16. cortexshift-0.1.0/docs/decisions/ADR-0007-native-session-continuity.md +37 -0
  17. cortexshift-0.1.0/docs/decisions/ADR-0008-checkpoint-and-recovery.md +30 -0
  18. cortexshift-0.1.0/docs/decisions/ADR-0009-mcp-shared-state.md +63 -0
  19. cortexshift-0.1.0/docs/decisions/ADR-0010-terminal-control-center.md +143 -0
  20. cortexshift-0.1.0/docs/decisions/ADR-0011-release-and-distribution.md +43 -0
  21. cortexshift-0.1.0/docs/decisions/README.md +13 -0
  22. cortexshift-0.1.0/docs/getting-started.md +107 -0
  23. cortexshift-0.1.0/docs/handoff-protocol.md +444 -0
  24. cortexshift-0.1.0/docs/provider-support.md +72 -0
  25. cortexshift-0.1.0/docs/releases/v0.1.0.md +37 -0
  26. cortexshift-0.1.0/docs/releasing.md +165 -0
  27. cortexshift-0.1.0/docs/roadmap.md +246 -0
  28. cortexshift-0.1.0/docs/troubleshooting.md +24 -0
  29. cortexshift-0.1.0/packaging/homebrew/README.md +30 -0
  30. cortexshift-0.1.0/pyproject.toml +143 -0
  31. cortexshift-0.1.0/scripts/__init__.py +0 -0
  32. cortexshift-0.1.0/scripts/artifact_smoke.py +98 -0
  33. cortexshift-0.1.0/scripts/export_source.py +34 -0
  34. cortexshift-0.1.0/scripts/installed_smoke.py +296 -0
  35. cortexshift-0.1.0/scripts/provider_preflight.py +47 -0
  36. cortexshift-0.1.0/scripts/release_check.py +157 -0
  37. cortexshift-0.1.0/scripts/security_audit.py +64 -0
  38. cortexshift-0.1.0/src/cortexshift/__init__.py +10 -0
  39. cortexshift-0.1.0/src/cortexshift/__main__.py +6 -0
  40. cortexshift-0.1.0/src/cortexshift/adapters/__init__.py +22 -0
  41. cortexshift-0.1.0/src/cortexshift/adapters/command_runner.py +116 -0
  42. cortexshift-0.1.0/src/cortexshift/adapters/discovery.py +55 -0
  43. cortexshift-0.1.0/src/cortexshift/adapters/git/__init__.py +10 -0
  44. cortexshift-0.1.0/src/cortexshift/adapters/git/inspector.py +321 -0
  45. cortexshift-0.1.0/src/cortexshift/adapters/git/parser.py +140 -0
  46. cortexshift-0.1.0/src/cortexshift/adapters/headless_runner.py +92 -0
  47. cortexshift-0.1.0/src/cortexshift/adapters/process_runner.py +56 -0
  48. cortexshift-0.1.0/src/cortexshift/adapters/providers/__init__.py +4 -0
  49. cortexshift-0.1.0/src/cortexshift/adapters/providers/antigravity.py +530 -0
  50. cortexshift-0.1.0/src/cortexshift/adapters/providers/claude.py +375 -0
  51. cortexshift-0.1.0/src/cortexshift/adapters/providers/codex.py +434 -0
  52. cortexshift-0.1.0/src/cortexshift/adapters/sqlite/__init__.py +10 -0
  53. cortexshift-0.1.0/src/cortexshift/adapters/sqlite/migrations.py +268 -0
  54. cortexshift-0.1.0/src/cortexshift/adapters/sqlite/store.py +914 -0
  55. cortexshift-0.1.0/src/cortexshift/adapters/workspace_lease.py +123 -0
  56. cortexshift-0.1.0/src/cortexshift/application/__init__.py +42 -0
  57. cortexshift-0.1.0/src/cortexshift/application/checkpoint_builder.py +218 -0
  58. cortexshift-0.1.0/src/cortexshift/application/checkpoint_service.py +273 -0
  59. cortexshift-0.1.0/src/cortexshift/application/doctor.py +80 -0
  60. cortexshift-0.1.0/src/cortexshift/application/handoff_builder.py +281 -0
  61. cortexshift-0.1.0/src/cortexshift/application/handoff_renderer.py +430 -0
  62. cortexshift-0.1.0/src/cortexshift/application/handoff_service.py +66 -0
  63. cortexshift-0.1.0/src/cortexshift/application/init_service.py +86 -0
  64. cortexshift-0.1.0/src/cortexshift/application/locator.py +48 -0
  65. cortexshift-0.1.0/src/cortexshift/application/native_session.py +65 -0
  66. cortexshift-0.1.0/src/cortexshift/application/recovery_service.py +235 -0
  67. cortexshift-0.1.0/src/cortexshift/application/repository_service.py +146 -0
  68. cortexshift-0.1.0/src/cortexshift/application/resume_service.py +124 -0
  69. cortexshift-0.1.0/src/cortexshift/application/run_service.py +270 -0
  70. cortexshift-0.1.0/src/cortexshift/application/session_launcher.py +183 -0
  71. cortexshift-0.1.0/src/cortexshift/application/session_service.py +63 -0
  72. cortexshift-0.1.0/src/cortexshift/application/source_session.py +62 -0
  73. cortexshift-0.1.0/src/cortexshift/application/status_service.py +73 -0
  74. cortexshift-0.1.0/src/cortexshift/application/switch_service.py +671 -0
  75. cortexshift-0.1.0/src/cortexshift/application/task_service.py +201 -0
  76. cortexshift-0.1.0/src/cortexshift/application/task_workspace.py +152 -0
  77. cortexshift-0.1.0/src/cortexshift/cli/__init__.py +5 -0
  78. cortexshift-0.1.0/src/cortexshift/cli/app.py +2477 -0
  79. cortexshift-0.1.0/src/cortexshift/domain/__init__.py +153 -0
  80. cortexshift-0.1.0/src/cortexshift/domain/checkpoint.py +174 -0
  81. cortexshift-0.1.0/src/cortexshift/domain/doctor.py +68 -0
  82. cortexshift-0.1.0/src/cortexshift/domain/errors.py +277 -0
  83. cortexshift-0.1.0/src/cortexshift/domain/git.py +102 -0
  84. cortexshift-0.1.0/src/cortexshift/domain/handoff.py +241 -0
  85. cortexshift-0.1.0/src/cortexshift/domain/identifiers.py +27 -0
  86. cortexshift-0.1.0/src/cortexshift/domain/launch.py +58 -0
  87. cortexshift-0.1.0/src/cortexshift/domain/mcp_binding.py +81 -0
  88. cortexshift-0.1.0/src/cortexshift/domain/native_session.py +19 -0
  89. cortexshift-0.1.0/src/cortexshift/domain/project.py +37 -0
  90. cortexshift-0.1.0/src/cortexshift/domain/provider.py +67 -0
  91. cortexshift-0.1.0/src/cortexshift/domain/session.py +92 -0
  92. cortexshift-0.1.0/src/cortexshift/domain/status.py +40 -0
  93. cortexshift-0.1.0/src/cortexshift/domain/task.py +191 -0
  94. cortexshift-0.1.0/src/cortexshift/mcp/__init__.py +38 -0
  95. cortexshift-0.1.0/src/cortexshift/mcp/context.py +165 -0
  96. cortexshift-0.1.0/src/cortexshift/mcp/facade.py +513 -0
  97. cortexshift-0.1.0/src/cortexshift/mcp/models.py +178 -0
  98. cortexshift-0.1.0/src/cortexshift/mcp/resources.py +45 -0
  99. cortexshift-0.1.0/src/cortexshift/mcp/server.py +52 -0
  100. cortexshift-0.1.0/src/cortexshift/mcp/tools.py +176 -0
  101. cortexshift-0.1.0/src/cortexshift/ports/__init__.py +39 -0
  102. cortexshift-0.1.0/src/cortexshift/ports/checkpoint_store.py +45 -0
  103. cortexshift-0.1.0/src/cortexshift/ports/command_runner.py +56 -0
  104. cortexshift-0.1.0/src/cortexshift/ports/discovery.py +41 -0
  105. cortexshift-0.1.0/src/cortexshift/ports/handoff_delivery.py +91 -0
  106. cortexshift-0.1.0/src/cortexshift/ports/handoff_store.py +43 -0
  107. cortexshift-0.1.0/src/cortexshift/ports/headless_runner.py +58 -0
  108. cortexshift-0.1.0/src/cortexshift/ports/native_session.py +20 -0
  109. cortexshift-0.1.0/src/cortexshift/ports/process_runner.py +31 -0
  110. cortexshift-0.1.0/src/cortexshift/ports/provider.py +152 -0
  111. cortexshift-0.1.0/src/cortexshift/ports/repository.py +44 -0
  112. cortexshift-0.1.0/src/cortexshift/ports/session_store.py +27 -0
  113. cortexshift-0.1.0/src/cortexshift/ports/state_store.py +55 -0
  114. cortexshift-0.1.0/src/cortexshift/ports/workspace_lease.py +39 -0
  115. cortexshift-0.1.0/src/cortexshift/tui/__init__.py +24 -0
  116. cortexshift-0.1.0/src/cortexshift/tui/actions.py +58 -0
  117. cortexshift-0.1.0/src/cortexshift/tui/app.py +1051 -0
  118. cortexshift-0.1.0/src/cortexshift/tui/coordinator.py +173 -0
  119. cortexshift-0.1.0/src/cortexshift/tui/cortexshift.tcss +258 -0
  120. cortexshift-0.1.0/src/cortexshift/tui/facade.py +614 -0
  121. cortexshift-0.1.0/src/cortexshift/tui/modals.py +594 -0
  122. cortexshift-0.1.0/src/cortexshift/tui/models.py +503 -0
  123. cortexshift-0.1.0/src/cortexshift/tui/screens/__init__.py +81 -0
  124. cortexshift-0.1.0/src/cortexshift/tui/screens/checkpoints.py +188 -0
  125. cortexshift-0.1.0/src/cortexshift/tui/screens/handoffs.py +180 -0
  126. cortexshift-0.1.0/src/cortexshift/tui/screens/help.py +117 -0
  127. cortexshift-0.1.0/src/cortexshift/tui/screens/overview.py +200 -0
  128. cortexshift-0.1.0/src/cortexshift/tui/screens/providers.py +169 -0
  129. cortexshift-0.1.0/src/cortexshift/tui/screens/repository.py +143 -0
  130. cortexshift-0.1.0/src/cortexshift/tui/screens/sessions.py +146 -0
  131. cortexshift-0.1.0/src/cortexshift/tui/screens/task.py +174 -0
  132. cortexshift-0.1.0/src/cortexshift/tui/widgets.py +209 -0
  133. cortexshift-0.1.0/tests/__init__.py +1 -0
  134. cortexshift-0.1.0/tests/cli_runner.py +216 -0
  135. cortexshift-0.1.0/tests/conftest.py +25 -0
  136. cortexshift-0.1.0/tests/factories.py +243 -0
  137. cortexshift-0.1.0/tests/integration/__init__.py +1 -0
  138. cortexshift-0.1.0/tests/integration/test_cli_smoke.py +126 -0
  139. cortexshift-0.1.0/tests/integration/test_cooperative_checkpoint.py +83 -0
  140. cortexshift-0.1.0/tests/integration/test_crash_recovery_flagship.py +141 -0
  141. cortexshift-0.1.0/tests/integration/test_decision_durability.py +282 -0
  142. cortexshift-0.1.0/tests/integration/test_git_inspector.py +229 -0
  143. cortexshift-0.1.0/tests/integration/test_handoff_flagship.py +711 -0
  144. cortexshift-0.1.0/tests/integration/test_managed_mcp_grandchild.py +357 -0
  145. cortexshift-0.1.0/tests/integration/test_mcp_isolation.py +149 -0
  146. cortexshift-0.1.0/tests/integration/test_mcp_lease_coexistence.py +107 -0
  147. cortexshift-0.1.0/tests/integration/test_mcp_stdio.py +192 -0
  148. cortexshift-0.1.0/tests/integration/test_native_continuity_flagship.py +250 -0
  149. cortexshift-0.1.0/tests/integration/test_persistence_lifecycle.py +344 -0
  150. cortexshift-0.1.0/tests/integration/test_phase7_flagship.py +243 -0
  151. cortexshift-0.1.0/tests/integration/test_phase8_flagship.py +278 -0
  152. cortexshift-0.1.0/tests/integration/test_phase9_flagship.py +312 -0
  153. cortexshift-0.1.0/tests/integration/test_run_lifecycle.py +372 -0
  154. cortexshift-0.1.0/tests/integration/test_session_end_checkpoint.py +161 -0
  155. cortexshift-0.1.0/tests/integration/test_snapshot_persistence.py +148 -0
  156. cortexshift-0.1.0/tests/integration/test_tui_live_state.py +155 -0
  157. cortexshift-0.1.0/tests/integration/test_tui_terminal_handoff.py +197 -0
  158. cortexshift-0.1.0/tests/release/__init__.py +0 -0
  159. cortexshift-0.1.0/tests/release/test_release_checks.py +80 -0
  160. cortexshift-0.1.0/tests/release/test_smoke_path_identity.py +123 -0
  161. cortexshift-0.1.0/tests/tui/__init__.py +1 -0
  162. cortexshift-0.1.0/tests/tui/conftest.py +557 -0
  163. cortexshift-0.1.0/tests/tui/test_coordinator.py +243 -0
  164. cortexshift-0.1.0/tests/tui/test_exit_actions.py +235 -0
  165. cortexshift-0.1.0/tests/tui/test_facade.py +290 -0
  166. cortexshift-0.1.0/tests/tui/test_hermetic_environment.py +402 -0
  167. cortexshift-0.1.0/tests/tui/test_modals.py +276 -0
  168. cortexshift-0.1.0/tests/tui/test_navigation.py +134 -0
  169. cortexshift-0.1.0/tests/tui/test_refresh.py +357 -0
  170. cortexshift-0.1.0/tests/tui/test_safety.py +381 -0
  171. cortexshift-0.1.0/tests/tui/test_screens.py +245 -0
  172. cortexshift-0.1.0/tests/tui/test_widgets.py +57 -0
  173. cortexshift-0.1.0/tests/unit/__init__.py +1 -0
  174. cortexshift-0.1.0/tests/unit/test_antigravity_setup.py +183 -0
  175. cortexshift-0.1.0/tests/unit/test_checkpoint_domain.py +214 -0
  176. cortexshift-0.1.0/tests/unit/test_checkpoint_immutability.py +83 -0
  177. cortexshift-0.1.0/tests/unit/test_checkpoint_service.py +156 -0
  178. cortexshift-0.1.0/tests/unit/test_checkpoint_store.py +229 -0
  179. cortexshift-0.1.0/tests/unit/test_cli.py +46 -0
  180. cortexshift-0.1.0/tests/unit/test_cli_checkpoint.py +114 -0
  181. cortexshift-0.1.0/tests/unit/test_cli_doctor.py +211 -0
  182. cortexshift-0.1.0/tests/unit/test_cli_handoff.py +304 -0
  183. cortexshift-0.1.0/tests/unit/test_cli_help_rendering.py +297 -0
  184. cortexshift-0.1.0/tests/unit/test_cli_init.py +61 -0
  185. cortexshift-0.1.0/tests/unit/test_cli_recover.py +108 -0
  186. cortexshift-0.1.0/tests/unit/test_cli_repo.py +223 -0
  187. cortexshift-0.1.0/tests/unit/test_cli_run.py +364 -0
  188. cortexshift-0.1.0/tests/unit/test_cli_runner_contract.py +162 -0
  189. cortexshift-0.1.0/tests/unit/test_cli_session.py +255 -0
  190. cortexshift-0.1.0/tests/unit/test_cli_status.py +91 -0
  191. cortexshift-0.1.0/tests/unit/test_cli_switch.py +307 -0
  192. cortexshift-0.1.0/tests/unit/test_cli_task.py +319 -0
  193. cortexshift-0.1.0/tests/unit/test_cli_tui.py +86 -0
  194. cortexshift-0.1.0/tests/unit/test_command_runner.py +153 -0
  195. cortexshift-0.1.0/tests/unit/test_doctor_service.py +126 -0
  196. cortexshift-0.1.0/tests/unit/test_domain_models.py +548 -0
  197. cortexshift-0.1.0/tests/unit/test_domain_session.py +124 -0
  198. cortexshift-0.1.0/tests/unit/test_git_parser.py +110 -0
  199. cortexshift-0.1.0/tests/unit/test_handoff_builder.py +236 -0
  200. cortexshift-0.1.0/tests/unit/test_handoff_decision_aggregation.py +298 -0
  201. cortexshift-0.1.0/tests/unit/test_handoff_enrichment.py +113 -0
  202. cortexshift-0.1.0/tests/unit/test_handoff_renderer.py +271 -0
  203. cortexshift-0.1.0/tests/unit/test_handoff_store.py +172 -0
  204. cortexshift-0.1.0/tests/unit/test_headless_runner.py +103 -0
  205. cortexshift-0.1.0/tests/unit/test_init_service.py +80 -0
  206. cortexshift-0.1.0/tests/unit/test_managed_mcp_binding.py +450 -0
  207. cortexshift-0.1.0/tests/unit/test_mcp_context.py +162 -0
  208. cortexshift-0.1.0/tests/unit/test_mcp_resources.py +167 -0
  209. cortexshift-0.1.0/tests/unit/test_mcp_tools.py +260 -0
  210. cortexshift-0.1.0/tests/unit/test_native_continuity.py +481 -0
  211. cortexshift-0.1.0/tests/unit/test_ordering_determinism.py +283 -0
  212. cortexshift-0.1.0/tests/unit/test_ports.py +142 -0
  213. cortexshift-0.1.0/tests/unit/test_project_locator.py +55 -0
  214. cortexshift-0.1.0/tests/unit/test_provider_discovery.py +498 -0
  215. cortexshift-0.1.0/tests/unit/test_provider_handoff_adapters.py +318 -0
  216. cortexshift-0.1.0/tests/unit/test_provider_mcp_args.py +112 -0
  217. cortexshift-0.1.0/tests/unit/test_provider_runtime_adapters.py +154 -0
  218. cortexshift-0.1.0/tests/unit/test_recovery_service.py +142 -0
  219. cortexshift-0.1.0/tests/unit/test_run_service.py +460 -0
  220. cortexshift-0.1.0/tests/unit/test_session_store.py +157 -0
  221. cortexshift-0.1.0/tests/unit/test_source_session.py +134 -0
  222. cortexshift-0.1.0/tests/unit/test_sqlite_migrations.py +216 -0
  223. cortexshift-0.1.0/tests/unit/test_sqlite_store.py +233 -0
  224. cortexshift-0.1.0/tests/unit/test_sqlite_v3_migrations.py +142 -0
  225. cortexshift-0.1.0/tests/unit/test_sqlite_v4_migrations.py +283 -0
  226. cortexshift-0.1.0/tests/unit/test_sqlite_v5_migrations.py +166 -0
  227. cortexshift-0.1.0/tests/unit/test_sqlite_v6_migrations.py +232 -0
  228. cortexshift-0.1.0/tests/unit/test_status_service.py +74 -0
  229. cortexshift-0.1.0/tests/unit/test_switch_service.py +774 -0
  230. cortexshift-0.1.0/tests/unit/test_task_service.py +221 -0
  231. cortexshift-0.1.0/tests/unit/test_task_workspace.py +205 -0
  232. cortexshift-0.1.0/tests/unit/test_version.py +11 -0
  233. cortexshift-0.1.0/tests/unit/test_workspace_lease.py +175 -0
  234. cortexshift-0.1.0/uv.lock +1259 -0
@@ -0,0 +1,71 @@
1
+ # CortexShift project-local state
2
+ .cortexshift/
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # Virtual environments
33
+ .venv/
34
+ env/
35
+ venv/
36
+ ENV/
37
+ env.bak/
38
+ venv.bak/
39
+
40
+ # Testing and coverage
41
+ .pytest_cache/
42
+ .coverage
43
+ .coverage.*
44
+ htmlcov/
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.py,cover
49
+ .hypothesis/
50
+
51
+ # Type checking and linting
52
+ .mypy_cache/
53
+ .ruff_cache/
54
+ .dmypy.json
55
+ dmypy.json
56
+
57
+ # Operating System
58
+ .DS_Store
59
+ .DS_Store?
60
+ ._*
61
+ .Spotlight-V100
62
+ .Trashes
63
+ ehthumbs.db
64
+ Thumbs.db
65
+
66
+ # IDE and editors
67
+ .idea/
68
+ .vscode/
69
+ *.swp
70
+ *.swo
71
+ *~
@@ -0,0 +1,101 @@
1
+ # AGENTS.md — CortexShift Contributor Contract for Coding Agents
2
+
3
+ Welcome to **CortexShift**. This repository is built to orchestrate and transition work across multiple coding agents (Claude Code, OpenAI Codex, Google Antigravity, and future agents). Because CortexShift itself will be developed, maintained, and refactored by different AI coding agents, all participating agents MUST follow this engineering contract.
4
+
5
+ ---
6
+
7
+ ## 1. Prime Directive: Truth Hierarchy
8
+
9
+ Never treat an agent summary, commit message, or handoff note as infallible truth. Adhere strictly to the truth hierarchy:
10
+
11
+ 1. **Actual repository files** (the filesystem is primary reality)
12
+ 2. **Git state** (branch, commits, status, diffs)
13
+ 3. **Verified command/test results** (executed by you in this session)
14
+ 4. **CortexShift canonical task state** (persisted task records)
15
+ 5. **Previous agent summaries/handoffs** (advisory only)
16
+
17
+ A previous agent statement claiming "all tests pass" must NEVER override your own test execution revealing failures. Always verify.
18
+
19
+ ---
20
+
21
+ ## 2. Architectural Invariants
22
+
23
+ Every agent working on CortexShift must preserve the following architectural invariants:
24
+
25
+ 1. **Task-Centric, Not Conversation-Centric**: Tasks belong to CortexShift, not to any provider session. Providers are ephemeral workers on a persistent task.
26
+ 2. **Native-Agent-First**: Never re-implement provider CLIs. CortexShift orchestrates native CLIs through adapters.
27
+ 3. **Provider-Agnostic Core**: The domain and application layers must NEVER contain provider-specific conditionals (e.g. `if provider == "claude"`). All provider variance belongs strictly behind the `ProviderAdapter` port.
28
+ 4. **Same-Working-Tree Model**: Agents operate sequentially in the same local repository worktree. Do not design mechanisms around copying or duplicating repositories.
29
+ 5. **Single Mutating Agent**: Only one coding agent may actively mutate the workspace at a time. Multi-agent concurrent editing is strictly out of scope.
30
+ 6. **Local-First & Zero Telemetry**: Core functionality must run locally without cloud dependencies, mandatory hosted backends, external databases, or telemetry.
31
+ 7. **Zero Credential Storage**: CortexShift MUST NEVER capture, store, or manage provider API keys or auth tokens. Authentication is strictly delegated to each provider's native CLI.
32
+ 8. **Structured Canonical State over Transcripts**: Context handoff uses distilled structured state (objective, requirements, decisions, touched files, test status). Transcript capture is disabled by default (`capture_transcripts = false`).
33
+ 9. **Git Snapshot Authority vs. Reality**: Stored `GitSnapshot` records are immutable historical observations of what was true at capture time. They are never proof of current working tree reality once subsequent changes occur. Live inspection via `git status` outranks any stored snapshot.
34
+ 10. **Strictly Read-Only Git Execution**: CortexShift's repository inspection must never mutate the repository's version control state. All repository inspection commands (`git status`, `git branch`, `git rev-parse`, `git diff --shortstat`) must be strictly read-only (no `git add`, `git commit`, `git checkout`, `git reset`, `git clean`, etc.).
35
+ 11. **Direct Terminal Passthrough & Zero Prompt Storage**: Native provider interactive sessions directly inherit terminal stdio without pipe-wrapping, buffering, or TUI scraping. CortexShift must never persist user prompts, conversational transcripts, or provider auth tokens.
36
+ 12. **Mandatory Workspace Lease**: All mutating agent operations strictly require an exclusive project workspace lease (`FileWorkspaceLease` via OS advisory locking on `.cortexshift/agent.lock`) to enforce single-mutating-agent execution. The OS advisory lock (`fcntl.flock` / `msvcrt.locking`) on the open file descriptor is authoritative; the mere existence of the lock file on disk does not imply an active lease, and users must never be instructed to delete the lock file. Stale database session records never impede acquiring a free OS lock.
37
+ 13. **Handoff Generation Must Not Require the Outgoing Provider**: Canonical handoffs are derived deterministically from durable local state (canonical Project, canonical Task, previous Session metadata, live Git inspection, persisted Git snapshot). CortexShift must NEVER require the outgoing agent to summarize its work, launch, or even be installed — the moment a user most needs to switch is the moment the previous agent can no longer answer. No outgoing model call may ever become a mandatory handoff step.
38
+ 14. **Historical Handoff State Never Substitutes for Live Repository Truth**: A stored `HandoffRecord` is an immutable observation of what was true at capture time. Live repository files, live Git state, and verified test results always outrank it. Never present recorded completed items as proven, and never present a stored Git snapshot as current truth.
39
+ 15. **Unknown State Stays Explicitly Unknown**: Where CortexShift has no verified record (currently `IMPORTANT DECISIONS` and `TEST STATUS`), encode the absence honestly. Never infer that tests pass because a provider process exited 0.
40
+ 16. **Provider-Specific Handoff Delivery Belongs Behind Adapters**: All transport variance lives behind `ProviderHandoffAdapter`. Orchestration services must never branch on provider identity.
41
+ 17. **Never Persist Rendered Prompts or Provider Responses**: Canonical structured state is persisted; rendered provider prompts, provider bootstrap responses, transcripts, and hidden reasoning are not. Rendered packages are transport representations, re-derived deterministically from canonical state.
42
+
43
+ 18. **Exact Native Identity Only**: Never guess provider-native session identity or inspect provider transcript/cache storage to discover sessions.
44
+ 19. **Fresh Context on Return**: Fresh canonical handoff and live repository state outrank stale native conversation assumptions.
45
+ 20. **Invocation Lineage**: Every resume invocation creates a new CortexShift Session record; preserve historical invocations.
46
+ 21. **Historical Checkpoint State Never Outranks Live Truth**: Checkpoint records are immutable historical observations at capture time. Live repository files, live Git status, and verified test results strictly outrank any historical checkpoint.
47
+ 22. **Zero Outgoing Model Calls for Checkpoints & Recovery**: Checkpoint creation and crash recovery are entirely deterministic and derived from durable local state and live repository inspection. CortexShift must never invoke any LLM or require the outgoing provider to summarize its state during checkpoint or recovery.
48
+ 23. **Never Fabricate Test Verification or Process End Times**: If tests are reported in a checkpoint, they are explicitly tagged as unverified reported provenance. When reconciling stale sessions, CortexShift records `status=interrupted`, `exit_reason=unexpected_termination`, and `reconciled_at=<timestamp>`, leaving `ended_at=None` to avoid fabricating an unobserved process termination time.
49
+ 24. **Cooperative Milestone Checkpoints Without Lease**: Agents and operators may capture cooperative milestone checkpoints (`cortexshift checkpoint create`) while a provider session is actively running without acquiring the exclusive workspace lease. Crash recovery (`cortexshift recover`) strictly requires acquiring the exclusive workspace lease to ensure no other agent is actively modifying the repository.
50
+ 25. **Pure Stdout Wire Protocol for MCP**: Standard output (`stdout`) of `cortexshift mcp serve` is strictly and exclusively reserved for valid MCP JSON-RPC protocol frames. All diagnostic logging, notices, and errors are routed strictly to `stderr` or silenced. Polluting `stdout` breaks client JSON-RPC parsers.
51
+ 26. **Workspace Lease Bypass for MCP Operations**: Because an active provider session already holds the exclusive workspace lease (`.cortexshift/agent.lock`), MCP server operations initiated by that agent deliberately bypass the lease to avoid self-deadlocks. Process and thread safety are guaranteed by SQLite WAL concurrency.
52
+ 27. **Bound Context Isolation**: MCP operations are bound strictly at launch to a specific `Project`, `Task`, `Session`, and `ProviderId`. Tool mutations affect only the task assigned at launch, preventing cross-task state corruption regardless of external changes to the default active task.
53
+
54
+ 28. **Interface Adapters Reuse Application Services**: The CLI, the MCP server, and the TUI are peer interface adapters over one set of application services. None of them may contain SQL, open a persistence store directly, invoke Git, construct provider arguments, or duplicate task, recovery, or handoff rules. A rule needed by two adapters belongs in the domain or application layer, not copied into both.
55
+
56
+ 29. **CortexShift Releases Terminal Ownership Before Launching a Native Provider**: Provider-native terminal UIs are never embedded, scraped, multiplexed, or relayed through a pseudo-terminal. The TUI exits with a structured `TuiExitRequest`, and only after the Textual application's run loop has returned may the run/resume/switch service be invoked. No PTY or terminal-emulator dependency (`pexpect`, `ptyprocess`, `pyte`, tmux wrappers) may be introduced.
57
+
58
+ 30. **The Dashboard Must Not Hold the Workspace Lease**: An open TUI must never block a coding agent. Observation and cooperative editing acquire no lease; operations requiring exclusivity (run, resume, switch, recover) acquire it inside their own services, which are the authority on refusing unsafe attempts. Workspace activity is probed through the OS advisory lock and never inferred from the lock file's existence.
59
+
60
+ 31. **Historical State Is Labelled Honestly and Never Presented as Live Truth**: Every human-facing surface states the authority of what it shows — live repository inspection, historical checkpoint or handoff observation, reported-and-unverified test status, or last-known session state. Unfinalized sessions are never asserted as crashed, and progress is never inferred from Git state or a process exit code.
61
+
62
+ ---
63
+
64
+ ## 3. Engineering & Workflow Rules
65
+
66
+ - **Read Before Modifying**: Review [`docs/architecture.md`](docs/architecture.md) and relevant ADRs in [`docs/decisions/`](docs/decisions/) before initiating significant architectural modifications.
67
+ - **Strict Layering**: Enforce dependency flow: `domain` ← `ports` ← `application` ← `cli` / `adapters`. Domain must never import CLI, concrete adapters, or third-party infrastructure frameworks.
68
+ - **Persistence Boundaries**: Domain, application, and CLI layers must NEVER contain SQL statements or SQLite dependencies. All persistence logic belongs strictly behind ports in adapters (`SQLiteStateStore`).
69
+ - **Data Integrity & Non-Destruction**: Never automatically wipe, reset, or silently overwrite user database state. Migrations must be forward-safe, deterministic, and transactional. If state is incompatible, fail safely.
70
+ - **Private State Area**: `.cortexshift/` is local private runtime state. It must never store provider credentials, auth tokens, or conversational transcripts.
71
+ - **Minimal Dependencies**: Do not introduce heavy frameworks (no LangChain, LlamaIndex, vector DBs, Redis, ORMs, or cloud SDKs). Rely on Python stdlib, Pydantic, Typer, Rich, the official MCP SDK, and Textual. Exactly one TUI framework: do not add `prompt_toolkit`, `urwid`, `blessed`, or curses wrappers alongside Textual.
72
+ - **Tests Are Mandatory**: Every new domain behavior, CLI command, and adapter must include automated, deterministic unit tests. Run `pytest`, `ruff check .`, and `mypy src` before declaring work complete.
73
+ - **Scope Discipline**: Strictly keep changes scoped to the current phase and requested task. Do NOT prematurely implement future roadmap phases (e.g., do not add provider execution or database schemas until requested).
74
+ - **Document Changes**: When modifying architecture or adding cross-cutting features, record an Architectural Decision Record (ADR) in `docs/decisions/` and update relevant documentation.
75
+ - **Never Silently Alter Invariants**: Any change to foundational rules requires explicit rationale, consensus, and an updated ADR.
76
+
77
+ ---
78
+
79
+ ## 4. Key Documentation Links
80
+
81
+ - [Architecture Overview](docs/architecture.md)
82
+ - [Canonical Handoff Protocol](docs/handoff-protocol.md)
83
+ - [Project Roadmap](docs/roadmap.md)
84
+ - [Architecture Decisions (ADRs)](docs/decisions/ADR-0001-core-architecture.md)
85
+ - [ADR-0001: Core Architecture](docs/decisions/ADR-0001-core-architecture.md)
86
+ - [ADR-0002: Safe Provider Discovery](docs/decisions/ADR-0002-safe-provider-discovery.md)
87
+ - [ADR-0003: Project-Local Persistence](docs/decisions/ADR-0003-project-local-persistence.md)
88
+ - [ADR-0004: Git Repository Context](docs/decisions/ADR-0004-git-repository-context.md)
89
+ - [ADR-0005: Native Provider Launch & Session Lifecycle](docs/decisions/ADR-0005-native-provider-runtime.md)
90
+ - [ADR-0006: Canonical Agent Handoff & Manual Provider Switching](docs/decisions/ADR-0006-canonical-agent-handoff.md)
91
+ - [ADR-0007: Native Session Continuity](docs/decisions/ADR-0007-native-session-continuity.md)
92
+ - [ADR-0008: Checkpoints, Crash Recovery & Handoff Enrichment](docs/decisions/ADR-0008-checkpoint-and-recovery.md)
93
+ - [ADR-0009: MCP Shared State & Agent Self-Reporting](docs/decisions/ADR-0009-mcp-shared-state.md)
94
+ - [ADR-0010: Interactive Terminal Control Center](docs/decisions/ADR-0010-terminal-control-center.md)
95
+
96
+ ## Release contracts
97
+
98
+ - Published SQLite migrations are immutable.
99
+ - Published handoff/checkpoint protocol semantics are versioned contracts.
100
+ - Release workflows use least privilege and no long-lived PyPI tokens.
101
+ - Public privacy/provider-support claims must not exceed verified code behavior.
@@ -0,0 +1,55 @@
1
+ # Changelog
2
+
3
+ This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
4
+ with compatibility care for commands, persisted state, and MCP contracts during 0.x.
5
+
6
+ ## 0.1.0 — Unreleased release candidate
7
+
8
+ Initial public alpha; no publication date has been assigned.
9
+
10
+ ### Added
11
+
12
+ - Project-local SQLite tasks with objectives, requirements, structured progress,
13
+ known issues, and durable history.
14
+ - Passive discovery and native terminal orchestration for Claude Code, Codex,
15
+ and Antigravity through provider adapters.
16
+ - Deterministic canonical handoffs, manual switching, exact known-ID resume,
17
+ and fresh context on return to a provider.
18
+ - Cooperative milestone and session-end checkpoints, plus deterministic crash
19
+ recovery with honest historical observations and reported test provenance.
20
+ - Local stdio MCP shared state and a keyboard-driven Textual control center.
21
+ - Release metadata with verified canonical project URLs, wheel/sdist content
22
+ validation, installed CLI/MCP/TUI tests, isolated pipx tests, cross-platform CI,
23
+ OIDC release machinery, and public guides.
24
+
25
+ ### Safety and compatibility
26
+
27
+ - Same working tree, exclusive provider workspace lease, read-only Git inspection,
28
+ provider-native permissions, and no outgoing model call for handoff/recovery.
29
+ - No provider credentials, prompts, rendered handoffs, responses, transcripts,
30
+ full patches, telemetry, self-updater, or cloud account stored/introduced.
31
+ - SQLite schema v6, Handoff Protocol v1, and Checkpoint Protocol v1 are preserved.
32
+ - Provider CLI behavior remains external, and real-provider validation stays a
33
+ maintainer gate: Claude Code and Codex are validated end to end, while
34
+ Antigravity rests on automated fake-provider coverage only.
35
+
36
+ ### Fixed
37
+
38
+ - Preserve architectural decisions across handoffs. Handoffs read decisions from the
39
+ newest checkpoint alone, so any later checkpoint recorded without decisions of its
40
+ own — including the session-end checkpoint captured automatically when a provider
41
+ exits — buried every decision recorded during that session, and the package then
42
+ stated that no structured decisions were recorded. `HandoffBuilder` now aggregates
43
+ decisions across the task's whole checkpoint history in chronological first-seen
44
+ order, de-duplicated by exact string equality and scoped strictly to one task.
45
+ Checkpoints remain immutable point-in-time records and are not rewritten;
46
+ `record_decision` additionally carries a structured `trigger="decision"` marker in
47
+ existing checkpoint metadata. Schema v6, Checkpoint Protocol v1, and Handoff
48
+ Protocol v1 are unchanged.
49
+ - Bind the managed CortexShift session inside the per-launch MCP configuration.
50
+ A provider CLI spawns the MCP server, and Codex starts MCP servers with a
51
+ sanitized environment, so managed Codex sessions previously saw `session: null`
52
+ and only the four read tools. Unmanaged MCP stays read-only.
53
+ - Escape Windows/quoted Python paths in Codex MCP configuration.
54
+ - Safely probe existing empty Windows workspace lock files without double-close.
55
+ - Close subprocess pipes in test helpers and run fake Python providers portably.
@@ -0,0 +1,159 @@
1
+ # Contributing to CortexShift
2
+
3
+ Thank you for your interest in contributing to **CortexShift**! We are building a local, provider-agnostic developer tool that lets software development tasks transition smoothly between coding agents without context loss.
4
+
5
+ Whether you are a human developer or an AI coding agent, please review these guidelines.
6
+
7
+ ---
8
+
9
+ ## Development Environment Setup
10
+
11
+ CortexShift targets **Python 3.12+** and uses **[`uv`](https://docs.astral.sh/uv/)** as its primary package and project manager.
12
+
13
+ ### 1. Obtain the source
14
+
15
+ Clone the canonical public repository:
16
+
17
+ ```bash
18
+ git clone https://github.com/batuhanasmakaya/CortexShift.git
19
+ cd CortexShift
20
+ ```
21
+
22
+ An extracted source distribution works equally well for verification builds.
23
+
24
+ ### 2. Install Dependencies
25
+
26
+ Using `uv`:
27
+
28
+ ```bash
29
+ uv sync --locked
30
+ ```
31
+
32
+ This creates a local `.venv` and installs all runtime and development dependencies.
33
+
34
+ ---
35
+
36
+ ## Quality & Verification Commands
37
+
38
+ We maintain strict standards for code quality, typing, and testing. Run the following checks before opening a pull request or completing an agent task:
39
+
40
+ ### 1. Code Formatting & Linting
41
+
42
+ ```bash
43
+ uv run ruff check .
44
+ uv run ruff format --check .
45
+ ```
46
+
47
+ To automatically fix safe issues:
48
+
49
+ ```bash
50
+ uv run ruff check --fix .
51
+ uv run ruff format .
52
+ ```
53
+
54
+ ### 2. Type Checking
55
+
56
+ Mypy is configured in strict mode:
57
+
58
+ ```bash
59
+ uv run mypy
60
+ ```
61
+
62
+ ### 3. Automated Tests & Coverage
63
+
64
+ ```bash
65
+ uv run pytest
66
+ ```
67
+
68
+ Tests that invoke the CLI must use `AnsiFreeCliRunner` (or `run_cli`, for subprocesses)
69
+ from `tests/cli_runner.py` rather than `typer.testing.CliRunner` or a bare
70
+ `subprocess.run`. Typer renders help through Rich and forces color whenever
71
+ `GITHUB_ACTIONS`, `FORCE_COLOR`, or `PY_COLORS` is set, which splits option names across
72
+ escape sequences — `--json` stops being a substring of the help text. The shared runners
73
+ strip those escapes so assertions describe what the command said, not how the terminal
74
+ painted it. To reproduce CI's rendering locally:
75
+
76
+ ```bash
77
+ FORCE_COLOR=1 uv run pytest
78
+ ```
79
+
80
+ Terminal width stays whatever the caller asked for — `COLUMNS=60 uv run pytest` really
81
+ does run the CLI at 60 columns — so assertions have to cope with it themselves:
82
+
83
+ - When Rich merely re-wraps a sentence, pass the output through `unwrapped()` from
84
+ `tests/cli_runner.py` instead of matching a fragment that happens to fit on one line.
85
+ - When a test asserts on a laid-out table or grid, request the `fixed_console_width`
86
+ fixture. A narrow terminal makes the CLI genuinely truncate cells, and no
87
+ normalization can recover dropped characters. Use it only for that.
88
+
89
+ ```bash
90
+ COLUMNS=60 uv run pytest
91
+ COLUMNS=200 uv run pytest
92
+ ```
93
+
94
+ ### 4. CLI Smoke Testing
95
+
96
+ ```bash
97
+ uv run cortexshift --help
98
+ uv run cortexshift version
99
+ uv run python -m cortexshift --help
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Architectural Principles & Boundaries
105
+
106
+ All contributors must respect the core architectural layers:
107
+
108
+ ```text
109
+ src/cortexshift/
110
+ ├── domain/ # Pure business entities & value objects (zero external frameworks)
111
+ ├── ports/ # Protocols & abstract interfaces defining contracts
112
+ ├── application/ # Orchestration, use-cases, and business workflows
113
+ ├── adapters/ # Implementations of ports (CLI wrappers, persistence, etc.)
114
+ └── cli/ # Typer/Rich command-line interface entrypoints
115
+ ```
116
+
117
+ ### Critical Guidelines
118
+
119
+ 1. **Dependency Inversion**: Dependencies point inward:
120
+ - `domain` must never import from `adapters`, `cli`, or third-party infrastructure frameworks.
121
+ - `ports` define interfaces using domain types.
122
+ - `adapters` implement `ports`.
123
+ 2. **Provider Isolation**: Provider-specific logic (for Claude Code, Codex, Antigravity, etc.) must reside exclusively in `src/cortexshift/adapters/providers/`. Never introduce provider conditionals in `domain` or `application`.
124
+ 3. **No Credential Storage**: CortexShift never stores, reads, or manages provider API keys. Native CLIs handle their own auth.
125
+ 4. **Minimal Runtime Dependencies**: Do not introduce heavy AI frameworks (LangChain, LlamaIndex), vector databases, or ORMs.
126
+ 5. **Truth Hierarchy**: Real repository files, Git state, and verified test executions outrank agent summaries.
127
+ 6. **Architectural Decision Records (ADRs)**: Any architectural change, new invariant, or cross-cutting dependency addition requires an ADR in `docs/decisions/`.
128
+
129
+ ---
130
+
131
+ ## Commit & PR Guidelines
132
+
133
+ - Keep pull requests focused on a single phase or feature.
134
+ - Include unit tests covering all new domain behavior, ports, and CLI commands.
135
+ - Ensure all CI checks pass on GitHub Actions.
136
+ - Open issues and pull requests at
137
+ <https://github.com/batuhanasmakaya/CortexShift>. Report suspected
138
+ vulnerabilities through [Security](SECURITY.md) instead of a public issue.
139
+
140
+ ## Provider adapters and persistence
141
+
142
+ Implement discovery, runtime, handoff, and optional native-session ports in
143
+ `adapters/providers`; register adapters at the composition boundary. Add bounded
144
+ version/help checks and deterministic fakes, never CI model calls. Do not add
145
+ provider conditionals to domain/application code. CLI, MCP, and TUI reuse services.
146
+
147
+ Persistence and SQL belong in adapters. Published migrations v1–v6 must remain
148
+ unchanged; add transactional forward migrations with rollback and preservation
149
+ tests. Published handoff/checkpoint meanings require explicit protocol versioning.
150
+ Never persist credentials, prompts, provider responses, transcripts, or full patches.
151
+
152
+ ## Release checks
153
+
154
+ Run `uv run python scripts/release_check.py`, `uv build`, and
155
+ `uv run python scripts/artifact_smoke.py --dist dist`. The latter creates disposable
156
+ install environments and uses package-index access for dependencies. It never calls
157
+ models or publishes. See [Releasing](docs/releasing.md) for the complete sequence.
158
+ Pre-1.0 internal Python imports are not a stable public API. Changes to commands,
159
+ persisted state, and MCP contracts need explicit compatibility review.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CortexShift contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.5
2
+ Name: cortexshift
3
+ Version: 0.1.0
4
+ Summary: Provider-neutral coding-agent handoffs with persistent project context.
5
+ Project-URL: Homepage, https://github.com/batuhanasmakaya/CortexShift
6
+ Project-URL: Repository, https://github.com/batuhanasmakaya/CortexShift
7
+ Project-URL: Issues, https://github.com/batuhanasmakaya/CortexShift/issues
8
+ Project-URL: Changelog, https://github.com/batuhanasmakaya/CortexShift/blob/main/CHANGELOG.md
9
+ Project-URL: Security, https://github.com/batuhanasmakaya/CortexShift/security
10
+ Author: CortexShift contributors
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: ai,antigravity,claude-code,codex,coding-agents,context-handoff,developer-tools
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Build Tools
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Requires-Python: >=3.12
25
+ Requires-Dist: mcp<3,>=2
26
+ Requires-Dist: pydantic>=2.6.0
27
+ Requires-Dist: rich>=13.7.0
28
+ Requires-Dist: textual<9,>=8
29
+ Requires-Dist: typer>=0.12.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
34
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # CortexShift
39
+
40
+ **Switch agents. Keep the context.**
41
+
42
+ CortexShift keeps development tasks intact as you move between Claude Code,
43
+ Codex, and Antigravity in the same local repository. A Task belongs to CortexShift;
44
+ providers are workers over that Task. Switching does not require the outgoing
45
+ agent to answer, summarize, or even remain installed.
46
+
47
+ **0.1.0 is an initial public alpha release candidate. PyPI publication is pending.**
48
+ The canonical repository is <https://github.com/batuhanasmakaya/CortexShift>.
49
+ Python 3.12–3.14 is targeted, with required Linux/macOS/Windows CI on protected
50
+ `main`. Real end-to-end validation is complete for Claude Code and Codex;
51
+ Antigravity has automated coverage only, and interactive platform smokes remain
52
+ on a separate maintainer checklist.
53
+
54
+ ## How it works
55
+
56
+ CortexShift stores objectives, requirements, progress, checkpoints, and session
57
+ metadata in project-local SQLite. It combines that structured state with live
58
+ Git inspection to prepare a canonical handoff. A conversation transcript is not
59
+ canonical project state: receiving agents must verify the files and run tests.
60
+
61
+ Authority flows from live repository files → live Git → verified evidence →
62
+ canonical Task state → historical observations. Recorded completion is a report,
63
+ not proof; checkpoints never establish that tests passed independently.
64
+
65
+ ## Capabilities
66
+
67
+ - Persistent tasks, provider session history, and manual agent switching.
68
+ - Exact native resume when an ID is known; fresh canonical context on return.
69
+ - Cooperative checkpoints and deterministic crash recovery.
70
+ - MCP shared state over local stdio: agents can read context and report progress.
71
+ - A keyboard-driven terminal control center for tasks, repository state, and history.
72
+ - Read-only Git inspection and an OS workspace lock for exclusive provider runs.
73
+
74
+ ## Quick start
75
+
76
+ After PyPI publication:
77
+
78
+ ```bash
79
+ pipx install cortexshift
80
+ cd my-project
81
+ cortexshift doctor
82
+ cortexshift init
83
+ cortexshift task start --title "Implement authentication" \
84
+ --objective "Add authentication without breaking existing APIs."
85
+ cortexshift run claude
86
+ # After the provider exits:
87
+ cortexshift switch codex
88
+ cortexshift tui
89
+ ```
90
+
91
+ CortexShift does not bundle Git or any provider CLI. Install and authenticate
92
+ native providers yourself. Git is recommended for repository-aware handoffs,
93
+ but project initialization also works without Git.
94
+
95
+ ## Installation and updates
96
+
97
+ [pipx](https://pipx.pypa.io/stable/) gives a global command with isolated Python
98
+ dependencies. Use Python 3.12 or newer. Once published:
99
+
100
+ ```bash
101
+ pipx upgrade cortexshift
102
+ pipx uninstall cortexshift
103
+ ```
104
+
105
+ Before publication, clone the repository and use `uv sync --locked`, then
106
+ `uv run cortexshift --help`:
107
+
108
+ ```bash
109
+ git clone https://github.com/batuhanasmakaya/CortexShift.git
110
+ cd CortexShift
111
+ ```
112
+
113
+ To install a candidate globally without an editable checkout: `uv build`, then
114
+ `pipx install dist/cortexshift-0.1.0-py3-none-any.whl`.
115
+ A virtualenv/pip alternative is in [Getting Started][getting-started].
116
+ Homebrew is pending publication of a custom tap.
117
+
118
+ ## Your first handoff
119
+
120
+ ```bash
121
+ cortexshift checkpoint create -d "Preserve existing API compatibility" \
122
+ -t "Targeted tests passed (operator report)"
123
+ cortexshift handoff preview codex
124
+ cortexshift switch codex --dry-run
125
+ cortexshift switch codex
126
+ ```
127
+
128
+ Preview and dry-run launch no model and persist nothing. Actual Codex and
129
+ Antigravity handoffs each use one read-only bootstrap model turn before native
130
+ resume, which may consume provider usage. Claude receives context directly.
131
+
132
+ ## Terminal control center
133
+
134
+ Run `cortexshift tui` in an initialized project and a real terminal. Use `1`–`7`
135
+ to navigate, `r` to refresh, `c` to checkpoint, `x` for provider actions, and `?`
136
+ for help. The dashboard releases terminal ownership before launching a native
137
+ provider. After that provider exits, run `cortexshift tui` again.
138
+ An open dashboard holds no workspace lease and may observe a running agent.
139
+
140
+ ## MCP and providers
141
+
142
+ Claude and Codex receive MCP configuration automatically. Antigravity requires
143
+ explicit workspace setup: `cortexshift mcp setup antigravity`.
144
+ Inspect integration with `cortexshift mcp status`. Managed sessions expose
145
+ 10 context-bound tools; unmanaged/read-only sessions expose four read tools.
146
+ See [Provider Support][provider-support] for identity, resume, and
147
+ validation limits.
148
+
149
+ ## Privacy and trust
150
+
151
+ CortexShift has no cloud account, telemetry, or paid model API key requirement.
152
+ It does not copy provider credentials or persist prompts, provider responses,
153
+ transcripts, or full Git patches. Native provider permissions remain authoritative.
154
+ Providers may send repository/context data to their own services under their
155
+ configuration and terms; local orchestration does not change that behavior.
156
+
157
+ Task text, paths, and project history are local development data. Generally ignore
158
+ `.cortexshift/` in Git; CortexShift does not rewrite your `.gitignore`.
159
+ See [Security][security-policy] for boundaries and safe reporting.
160
+
161
+ ## Limitations
162
+
163
+ External provider CLIs can change. Legacy or plain Codex/Antigravity runs may
164
+ have no native ID; those sessions cannot be exact-resumed. Deleted native
165
+ conversations are not silently replaced. There is no automatic quota switching,
166
+ embedded provider TUI, GUI, cloud agent, secret manager, or terminal multiplexer.
167
+ Provider accounts, subscriptions, and usage costs are governed by each provider.
168
+ Internal Python modules are not a stable library API.
169
+
170
+ ## Documentation and development
171
+
172
+ - [Getting Started][getting-started] and [Troubleshooting][troubleshooting]
173
+ - [Provider Support][provider-support]
174
+ - [Architecture][architecture] and [Handoff Protocol][handoff-protocol]
175
+ - [Contributing][contributing], [Releasing][releasing], and [Roadmap][roadmap]
176
+ - [Changelog][changelog] and [Issues][issues]
177
+
178
+ ```bash
179
+ uv sync --locked
180
+ uv run ruff check .
181
+ uv run ruff format --check .
182
+ uv run mypy
183
+ uv run pytest
184
+ ```
185
+
186
+ ## License
187
+
188
+ [MIT][license]. CortexShift is an independent open-source project and is not
189
+ affiliated with or endorsed by Anthropic, OpenAI, or Google.
190
+
191
+ [getting-started]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/getting-started.md
192
+ [provider-support]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/provider-support.md
193
+ [architecture]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/architecture.md
194
+ [handoff-protocol]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/handoff-protocol.md
195
+ [troubleshooting]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/troubleshooting.md
196
+ [contributing]: https://github.com/batuhanasmakaya/CortexShift/blob/main/CONTRIBUTING.md
197
+ [releasing]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/releasing.md
198
+ [roadmap]: https://github.com/batuhanasmakaya/CortexShift/blob/main/docs/roadmap.md
199
+ [changelog]: https://github.com/batuhanasmakaya/CortexShift/blob/main/CHANGELOG.md
200
+ [security-policy]: https://github.com/batuhanasmakaya/CortexShift/blob/main/SECURITY.md
201
+ [license]: https://github.com/batuhanasmakaya/CortexShift/blob/main/LICENSE
202
+ [issues]: https://github.com/batuhanasmakaya/CortexShift/issues