contitext 0.5.1__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 (63) hide show
  1. contitext-0.5.1/.env.example +10 -0
  2. contitext-0.5.1/CONTRIBUTING.md +35 -0
  3. contitext-0.5.1/Dockerfile +11 -0
  4. contitext-0.5.1/LICENSE +202 -0
  5. contitext-0.5.1/MANIFEST.in +9 -0
  6. contitext-0.5.1/NOTICE +4 -0
  7. contitext-0.5.1/PKG-INFO +169 -0
  8. contitext-0.5.1/README.md +136 -0
  9. contitext-0.5.1/SECURITY.md +21 -0
  10. contitext-0.5.1/alembic.ini +39 -0
  11. contitext-0.5.1/compose.yaml +39 -0
  12. contitext-0.5.1/docs/api.md +56 -0
  13. contitext-0.5.1/docs/commands.md +83 -0
  14. contitext-0.5.1/docs/installation.md +73 -0
  15. contitext-0.5.1/docs/releasing.md +28 -0
  16. contitext-0.5.1/docs/roadmap.md +25 -0
  17. contitext-0.5.1/integrations/PROJECT-CONTEXT-PROTOCOL.md +72 -0
  18. contitext-0.5.1/pyproject.toml +52 -0
  19. contitext-0.5.1/scripts/bootstrap.py +46 -0
  20. contitext-0.5.1/setup.cfg +4 -0
  21. contitext-0.5.1/src/contitext/__init__.py +3 -0
  22. contitext-0.5.1/src/contitext/admin.py +122 -0
  23. contitext-0.5.1/src/contitext/api.py +214 -0
  24. contitext-0.5.1/src/contitext/auth.py +106 -0
  25. contitext-0.5.1/src/contitext/cli.py +68 -0
  26. contitext-0.5.1/src/contitext/config.py +53 -0
  27. contitext-0.5.1/src/contitext/db.py +23 -0
  28. contitext-0.5.1/src/contitext/demo.py +49 -0
  29. contitext-0.5.1/src/contitext/locking.py +24 -0
  30. contitext-0.5.1/src/contitext/mcp_server.py +131 -0
  31. contitext-0.5.1/src/contitext/mcp_smoke.py +140 -0
  32. contitext-0.5.1/src/contitext/migrations/__init__.py +0 -0
  33. contitext-0.5.1/src/contitext/migrations/env.py +48 -0
  34. contitext-0.5.1/src/contitext/migrations/versions/0001_foundation.py +109 -0
  35. contitext-0.5.1/src/contitext/migrations/versions/__init__.py +0 -0
  36. contitext-0.5.1/src/contitext/models.py +87 -0
  37. contitext-0.5.1/src/contitext/projector.py +291 -0
  38. contitext-0.5.1/src/contitext/repository.py +326 -0
  39. contitext-0.5.1/src/contitext/schemas.py +145 -0
  40. contitext-0.5.1/src/contitext/service.py +134 -0
  41. contitext-0.5.1/src/contitext.egg-info/PKG-INFO +169 -0
  42. contitext-0.5.1/src/contitext.egg-info/SOURCES.txt +61 -0
  43. contitext-0.5.1/src/contitext.egg-info/dependency_links.txt +1 -0
  44. contitext-0.5.1/src/contitext.egg-info/entry_points.txt +6 -0
  45. contitext-0.5.1/src/contitext.egg-info/requires.txt +15 -0
  46. contitext-0.5.1/src/contitext.egg-info/top_level.txt +1 -0
  47. contitext-0.5.1/tests/conftest.py +65 -0
  48. contitext-0.5.1/tests/test_acceptance.py +300 -0
  49. contitext-0.5.1/tests/test_admin.py +54 -0
  50. contitext-0.5.1/tests/test_bindings.py +117 -0
  51. contitext-0.5.1/tests/test_cli.py +131 -0
  52. contitext-0.5.1/tests/test_concurrency.py +73 -0
  53. contitext-0.5.1/tests/test_config.py +25 -0
  54. contitext-0.5.1/tests/test_events.py +216 -0
  55. contitext-0.5.1/tests/test_handoffs.py +82 -0
  56. contitext-0.5.1/tests/test_http.py +120 -0
  57. contitext-0.5.1/tests/test_isolation.py +64 -0
  58. contitext-0.5.1/tests/test_mcp.py +171 -0
  59. contitext-0.5.1/tests/test_migrations.py +157 -0
  60. contitext-0.5.1/tests/test_projection.py +239 -0
  61. contitext-0.5.1/tests/test_public_distribution.py +43 -0
  62. contitext-0.5.1/tests/test_restart_recovery.py +29 -0
  63. contitext-0.5.1/tests/test_search.py +107 -0
@@ -0,0 +1,10 @@
1
+ # Prefer scripts/bootstrap.py, which generates unique secrets and identity IDs.
2
+ POSTGRES_USER=contitext
3
+ POSTGRES_DB=contitext
4
+ POSTGRES_PASSWORD=REPLACE_WITH_RANDOM_PASSWORD
5
+ DATABASE_URL=postgresql+psycopg://contitext:REPLACE_WITH_RANDOM_PASSWORD@postgres:5432/contitext
6
+ CONTITEXT_PORT=18791
7
+ CONTITEXT_AUTH_TOKENS='{"REPLACE_WITH_RANDOM_TOKEN":{"principal_id":"11111111-1111-4111-8111-111111111111","name":"Example developer"}}'
8
+ CONTITEXT_MCP_TOKEN=REPLACE_WITH_RANDOM_TOKEN
9
+ CONTITEXT_SEED_JSON='{"projects":[{"id":"demo","display_name":"Demo project","status":"active"}],"principals":[{"id":"11111111-1111-4111-8111-111111111111","name":"Example developer"}],"acls":[{"project_id":"demo","principal_id":"11111111-1111-4111-8111-111111111111","role":"owner"}]}'
10
+ CONTITEXT_SMOKE_PROJECT_ID=demo
@@ -0,0 +1,35 @@
1
+ # Contributing
2
+
3
+ Use English for commit messages, issues, pull requests, reviews, release notes,
4
+ documentation, code comments, and user-facing CLI messages. Use ASCII `!!` in
5
+ documented chat commands; full-width punctuation is a compatibility input only.
6
+
7
+ Use synthetic projects and identities in tests and documentation. Keep private
8
+ configuration, credentials, hostnames, conversation history, and project state out
9
+ of commits. Add regression tests for behavior changes and document API changes.
10
+
11
+ ## Local tests
12
+
13
+ Use Python 3.11 or 3.12 and a **dedicated disposable** PostgreSQL 16 database.
14
+ Tests drop and recreate its public schema. Never point tests at an application DB.
15
+
16
+ ```sh
17
+ python3 -m venv .venv
18
+ . .venv/bin/activate
19
+ python -m pip install -e '.[test,release]'
20
+ docker run -d --name contitext-tests -p 127.0.0.1:55439:5432 \
21
+ -e POSTGRES_USER=contitext -e POSTGRES_PASSWORD=test-only \
22
+ -e POSTGRES_DB=contitext_test postgres:16
23
+ export CONTITEXT_TEST_DATABASE_URL='postgresql+psycopg://contitext:test-only@127.0.0.1:55439/contitext_test'
24
+ # Wait until pg_isready succeeds before running pytest.
25
+ docker exec contitext-tests pg_isready -U contitext -d contitext_test
26
+ pytest
27
+ python -m build
28
+ python -m twine check dist/*
29
+ docker stop contitext-tests
30
+ ```
31
+
32
+ CI uses a fresh PostgreSQL service for each Python version. Existing service tests
33
+ cover authorization, events, concurrency, bindings, restart recovery, real MCP
34
+ stdio, migrations, search, and filesystem projection. Public packaging and privacy
35
+ checks run without access to any private deployment.
@@ -0,0 +1,11 @@
1
+ FROM python:3.12-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
4
+ RUN useradd --create-home --uid 10001 --shell /usr/sbin/nologin app
5
+ WORKDIR /app
6
+ COPY pyproject.toml README.md LICENSE NOTICE ./
7
+ COPY src ./src
8
+ RUN pip install --no-cache-dir .
9
+ USER app
10
+ EXPOSE 8000
11
+ CMD ["contitext", "serve", "--host", "0.0.0.0"]
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ include README.md pyproject.toml alembic.ini compose.yaml Dockerfile .env.example
2
+ include CONTRIBUTING.md SECURITY.md LICENSE NOTICE
3
+ recursive-include src *.py
4
+ recursive-include tests *.py
5
+ recursive-include scripts *.py
6
+ recursive-include docs *.md
7
+ recursive-include integrations *.md
8
+ global-exclude *.py[cod]
9
+ global-exclude .DS_Store
contitext-0.5.1/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Contitext
2
+ Copyright 2026 Contitext contributors
3
+
4
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: contitext
3
+ Version: 0.5.1
4
+ Summary: Project continuity for AI agents: state, decisions, checkpoints, and handoffs.
5
+ Author: Contitext contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/jessysw/contitext
8
+ Project-URL: Repository, https://github.com/jessysw/contitext
9
+ Project-URL: Issues, https://github.com/jessysw/contitext/issues
10
+ Keywords: mcp,agents,context,memory,handoff,postgresql
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Requires-Python: <3.13,>=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ License-File: NOTICE
19
+ Requires-Dist: alembic<2.0,>=1.13
20
+ Requires-Dist: fastapi<1.0,>=0.115
21
+ Requires-Dist: mcp<2.0,>=1.30
22
+ Requires-Dist: psycopg[binary]<4.0,>=3.2
23
+ Requires-Dist: pydantic<3.0,>=2.9
24
+ Requires-Dist: sqlalchemy<2.1,>=2.0.35
25
+ Requires-Dist: uvicorn<1.0,>=0.30
26
+ Provides-Extra: test
27
+ Requires-Dist: httpx<1.0,>=0.27; extra == "test"
28
+ Requires-Dist: pytest<9.0,>=8.3; extra == "test"
29
+ Provides-Extra: release
30
+ Requires-Dist: build<2.0,>=1.2; extra == "release"
31
+ Requires-Dist: twine<7,>=6; extra == "release"
32
+ Dynamic: license-file
33
+
34
+ # Contitext
35
+
36
+ **Project continuity for AI agents.**
37
+
38
+ Keep project state, decisions, checkpoints, and handoffs available across agents,
39
+ sessions, and machines. Contitext is a small, self-hosted Python service backed by
40
+ PostgreSQL, with REST and six MCP tools. No LLM API key or embedding service is required.
41
+
42
+ An agent finishes a session by recording what changed and what comes next. Another
43
+ agent explicitly selects the same project, reads that context, and continues from
44
+ the recorded handoff.
45
+
46
+ **v0.5.1 is an early public release.** The core service is usable independently.
47
+ Companion integrations and broader memory features are on the [roadmap](docs/roadmap.md).
48
+
49
+ ## Quick start
50
+
51
+ Requires Docker with Compose, Python 3.11 or 3.12, and Git.
52
+
53
+ ```sh
54
+ git clone https://github.com/jessysw/contitext.git
55
+ cd contitext
56
+ python3 scripts/bootstrap.py
57
+ docker compose up --build -d --wait
58
+ curl --fail http://127.0.0.1:18791/health/ready
59
+ docker compose exec -T app python -m contitext.demo
60
+ ```
61
+
62
+ The bootstrap script creates fresh local credentials in a private `.env`, seeds a
63
+ `demo` project, and preserves existing configuration. The demo **writes synthetic
64
+ events to that project** and demonstrates two agents handing work over through
65
+ the real HTTP API. Its final output includes:
66
+
67
+ ```json
68
+ {
69
+ "agent_b_resumed": "demo",
70
+ "next_action": "Implement and test the first endpoint.",
71
+ "idempotent_retry": "passed"
72
+ }
73
+ ```
74
+
75
+ The API listens on localhost. PostgreSQL has no published host port. Data persists
76
+ in a Compose volume; `docker compose down` stops the service and preserves it.
77
+ See [installation](docs/installation.md) for Python-package setup, administration,
78
+ backup, and remote access.
79
+
80
+ ## Connect an MCP client
81
+
82
+ After the quick start, add this server to a client that supports stdio MCP. Replace
83
+ the directory with your own absolute checkout path:
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "contitext": {
89
+ "command": "docker",
90
+ "args": ["compose", "--project-directory", "/absolute/path/to/contitext", "exec", "-T", "app", "contitext", "mcp"]
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ Client configuration formats differ. The same command can be used by any stdio MCP
97
+ client. Load [the agent protocol](integrations/PROJECT-CONTEXT-PROTOCOL.md) into the
98
+ client's instruction mechanism and restart its MCP session. This release does not
99
+ automatically modify your agent settings. The MCP server runs locally inside the
100
+ existing app container and shares its database.
101
+
102
+ | Tool | Purpose |
103
+ | --- | --- |
104
+ | `project_bind` | Explicitly select a project for a caller's conversation scope |
105
+ | `project_current` | Read that scope's current project |
106
+ | `context_get` | Get a bounded project overview, checkpoint, questions, decisions, and handoff |
107
+ | `context_record` | Append a note, decision, question, or checkpoint with provenance |
108
+ | `context_handoff` | Record completed work, current work, blockers, and the next action |
109
+ | `context_search` | Search project events using PostgreSQL full-text search |
110
+
111
+ No project is inferred from the working directory or repository name. Each caller
112
+ uses a stable conversation scope and explicitly selects a project. Project ACLs
113
+ are enforced on the server. [API contracts and limits](docs/api.md) describe what
114
+ the server enforces and what the agent protocol requires.
115
+
116
+ ## Commands
117
+
118
+ Terminal commands use the `contitext` executable:
119
+
120
+ ```sh
121
+ contitext --help
122
+ contitext --version
123
+ contitext migrate
124
+ contitext admin seed
125
+ contitext serve --host 127.0.0.1 --port 18791
126
+ contitext mcp
127
+ ```
128
+
129
+ After installing the agent protocol in your MCP client, use these **chat
130
+ instructions** in a conversation with the agent:
131
+
132
+ ```text
133
+ !! contitext use demo
134
+ !! contitext status
135
+ !! contitext search publishing
136
+ !! contitext checkpoint Documented the publishing workflow.
137
+ ```
138
+
139
+ `!! contitext` is the canonical chat prefix. `!! ctx` is a shortcut, and
140
+ `!! context` remains a legacy alias. These are agent instructions, not terminal
141
+ subcommands. The terminal CLI currently runs and administers the service; it does
142
+ not implement chat actions such as `use`, `status`, or `search`, and it does not
143
+ set a global default project. See the [command reference](docs/commands.md) for
144
+ CLI options, compatibility entry points, and conversation scope behavior.
145
+
146
+ ## What it includes
147
+
148
+ - A durable, append-only event store with caller identity and source provenance.
149
+ - Reader, writer, and owner project ACLs shared by REST and MCP.
150
+ - Idempotent retries; conflicting reuse of an event key is rejected.
151
+ - PostgreSQL full-text retrieval with pagination, without an embedding dependency.
152
+ - Optional Markdown projection for local inspection and note-taking tools.
153
+ - Synthetic tests for isolation, concurrency, restart recovery, projection, and
154
+ real MCP stdio calls.
155
+
156
+ Use Contitext when you need explicit project continuity across tools and machines.
157
+ It does not automatically capture every conversation, consolidate memories, build
158
+ a knowledge graph, or decide which facts are true. A project handoff is the latest
159
+ handoff for the whole project, not a task scheduler or a conflict-resolution system.
160
+
161
+ ## Development
162
+
163
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the isolated PostgreSQL test setup.
164
+ See [SECURITY.md](SECURITY.md) for trust boundaries and vulnerability reporting.
165
+ Repository: [jessysw/contitext](https://github.com/jessysw/contitext).
166
+
167
+ ## License
168
+
169
+ [Apache License 2.0](LICENSE).
@@ -0,0 +1,136 @@
1
+ # Contitext
2
+
3
+ **Project continuity for AI agents.**
4
+
5
+ Keep project state, decisions, checkpoints, and handoffs available across agents,
6
+ sessions, and machines. Contitext is a small, self-hosted Python service backed by
7
+ PostgreSQL, with REST and six MCP tools. No LLM API key or embedding service is required.
8
+
9
+ An agent finishes a session by recording what changed and what comes next. Another
10
+ agent explicitly selects the same project, reads that context, and continues from
11
+ the recorded handoff.
12
+
13
+ **v0.5.1 is an early public release.** The core service is usable independently.
14
+ Companion integrations and broader memory features are on the [roadmap](docs/roadmap.md).
15
+
16
+ ## Quick start
17
+
18
+ Requires Docker with Compose, Python 3.11 or 3.12, and Git.
19
+
20
+ ```sh
21
+ git clone https://github.com/jessysw/contitext.git
22
+ cd contitext
23
+ python3 scripts/bootstrap.py
24
+ docker compose up --build -d --wait
25
+ curl --fail http://127.0.0.1:18791/health/ready
26
+ docker compose exec -T app python -m contitext.demo
27
+ ```
28
+
29
+ The bootstrap script creates fresh local credentials in a private `.env`, seeds a
30
+ `demo` project, and preserves existing configuration. The demo **writes synthetic
31
+ events to that project** and demonstrates two agents handing work over through
32
+ the real HTTP API. Its final output includes:
33
+
34
+ ```json
35
+ {
36
+ "agent_b_resumed": "demo",
37
+ "next_action": "Implement and test the first endpoint.",
38
+ "idempotent_retry": "passed"
39
+ }
40
+ ```
41
+
42
+ The API listens on localhost. PostgreSQL has no published host port. Data persists
43
+ in a Compose volume; `docker compose down` stops the service and preserves it.
44
+ See [installation](docs/installation.md) for Python-package setup, administration,
45
+ backup, and remote access.
46
+
47
+ ## Connect an MCP client
48
+
49
+ After the quick start, add this server to a client that supports stdio MCP. Replace
50
+ the directory with your own absolute checkout path:
51
+
52
+ ```json
53
+ {
54
+ "mcpServers": {
55
+ "contitext": {
56
+ "command": "docker",
57
+ "args": ["compose", "--project-directory", "/absolute/path/to/contitext", "exec", "-T", "app", "contitext", "mcp"]
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ Client configuration formats differ. The same command can be used by any stdio MCP
64
+ client. Load [the agent protocol](integrations/PROJECT-CONTEXT-PROTOCOL.md) into the
65
+ client's instruction mechanism and restart its MCP session. This release does not
66
+ automatically modify your agent settings. The MCP server runs locally inside the
67
+ existing app container and shares its database.
68
+
69
+ | Tool | Purpose |
70
+ | --- | --- |
71
+ | `project_bind` | Explicitly select a project for a caller's conversation scope |
72
+ | `project_current` | Read that scope's current project |
73
+ | `context_get` | Get a bounded project overview, checkpoint, questions, decisions, and handoff |
74
+ | `context_record` | Append a note, decision, question, or checkpoint with provenance |
75
+ | `context_handoff` | Record completed work, current work, blockers, and the next action |
76
+ | `context_search` | Search project events using PostgreSQL full-text search |
77
+
78
+ No project is inferred from the working directory or repository name. Each caller
79
+ uses a stable conversation scope and explicitly selects a project. Project ACLs
80
+ are enforced on the server. [API contracts and limits](docs/api.md) describe what
81
+ the server enforces and what the agent protocol requires.
82
+
83
+ ## Commands
84
+
85
+ Terminal commands use the `contitext` executable:
86
+
87
+ ```sh
88
+ contitext --help
89
+ contitext --version
90
+ contitext migrate
91
+ contitext admin seed
92
+ contitext serve --host 127.0.0.1 --port 18791
93
+ contitext mcp
94
+ ```
95
+
96
+ After installing the agent protocol in your MCP client, use these **chat
97
+ instructions** in a conversation with the agent:
98
+
99
+ ```text
100
+ !! contitext use demo
101
+ !! contitext status
102
+ !! contitext search publishing
103
+ !! contitext checkpoint Documented the publishing workflow.
104
+ ```
105
+
106
+ `!! contitext` is the canonical chat prefix. `!! ctx` is a shortcut, and
107
+ `!! context` remains a legacy alias. These are agent instructions, not terminal
108
+ subcommands. The terminal CLI currently runs and administers the service; it does
109
+ not implement chat actions such as `use`, `status`, or `search`, and it does not
110
+ set a global default project. See the [command reference](docs/commands.md) for
111
+ CLI options, compatibility entry points, and conversation scope behavior.
112
+
113
+ ## What it includes
114
+
115
+ - A durable, append-only event store with caller identity and source provenance.
116
+ - Reader, writer, and owner project ACLs shared by REST and MCP.
117
+ - Idempotent retries; conflicting reuse of an event key is rejected.
118
+ - PostgreSQL full-text retrieval with pagination, without an embedding dependency.
119
+ - Optional Markdown projection for local inspection and note-taking tools.
120
+ - Synthetic tests for isolation, concurrency, restart recovery, projection, and
121
+ real MCP stdio calls.
122
+
123
+ Use Contitext when you need explicit project continuity across tools and machines.
124
+ It does not automatically capture every conversation, consolidate memories, build
125
+ a knowledge graph, or decide which facts are true. A project handoff is the latest
126
+ handoff for the whole project, not a task scheduler or a conflict-resolution system.
127
+
128
+ ## Development
129
+
130
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the isolated PostgreSQL test setup.
131
+ See [SECURITY.md](SECURITY.md) for trust boundaries and vulnerability reporting.
132
+ Repository: [jessysw/contitext](https://github.com/jessysw/contitext).
133
+
134
+ ## License
135
+
136
+ [Apache License 2.0](LICENSE).
@@ -0,0 +1,21 @@
1
+ # Security
2
+
3
+ Contitext v0.5 is intended for trusted, self-hosted use. Report vulnerabilities
4
+ privately through the repository's GitHub security advisory reporting feature.
5
+ Do not include tokens, database dumps, personal conversations, or project secrets
6
+ in public issues. If private reporting is unavailable, open an issue requesting a
7
+ private contact without disclosing exploit details.
8
+
9
+ Bearer credentials authorize a server-side principal. Project reader/writer/owner
10
+ ACLs are checked for REST and MCP calls. Database credentials, Docker access, and
11
+ the seed administrator are trusted administrative capabilities. This release has
12
+ no OAuth authorization server, browser login, per-token expiry, encryption at rest,
13
+ or hosted-tenant management. Rotate tokens through configuration and restart
14
+ affected processes. Use TLS for HTTP access outside localhost.
15
+
16
+ Store credentials and backups outside Git. Events can contain sensitive project
17
+ content; they are not automatically redacted. Scope selection and lifecycle limits
18
+ are documented in [API contracts](docs/api.md). Review them before enabling clients.
19
+
20
+ The first public release is supported on a best-effort basis; security fixes will
21
+ target the latest release. Do not assume older versions receive backports.
@@ -0,0 +1,39 @@
1
+ [alembic]
2
+ script_location = src/contitext/migrations
3
+ prepend_sys_path = src
4
+ path_separator = os
5
+ sqlalchemy.url = driver://unused
6
+
7
+ [loggers]
8
+ keys = root,sqlalchemy,alembic
9
+
10
+ [handlers]
11
+ keys = console
12
+
13
+ [formatters]
14
+ keys = generic
15
+
16
+ [logger_root]
17
+ level = WARN
18
+ handlers = console
19
+ qualname =
20
+
21
+ [logger_sqlalchemy]
22
+ level = WARN
23
+ handlers =
24
+ qualname = sqlalchemy.engine
25
+
26
+ [logger_alembic]
27
+ level = INFO
28
+ handlers =
29
+ qualname = alembic
30
+
31
+ [handler_console]
32
+ class = StreamHandler
33
+ args = (sys.stderr,)
34
+ level = NOTSET
35
+ formatter = generic
36
+
37
+ [formatter_generic]
38
+ format = %(levelname)-5.5s [%(name)s] %(message)s
39
+ datefmt = %H:%M:%S