project-corpus 2.0.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 (41) hide show
  1. project_corpus-2.0.1/LICENSE +21 -0
  2. project_corpus-2.0.1/PKG-INFO +271 -0
  3. project_corpus-2.0.1/README.md +248 -0
  4. project_corpus-2.0.1/pyproject.toml +39 -0
  5. project_corpus-2.0.1/setup.cfg +4 -0
  6. project_corpus-2.0.1/src/project_corpus/__init__.py +3 -0
  7. project_corpus-2.0.1/src/project_corpus/authority.py +75 -0
  8. project_corpus-2.0.1/src/project_corpus/cli.py +429 -0
  9. project_corpus-2.0.1/src/project_corpus/compatibility.py +147 -0
  10. project_corpus-2.0.1/src/project_corpus/doctor.py +107 -0
  11. project_corpus-2.0.1/src/project_corpus/mcp_stdio.py +304 -0
  12. project_corpus-2.0.1/src/project_corpus/migration.py +522 -0
  13. project_corpus-2.0.1/src/project_corpus/platform/__init__.py +4 -0
  14. project_corpus-2.0.1/src/project_corpus/platform/base.py +99 -0
  15. project_corpus-2.0.1/src/project_corpus/platform/common.py +55 -0
  16. project_corpus-2.0.1/src/project_corpus/platform/factory.py +18 -0
  17. project_corpus-2.0.1/src/project_corpus/platform/posix.py +639 -0
  18. project_corpus-2.0.1/src/project_corpus/platform/windows.py +766 -0
  19. project_corpus-2.0.1/src/project_corpus/policy.py +137 -0
  20. project_corpus-2.0.1/src/project_corpus/security_scan.py +206 -0
  21. project_corpus-2.0.1/src/project_corpus/transactions.py +691 -0
  22. project_corpus-2.0.1/src/project_corpus/trust.py +204 -0
  23. project_corpus-2.0.1/src/project_corpus/validation.py +212 -0
  24. project_corpus-2.0.1/src/project_corpus.egg-info/PKG-INFO +271 -0
  25. project_corpus-2.0.1/src/project_corpus.egg-info/SOURCES.txt +39 -0
  26. project_corpus-2.0.1/src/project_corpus.egg-info/dependency_links.txt +1 -0
  27. project_corpus-2.0.1/src/project_corpus.egg-info/entry_points.txt +2 -0
  28. project_corpus-2.0.1/src/project_corpus.egg-info/top_level.txt +1 -0
  29. project_corpus-2.0.1/tests/test_bilingual_templates.py +100 -0
  30. project_corpus-2.0.1/tests/test_cli.py +221 -0
  31. project_corpus-2.0.1/tests/test_doctor.py +107 -0
  32. project_corpus-2.0.1/tests/test_filesystem_security_prototypes.py +342 -0
  33. project_corpus-2.0.1/tests/test_mcp_stdio.py +152 -0
  34. project_corpus-2.0.1/tests/test_migration_apply.py +167 -0
  35. project_corpus-2.0.1/tests/test_native_path_backend.py +272 -0
  36. project_corpus-2.0.1/tests/test_policy_trust.py +146 -0
  37. project_corpus-2.0.1/tests/test_protocol_v2_conformance.py +137 -0
  38. project_corpus-2.0.1/tests/test_repository.py +95 -0
  39. project_corpus-2.0.1/tests/test_security_scan.py +89 -0
  40. project_corpus-2.0.1/tests/test_transactions.py +411 -0
  41. project_corpus-2.0.1/tests/test_v1_compatibility.py +89 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Project Corpus 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,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: project-corpus
3
+ Version: 2.0.1
4
+ Summary: Optional reference Runtime for Project Corpus Protocol
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/darksleep1983/project-corpus
7
+ Project-URL: Documentation, https://darksleep1983.github.io/project-corpus/
8
+ Project-URL: Repository, https://github.com/darksleep1983/project-corpus
9
+ Project-URL: Issues, https://github.com/darksleep1983/project-corpus/issues
10
+ Project-URL: Changelog, https://github.com/darksleep1983/project-corpus/blob/main/CHANGELOG.md
11
+ Keywords: ai-agents,markdown,mcp,project-memory,project-state
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Dynamic: license-file
23
+
24
+ # Project Corpus
25
+
26
+ [Русская версия](README.ru.md)
27
+
28
+ [![CI](https://github.com/darksleep1983/project-corpus/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/darksleep1983/project-corpus/actions/workflows/test.yml)
29
+ [![Docs build](https://github.com/darksleep1983/project-corpus/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/darksleep1983/project-corpus/actions/workflows/docs.yml)
30
+ [![Python](https://img.shields.io/badge/python-3.11%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
31
+ [![License](https://img.shields.io/badge/license-MIT-66d9c2)](LICENSE)
32
+ [![Release](https://img.shields.io/github/v/release/darksleep1983/project-corpus?display_name=tag&sort=semver)](https://github.com/darksleep1983/project-corpus/releases)
33
+
34
+ **Persistent project state and authority for AI agents.**
35
+
36
+ Project Corpus is a Markdown-first, vendor-neutral protocol that lets ChatGPT,
37
+ Codex, Claude, and other AI agents resume a project from clean context without
38
+ relying on chat memory.
39
+
40
+ It records the project's canonical identity, current state, evidence, exact
41
+ next action, and authority boundaries in files that remain available when an
42
+ AI session ends. The [Protocol](protocol/v2/README.md) needs only Markdown; the
43
+ [optional Runtime](docs/runtime/cli.md) adds technical enforcement.
44
+
45
+ ```mermaid
46
+ flowchart LR
47
+ subgraph without_corpus["Without Project Corpus"]
48
+ direction TB
49
+ A1["AI Session A"] --> M["chat memory / ad-hoc notes"]
50
+ M --> E["session ends"]
51
+ E --> B1["AI Session B"]
52
+ B1 --> I["reconstruct from incomplete context"]
53
+ end
54
+ subgraph with_corpus["With Project Corpus"]
55
+ direction TB
56
+ A2["AI Session A"] --> C["Project Corpus"]
57
+ C --> P["PROJECT.md — what the project is"]
58
+ C --> S["STATUS.md — where the project is now"]
59
+ C --> T["Tasks — authorized work"]
60
+ C --> R["Reports — evidence"]
61
+ C --> Y["Policy — project-side limits"]
62
+ C --> B2["AI Session B"]
63
+ B2 --> L["load canonical state"]
64
+ L --> N["continue from exact next action"]
65
+ end
66
+ ```
67
+
68
+ > AI sessions are disposable. Project state is not.
69
+
70
+ ## More than a memory bank
71
+
72
+ A memory bank helps an agent remember information. Project Corpus additionally
73
+ defines what is canonical, what is current, what counts as evidence, what comes
74
+ next, and who may change state.
75
+
76
+ ## 60-second Quick Start
77
+
78
+ No Runtime, MCP server, or package installation is required.
79
+
80
+ 1. Download or clone this repository.
81
+ 2. Copy the contents of [`templates/v2/minimal/`](templates/v2/minimal/) into
82
+ the root of your project. From a repository checkout:
83
+
84
+ macOS/Linux:
85
+
86
+ ```sh
87
+ cp -R templates/v2/minimal/. /path/to/your-project/
88
+ ```
89
+
90
+ PowerShell:
91
+
92
+ ```powershell
93
+ Copy-Item -Force .\templates\v2\minimal\AGENTS.md C:\path\to\your-project\
94
+ Copy-Item -Recurse -Force .\templates\v2\minimal\.project-corpus C:\path\to\your-project\
95
+ ```
96
+
97
+ 3. Fill in [`.project-corpus/state/PROJECT.md`](templates/v2/minimal/.project-corpus/state/PROJECT.md)
98
+ with the project ID and durable project identity.
99
+ 4. Fill in [`.project-corpus/state/STATUS.md`](templates/v2/minimal/.project-corpus/state/STATUS.md)
100
+ with the same project ID, verified baseline, blockers, evidence references,
101
+ and exact next action.
102
+ 5. Give ChatGPT, Codex, Claude, or another agent access to the project folder.
103
+ In a manual chat, upload `AGENTS.md`, `PROJECT.md`, and `STATUS.md`. If you
104
+ are uploading files manually, also upload the active Task and any Reports
105
+ referenced by `STATUS.md`. Then say:
106
+
107
+ > Load Project Corpus for this project. Follow `AGENTS.md`; read
108
+ > `.project-corpus/state/PROJECT.md` and
109
+ > `.project-corpus/state/STATUS.md` completely; if an active Task or cited
110
+ > Reports are available, load only those relevant artifacts; state the
111
+ > project ID, current status, active Task, and exact next action; then
112
+ > continue from that action.
113
+
114
+ ### Want enforcement too?
115
+
116
+ The optional Runtime is currently installed from a local clone, not from PyPI:
117
+
118
+ ```sh
119
+ git clone https://github.com/darksleep1983/project-corpus.git
120
+ cd project-corpus
121
+ python -m pip install .
122
+ project-corpus validate /path/to/your-project
123
+ project-corpus doctor /path/to/your-project
124
+ ```
125
+
126
+ It adds validation/doctor, external owner trust, policy enforcement,
127
+ expected-hash transactions, audit/recovery, and optional local stdio MCP.
128
+ Controlled writes require an external owner trust grant; follow the
129
+ [Runtime CLI guide](docs/runtime/cli.md) rather than treating project content as
130
+ authority.
131
+
132
+ ## Protocol and Runtime
133
+
134
+ | Project Corpus Protocol | Optional Project Corpus Runtime |
135
+ | --- | --- |
136
+ | Markdown-first and vendor-neutral | Validation and controlled CLI |
137
+ | No installation or database | External owner trust and policy enforcement |
138
+ | Manual workflow supported | Verified writes and audit/recovery |
139
+ | MCP optional | Optional local stdio MCP |
140
+
141
+ The Protocol is the portable product contract. The Runtime implements it but
142
+ does not define or silently amend it. Enforced guarantees apply only in
143
+ controlled modes on the qualified local filesystems listed in the
144
+ [platform matrix](docs/security/platform-guarantees.md).
145
+
146
+ ## Maintained V1 workflow
147
+
148
+ The original V1 workflow remains available for existing projects. Its template
149
+ contains:
150
+
151
+ ```text
152
+ AGENTS.md
153
+ OPERATOR_PROFILE.md
154
+ PROJECT_ROADMAP_CURRENT.md
155
+ CORPUS_ACCESS_CURRENT.md
156
+ LOADER_PROMPT_CURRENT.md
157
+ SESSION_HANDOFF_CURRENT.md
158
+ SESSION_HANDOFF_FULL_CURRENT.md
159
+ Tasks/
160
+ Report/
161
+ ```
162
+
163
+ `AGENTS.md` defines the rules. The roadmap and handoffs preserve current state.
164
+ `Tasks/` contains scoped work orders; `Report/` contains evidence of completed
165
+ work.
166
+
167
+ ## Choose one V1 access mode
168
+
169
+ | Mode | Best for | What happens |
170
+ | --- | --- | --- |
171
+ | Direct folder | Codex, Claude Code, ChatGPT Work, and other local agents | Give the client access only to the Corpus folder and let it read or update the files directly. |
172
+ | Your own MCP | Clients that support an MCP server or file connector | Connect a trusted server of your choice, restrict it to the Corpus root, and record its real capabilities. |
173
+ | Manual session | Any AI chat, with no setup | Upload the seven current files at the start; at the end, save only the replacement files the AI returns. |
174
+
175
+ The three modes use the same protocol. An unavailable MCP server is not a
176
+ blocker: switch to direct-folder or manual access.
177
+
178
+ Read the detailed guides:
179
+
180
+ - [Direct folder](docs/access/direct-folder.md)
181
+ - [Your own MCP](docs/access/own-mcp.md)
182
+ - [Manual sessions](docs/access/manual.md)
183
+
184
+ ## V1 five-minute start
185
+
186
+ 1. Download or clone this repository.
187
+ 2. Copy one language folder to a safe location and name it `Corpus`:
188
+ - `template/en` for English;
189
+ - `template/ru` for Russian.
190
+ 3. Open `CORPUS_ACCESS_CURRENT.md` and choose an access mode.
191
+ 4. Give your AI the matching text from
192
+ [`PROJECT_INSTRUCTION_TEMPLATE.md`](PROJECT_INSTRUCTION_TEMPLATE.md).
193
+ 5. Say what you want to build in normal language.
194
+
195
+ Example:
196
+
197
+ > Start a new project. I want to build a local photo organizer. First help me
198
+ > define the architecture. Do not install, delete, publish, or contact anyone.
199
+
200
+ ## Client guides
201
+
202
+ - [ChatGPT](docs/clients/chatgpt.md)
203
+ - [Codex](docs/clients/codex.md)
204
+ - [Claude Code](docs/clients/claude-code.md)
205
+ - [Claude Desktop](docs/clients/claude-desktop.md)
206
+ - [Other AI clients](docs/clients/other-clients.md)
207
+
208
+ Client interfaces and plan availability can change. Each guide keeps volatile
209
+ client setup separate from the stable Corpus protocol and links to official
210
+ documentation.
211
+
212
+ ## V1 manual mode really works
213
+
214
+ If you do not want to configure local folders or MCP:
215
+
216
+ 1. upload the seven current files in a new session;
217
+ 2. upload only the Tasks and Reports relevant to the request;
218
+ 3. ask the AI to read `AGENTS.md` first and issue a loading receipt;
219
+ 4. work normally;
220
+ 5. ask for a manual synchronization package;
221
+ 6. back up the old local files and save the returned replacements.
222
+
223
+ Ordinary synchronization must not rewrite `AGENTS.md` or
224
+ `OPERATOR_PROFILE.md`. The AI should return only files that actually changed and
225
+ must not claim that it saved them on your computer.
226
+
227
+ ## Important limits
228
+
229
+ Manual and direct-folder modes are not enforced Runtime modes. Controlled
230
+ Runtime guarantees are scoped to documented operations on qualified local
231
+ NTFS, ext4, and APFS filesystems; read the [security model](docs/security.md)
232
+ for the complete boundaries.
233
+
234
+ - Project Corpus is a documentation protocol, not a security sandbox.
235
+ - Real access is controlled by your AI client, filesystem permissions, or your
236
+ chosen MCP server.
237
+ - V1 direct-folder and manual workflows do not gain Runtime enforcement.
238
+ - The optional V2 Runtime provides local CLI and stdio MCP only; it does not
239
+ provide HTTP/remote MCP or audit third-party servers.
240
+ - A saved Report is not proof that a service or external system is currently
241
+ healthy.
242
+ - Do not store passwords, tokens, cookies, seed phrases, or API keys in the
243
+ Corpus.
244
+ - Keep one active project per Corpus.
245
+
246
+ More: [how it works](docs/how-it-works.md), [FAQ](docs/faq.md),
247
+ [security model](docs/security.md), [languages](docs/languages.md), and
248
+ [moving or removing a Corpus](docs/uninstall.md).
249
+
250
+ ## Current status
251
+
252
+ Project Corpus V2 is the current open-source generation. The bilingual
253
+ templates, three access modes, documentation links, repository integrity and
254
+ optional Runtime are checked automatically. Release changes are recorded in
255
+ the [changelog](CHANGELOG.md).
256
+
257
+ ## Feedback
258
+
259
+ Use [GitHub Issues](https://github.com/darksleep1983/project-corpus/issues) for
260
+ bugs, setup questions, and improvement ideas. Do not post secrets or private
261
+ Corpus contents.
262
+
263
+ ## Support the project
264
+
265
+ Project Corpus is free and MIT-licensed. Voluntary support is available through
266
+ USDT on TON; see the [support page and wallet address](SUPPORT.md). A donation is
267
+ not a purchase and does not provide additional rights or guarantees.
268
+
269
+ ## License
270
+
271
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,248 @@
1
+ # Project Corpus
2
+
3
+ [Русская версия](README.ru.md)
4
+
5
+ [![CI](https://github.com/darksleep1983/project-corpus/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/darksleep1983/project-corpus/actions/workflows/test.yml)
6
+ [![Docs build](https://github.com/darksleep1983/project-corpus/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/darksleep1983/project-corpus/actions/workflows/docs.yml)
7
+ [![Python](https://img.shields.io/badge/python-3.11%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
8
+ [![License](https://img.shields.io/badge/license-MIT-66d9c2)](LICENSE)
9
+ [![Release](https://img.shields.io/github/v/release/darksleep1983/project-corpus?display_name=tag&sort=semver)](https://github.com/darksleep1983/project-corpus/releases)
10
+
11
+ **Persistent project state and authority for AI agents.**
12
+
13
+ Project Corpus is a Markdown-first, vendor-neutral protocol that lets ChatGPT,
14
+ Codex, Claude, and other AI agents resume a project from clean context without
15
+ relying on chat memory.
16
+
17
+ It records the project's canonical identity, current state, evidence, exact
18
+ next action, and authority boundaries in files that remain available when an
19
+ AI session ends. The [Protocol](protocol/v2/README.md) needs only Markdown; the
20
+ [optional Runtime](docs/runtime/cli.md) adds technical enforcement.
21
+
22
+ ```mermaid
23
+ flowchart LR
24
+ subgraph without_corpus["Without Project Corpus"]
25
+ direction TB
26
+ A1["AI Session A"] --> M["chat memory / ad-hoc notes"]
27
+ M --> E["session ends"]
28
+ E --> B1["AI Session B"]
29
+ B1 --> I["reconstruct from incomplete context"]
30
+ end
31
+ subgraph with_corpus["With Project Corpus"]
32
+ direction TB
33
+ A2["AI Session A"] --> C["Project Corpus"]
34
+ C --> P["PROJECT.md — what the project is"]
35
+ C --> S["STATUS.md — where the project is now"]
36
+ C --> T["Tasks — authorized work"]
37
+ C --> R["Reports — evidence"]
38
+ C --> Y["Policy — project-side limits"]
39
+ C --> B2["AI Session B"]
40
+ B2 --> L["load canonical state"]
41
+ L --> N["continue from exact next action"]
42
+ end
43
+ ```
44
+
45
+ > AI sessions are disposable. Project state is not.
46
+
47
+ ## More than a memory bank
48
+
49
+ A memory bank helps an agent remember information. Project Corpus additionally
50
+ defines what is canonical, what is current, what counts as evidence, what comes
51
+ next, and who may change state.
52
+
53
+ ## 60-second Quick Start
54
+
55
+ No Runtime, MCP server, or package installation is required.
56
+
57
+ 1. Download or clone this repository.
58
+ 2. Copy the contents of [`templates/v2/minimal/`](templates/v2/minimal/) into
59
+ the root of your project. From a repository checkout:
60
+
61
+ macOS/Linux:
62
+
63
+ ```sh
64
+ cp -R templates/v2/minimal/. /path/to/your-project/
65
+ ```
66
+
67
+ PowerShell:
68
+
69
+ ```powershell
70
+ Copy-Item -Force .\templates\v2\minimal\AGENTS.md C:\path\to\your-project\
71
+ Copy-Item -Recurse -Force .\templates\v2\minimal\.project-corpus C:\path\to\your-project\
72
+ ```
73
+
74
+ 3. Fill in [`.project-corpus/state/PROJECT.md`](templates/v2/minimal/.project-corpus/state/PROJECT.md)
75
+ with the project ID and durable project identity.
76
+ 4. Fill in [`.project-corpus/state/STATUS.md`](templates/v2/minimal/.project-corpus/state/STATUS.md)
77
+ with the same project ID, verified baseline, blockers, evidence references,
78
+ and exact next action.
79
+ 5. Give ChatGPT, Codex, Claude, or another agent access to the project folder.
80
+ In a manual chat, upload `AGENTS.md`, `PROJECT.md`, and `STATUS.md`. If you
81
+ are uploading files manually, also upload the active Task and any Reports
82
+ referenced by `STATUS.md`. Then say:
83
+
84
+ > Load Project Corpus for this project. Follow `AGENTS.md`; read
85
+ > `.project-corpus/state/PROJECT.md` and
86
+ > `.project-corpus/state/STATUS.md` completely; if an active Task or cited
87
+ > Reports are available, load only those relevant artifacts; state the
88
+ > project ID, current status, active Task, and exact next action; then
89
+ > continue from that action.
90
+
91
+ ### Want enforcement too?
92
+
93
+ The optional Runtime is currently installed from a local clone, not from PyPI:
94
+
95
+ ```sh
96
+ git clone https://github.com/darksleep1983/project-corpus.git
97
+ cd project-corpus
98
+ python -m pip install .
99
+ project-corpus validate /path/to/your-project
100
+ project-corpus doctor /path/to/your-project
101
+ ```
102
+
103
+ It adds validation/doctor, external owner trust, policy enforcement,
104
+ expected-hash transactions, audit/recovery, and optional local stdio MCP.
105
+ Controlled writes require an external owner trust grant; follow the
106
+ [Runtime CLI guide](docs/runtime/cli.md) rather than treating project content as
107
+ authority.
108
+
109
+ ## Protocol and Runtime
110
+
111
+ | Project Corpus Protocol | Optional Project Corpus Runtime |
112
+ | --- | --- |
113
+ | Markdown-first and vendor-neutral | Validation and controlled CLI |
114
+ | No installation or database | External owner trust and policy enforcement |
115
+ | Manual workflow supported | Verified writes and audit/recovery |
116
+ | MCP optional | Optional local stdio MCP |
117
+
118
+ The Protocol is the portable product contract. The Runtime implements it but
119
+ does not define or silently amend it. Enforced guarantees apply only in
120
+ controlled modes on the qualified local filesystems listed in the
121
+ [platform matrix](docs/security/platform-guarantees.md).
122
+
123
+ ## Maintained V1 workflow
124
+
125
+ The original V1 workflow remains available for existing projects. Its template
126
+ contains:
127
+
128
+ ```text
129
+ AGENTS.md
130
+ OPERATOR_PROFILE.md
131
+ PROJECT_ROADMAP_CURRENT.md
132
+ CORPUS_ACCESS_CURRENT.md
133
+ LOADER_PROMPT_CURRENT.md
134
+ SESSION_HANDOFF_CURRENT.md
135
+ SESSION_HANDOFF_FULL_CURRENT.md
136
+ Tasks/
137
+ Report/
138
+ ```
139
+
140
+ `AGENTS.md` defines the rules. The roadmap and handoffs preserve current state.
141
+ `Tasks/` contains scoped work orders; `Report/` contains evidence of completed
142
+ work.
143
+
144
+ ## Choose one V1 access mode
145
+
146
+ | Mode | Best for | What happens |
147
+ | --- | --- | --- |
148
+ | Direct folder | Codex, Claude Code, ChatGPT Work, and other local agents | Give the client access only to the Corpus folder and let it read or update the files directly. |
149
+ | Your own MCP | Clients that support an MCP server or file connector | Connect a trusted server of your choice, restrict it to the Corpus root, and record its real capabilities. |
150
+ | Manual session | Any AI chat, with no setup | Upload the seven current files at the start; at the end, save only the replacement files the AI returns. |
151
+
152
+ The three modes use the same protocol. An unavailable MCP server is not a
153
+ blocker: switch to direct-folder or manual access.
154
+
155
+ Read the detailed guides:
156
+
157
+ - [Direct folder](docs/access/direct-folder.md)
158
+ - [Your own MCP](docs/access/own-mcp.md)
159
+ - [Manual sessions](docs/access/manual.md)
160
+
161
+ ## V1 five-minute start
162
+
163
+ 1. Download or clone this repository.
164
+ 2. Copy one language folder to a safe location and name it `Corpus`:
165
+ - `template/en` for English;
166
+ - `template/ru` for Russian.
167
+ 3. Open `CORPUS_ACCESS_CURRENT.md` and choose an access mode.
168
+ 4. Give your AI the matching text from
169
+ [`PROJECT_INSTRUCTION_TEMPLATE.md`](PROJECT_INSTRUCTION_TEMPLATE.md).
170
+ 5. Say what you want to build in normal language.
171
+
172
+ Example:
173
+
174
+ > Start a new project. I want to build a local photo organizer. First help me
175
+ > define the architecture. Do not install, delete, publish, or contact anyone.
176
+
177
+ ## Client guides
178
+
179
+ - [ChatGPT](docs/clients/chatgpt.md)
180
+ - [Codex](docs/clients/codex.md)
181
+ - [Claude Code](docs/clients/claude-code.md)
182
+ - [Claude Desktop](docs/clients/claude-desktop.md)
183
+ - [Other AI clients](docs/clients/other-clients.md)
184
+
185
+ Client interfaces and plan availability can change. Each guide keeps volatile
186
+ client setup separate from the stable Corpus protocol and links to official
187
+ documentation.
188
+
189
+ ## V1 manual mode really works
190
+
191
+ If you do not want to configure local folders or MCP:
192
+
193
+ 1. upload the seven current files in a new session;
194
+ 2. upload only the Tasks and Reports relevant to the request;
195
+ 3. ask the AI to read `AGENTS.md` first and issue a loading receipt;
196
+ 4. work normally;
197
+ 5. ask for a manual synchronization package;
198
+ 6. back up the old local files and save the returned replacements.
199
+
200
+ Ordinary synchronization must not rewrite `AGENTS.md` or
201
+ `OPERATOR_PROFILE.md`. The AI should return only files that actually changed and
202
+ must not claim that it saved them on your computer.
203
+
204
+ ## Important limits
205
+
206
+ Manual and direct-folder modes are not enforced Runtime modes. Controlled
207
+ Runtime guarantees are scoped to documented operations on qualified local
208
+ NTFS, ext4, and APFS filesystems; read the [security model](docs/security.md)
209
+ for the complete boundaries.
210
+
211
+ - Project Corpus is a documentation protocol, not a security sandbox.
212
+ - Real access is controlled by your AI client, filesystem permissions, or your
213
+ chosen MCP server.
214
+ - V1 direct-folder and manual workflows do not gain Runtime enforcement.
215
+ - The optional V2 Runtime provides local CLI and stdio MCP only; it does not
216
+ provide HTTP/remote MCP or audit third-party servers.
217
+ - A saved Report is not proof that a service or external system is currently
218
+ healthy.
219
+ - Do not store passwords, tokens, cookies, seed phrases, or API keys in the
220
+ Corpus.
221
+ - Keep one active project per Corpus.
222
+
223
+ More: [how it works](docs/how-it-works.md), [FAQ](docs/faq.md),
224
+ [security model](docs/security.md), [languages](docs/languages.md), and
225
+ [moving or removing a Corpus](docs/uninstall.md).
226
+
227
+ ## Current status
228
+
229
+ Project Corpus V2 is the current open-source generation. The bilingual
230
+ templates, three access modes, documentation links, repository integrity and
231
+ optional Runtime are checked automatically. Release changes are recorded in
232
+ the [changelog](CHANGELOG.md).
233
+
234
+ ## Feedback
235
+
236
+ Use [GitHub Issues](https://github.com/darksleep1983/project-corpus/issues) for
237
+ bugs, setup questions, and improvement ideas. Do not post secrets or private
238
+ Corpus contents.
239
+
240
+ ## Support the project
241
+
242
+ Project Corpus is free and MIT-licensed. Voluntary support is available through
243
+ USDT on TON; see the [support page and wallet address](SUPPORT.md). A donation is
244
+ not a purchase and does not provide additional rights or guarantees.
245
+
246
+ ## License
247
+
248
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "project-corpus"
7
+ version = "2.0.1"
8
+ description = "Optional reference Runtime for Project Corpus Protocol"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ keywords = ["ai-agents", "markdown", "mcp", "project-memory", "project-state"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Topic :: Software Development :: Libraries",
22
+ ]
23
+ dependencies = []
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/darksleep1983/project-corpus"
27
+ Documentation = "https://darksleep1983.github.io/project-corpus/"
28
+ Repository = "https://github.com/darksleep1983/project-corpus"
29
+ Issues = "https://github.com/darksleep1983/project-corpus/issues"
30
+ Changelog = "https://github.com/darksleep1983/project-corpus/blob/main/CHANGELOG.md"
31
+
32
+ [project.scripts]
33
+ project-corpus = "project_corpus.cli:main"
34
+
35
+ [tool.setuptools]
36
+ package-dir = { "" = "src" }
37
+
38
+ [tool.setuptools.packages.find]
39
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Optional reference Runtime for Project Corpus Protocol."""
2
+
3
+ __version__ = "2.0.1"
@@ -0,0 +1,75 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from .policy import ProjectPolicy
6
+ from .trust import TrustGrant
7
+
8
+
9
+ RUNTIME_HARD_LIMITS = frozenset({
10
+ "corpus.read", "corpus.stat", "corpus.validate", "migration.plan",
11
+ "migration.apply", "state.update", "task.create", "report.create",
12
+ "audit.read", "mcp.stdio", "git.status", "git.diff",
13
+ })
14
+ DIAGNOSTIC_CAPABILITIES = frozenset({"corpus.validate"})
15
+ READ_ONLY_CAPABILITIES = frozenset({
16
+ "corpus.read", "corpus.stat", "corpus.validate", "migration.plan",
17
+ "audit.read", "git.status", "git.diff",
18
+ })
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class AuthorityDecision:
23
+ effective: frozenset[str]
24
+ denied: frozenset[str]
25
+ policy_drift: bool
26
+ root_identity_match: bool
27
+ transport_allowed: bool
28
+ reasons: tuple[str, ...]
29
+
30
+ def permits(self, capability: str) -> bool:
31
+ return capability in self.effective
32
+
33
+
34
+ def evaluate_authority(
35
+ *,
36
+ trust: TrustGrant,
37
+ policy: ProjectPolicy,
38
+ session_capabilities: set[str] | frozenset[str],
39
+ observed_root_identity: str,
40
+ transport: str,
41
+ runtime_hard_limits: frozenset[str] = RUNTIME_HARD_LIMITS,
42
+ ) -> AuthorityDecision:
43
+ requested = frozenset(session_capabilities)
44
+ reasons: list[str] = []
45
+ policy_drift = trust.policy_sha256 != policy.digest
46
+ root_match = trust.root_identity == observed_root_identity
47
+ transport_allowed = transport in trust.transports
48
+ if trust.project_id != policy.project_id:
49
+ return AuthorityDecision(
50
+ frozenset(), requested, policy_drift, root_match,
51
+ transport_allowed, ("PROJECT_ID_MISMATCH",),
52
+ )
53
+
54
+ effective = (
55
+ runtime_hard_limits & trust.capability_ceiling & policy.capabilities & requested
56
+ )
57
+ if policy_drift:
58
+ effective &= READ_ONLY_CAPABILITIES
59
+ reasons.append("POLICY_DRIFT")
60
+ if not root_match:
61
+ effective &= DIAGNOSTIC_CAPABILITIES
62
+ reasons.append("ROOT_IDENTITY_MISMATCH")
63
+ if not transport_allowed:
64
+ effective = frozenset()
65
+ reasons.append("TRANSPORT_NOT_GRANTED")
66
+ if requested - runtime_hard_limits:
67
+ reasons.append("RUNTIME_HARD_LIMIT")
68
+ if requested - trust.capability_ceiling:
69
+ reasons.append("OWNER_GRANT_LIMIT")
70
+ if requested - policy.capabilities:
71
+ reasons.append("PROJECT_POLICY_LIMIT")
72
+ return AuthorityDecision(
73
+ frozenset(effective), frozenset(requested - effective), policy_drift,
74
+ root_match, transport_allowed, tuple(dict.fromkeys(reasons)),
75
+ )