incierge 0.2.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 (55) hide show
  1. incierge-0.2.0/LICENSE +202 -0
  2. incierge-0.2.0/NOTICE +32 -0
  3. incierge-0.2.0/PKG-INFO +348 -0
  4. incierge-0.2.0/README.md +324 -0
  5. incierge-0.2.0/pyproject.toml +41 -0
  6. incierge-0.2.0/setup.cfg +4 -0
  7. incierge-0.2.0/src/incierge/__init__.py +5 -0
  8. incierge-0.2.0/src/incierge/adapter/__init__.py +85 -0
  9. incierge-0.2.0/src/incierge/adapter/anthropic.py +154 -0
  10. incierge-0.2.0/src/incierge/adapter/base.py +168 -0
  11. incierge-0.2.0/src/incierge/adapter/gemini.py +168 -0
  12. incierge-0.2.0/src/incierge/adapter/local.py +64 -0
  13. incierge-0.2.0/src/incierge/adapter/openai.py +161 -0
  14. incierge-0.2.0/src/incierge/broker/__init__.py +3 -0
  15. incierge-0.2.0/src/incierge/broker/lock.py +247 -0
  16. incierge-0.2.0/src/incierge/capacity/__init__.py +32 -0
  17. incierge-0.2.0/src/incierge/capacity/router.py +274 -0
  18. incierge-0.2.0/src/incierge/cli.py +559 -0
  19. incierge-0.2.0/src/incierge/core/__init__.py +3 -0
  20. incierge-0.2.0/src/incierge/core/sprint.py +97 -0
  21. incierge-0.2.0/src/incierge/gate/__init__.py +3 -0
  22. incierge-0.2.0/src/incierge/gate/selfcheck.py +144 -0
  23. incierge-0.2.0/src/incierge/guard/__init__.py +24 -0
  24. incierge-0.2.0/src/incierge/guard/mcp_server.py +564 -0
  25. incierge-0.2.0/src/incierge/harness/__init__.py +28 -0
  26. incierge-0.2.0/src/incierge/harness/hook_chain.py +306 -0
  27. incierge-0.2.0/src/incierge/harness/hook_runner.py +92 -0
  28. incierge-0.2.0/src/incierge/harness/installer.py +199 -0
  29. incierge-0.2.0/src/incierge/kernel/__init__.py +18 -0
  30. incierge-0.2.0/src/incierge/kernel/bridge.py +140 -0
  31. incierge-0.2.0/src/incierge/loop/__init__.py +36 -0
  32. incierge-0.2.0/src/incierge/loop/engine.py +614 -0
  33. incierge-0.2.0/src/incierge/review/__init__.py +24 -0
  34. incierge-0.2.0/src/incierge/review/contract.py +249 -0
  35. incierge-0.2.0/src/incierge/sandbox/__init__.py +12 -0
  36. incierge-0.2.0/src/incierge/sandbox/hook.py +116 -0
  37. incierge-0.2.0/src/incierge/sandbox/interceptor.py +589 -0
  38. incierge-0.2.0/src/incierge/sandbox/mcp.py +244 -0
  39. incierge-0.2.0/src/incierge.egg-info/PKG-INFO +348 -0
  40. incierge-0.2.0/src/incierge.egg-info/SOURCES.txt +53 -0
  41. incierge-0.2.0/src/incierge.egg-info/dependency_links.txt +1 -0
  42. incierge-0.2.0/src/incierge.egg-info/entry_points.txt +4 -0
  43. incierge-0.2.0/src/incierge.egg-info/top_level.txt +1 -0
  44. incierge-0.2.0/tests/test_adapter.py +373 -0
  45. incierge-0.2.0/tests/test_broker.py +96 -0
  46. incierge-0.2.0/tests/test_broker_unknown_holder.py +114 -0
  47. incierge-0.2.0/tests/test_cleanroom.py +126 -0
  48. incierge-0.2.0/tests/test_cli.py +76 -0
  49. incierge-0.2.0/tests/test_cli_sandbox_forms.py +60 -0
  50. incierge-0.2.0/tests/test_examples.py +86 -0
  51. incierge-0.2.0/tests/test_gate.py +53 -0
  52. incierge-0.2.0/tests/test_open_core_subsystems.py +557 -0
  53. incierge-0.2.0/tests/test_sandbox.py +190 -0
  54. incierge-0.2.0/tests/test_sandbox_hook.py +113 -0
  55. incierge-0.2.0/tests/test_sandbox_mcp.py +188 -0
incierge-0.2.0/LICENSE ADDED
@@ -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.
incierge-0.2.0/NOTICE ADDED
@@ -0,0 +1,32 @@
1
+ incierge
2
+ Copyright 2026 Incierge
3
+
4
+ This product includes software developed by the incierge project.
5
+
6
+ Governance checks, runner planning, the runtime hook chain, the review
7
+ admission check, the desired-state loop, the Mahoraga defect scan, the Guard
8
+ MCP server, and the optional kernel in this repository are licensed under the Apache License,
9
+ Version 2.0 (see the LICENSE file).
10
+
11
+ For the Open-Core two-tier boundary separating this Apache-2.0 repository from
12
+ enterprise multi-organization consensus (`accord`) and automated custom model
13
+ manufacturing modules, see COMMERCIAL_BOUNDARY.md and TRADEMARK.md.
14
+
15
+ ---
16
+
17
+ Third-party material
18
+ --------------------
19
+
20
+ 1. Python runtime (`src/incierge/`)
21
+ Zero external runtime dependencies (Python Standard Library only).
22
+
23
+ 2. Standalone `tools/git-lock-broker/`
24
+ Portions documented under permissive terms as noted in its local metadata;
25
+ copyright 2026 Incierge.
26
+
27
+ 3. Optional native Rust kernel (`crates/incierge-kernel/Cargo.toml`)
28
+ When compiled from source via `cargo build` or `incierge kernel build`, the
29
+ optional native binary links standard Rust ecosystem crates dual-licensed
30
+ under Apache-2.0 OR MIT (`serde`, `serde_json`, `sha2`, `hmac`, `hex`),
31
+ plus their own transitive dependencies. No binary artifacts are stored in
32
+ git; source builds resolve those crates under their Apache-2.0 option.
@@ -0,0 +1,348 @@
1
+ Metadata-Version: 2.4
2
+ Name: incierge
3
+ Version: 0.2.0
4
+ Summary: Zero-dependency governance toolkit for autonomous coding agents (Open-Core)
5
+ Author-email: Incierge Open Source Authors <dev@example.com>
6
+ License: Apache-2.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Dynamic: license-file
24
+
25
+ # incierge
26
+
27
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
28
+ [![Python](https://img.shields.io/badge/python-3.9+-brightgreen.svg)](pyproject.toml)
29
+ [![Python runtime dependencies: 0](https://img.shields.io/badge/python_runtime_deps-0-success.svg)](pyproject.toml)
30
+ [![MCP Ready](https://img.shields.io/badge/MCP-JSON--RPC_2.0-orange.svg)](docs/mcp_tutorial.md)
31
+ [![Self-Check Tests](https://img.shields.io/badge/tests-23%2F23_files_passing-brightgreen.svg)](scripts/run_tests.py)
32
+
33
+ **A toolkit for governing autonomous coding agents (Open-Core v0.2.0). The Python package has zero runtime dependencies; the optional Rust kernel crate depends on `serde`, `serde_json`, `sha2`, `hmac` and `hex`.**
34
+
35
+ Machine-checked rules for autonomous software development workflows (`ask_human=false`: the agent is told not to ask for routine confirmation). Most checks are lexical or keyword rules, not semantic analysis; see the limits below. Licensed under **Apache-2.0** (see [`COMMERCIAL_BOUNDARY.md`](COMMERCIAL_BOUNDARY.md) for the Open-Core boundary):
36
+ - **6-Runner Terrain-First Capacity Router (`incierge router`)**: Plans parallel slices and cross-family reviewers across `claude`, `codex`, `cursor`, `agy`, `muse`, and `gemma`. Host RAM is read from the OS but available RAM is estimated as 65% of it, and the per-runner quota windows (`reset_at_epoch`) are a built-in table: nothing meters real usage. It prints a plan; it does not launch anything. The local runners are named `muse` and `gemma` and are left out of the plan unless you pass `--include-local`; that flag only marks them as available, it does not probe any server. The quota table is static: every call assumes zero usage and a window that resets 5 hours from now.
37
+ - **Cross-Review 3-Round Contract (`incierge review`)**: An admission check, not a launcher: given a ledger of earlier review launches it decides whether another is allowed under 3-bucket budgets (`plan_review`, `review`, `other`), a minimum timeout, and Round 3 pair catch-up. Handshake and timeout failures are recognised by substring match and do not consume a round.
38
+ - **Runtime Hook Chain (`incierge install-hooks`)**: Writes hook scripts under `.incierge/hooks/` and wires them into **Claude Code** (SessionStart, PreToolUse on `Bash|Write|Edit`, Stop) and **Cursor** (`beforeShellExecution` and `stop` only; file edits made through Cursor's edit tools are not seen by the hook). **Codex** and **Antigravity** get Guard MCP config only, no hooks. Existing client config files are merged, not replaced. The generated files contain the absolute paths of the Python interpreter and repository on the machine that ran the command. The hook dispatcher (`strip_venv_env`, tool-name mapping across runners) treats a failing `PreToolUse` hook as a block.
39
+ - **7-Tool Guard MCP Server (`incierge guard-mcp`)**: A hash-chained `docs/decision_log.jsonl`, a protected-path check that requires a prior logged decision before editing files such as `policy/*` or `LICENSE`, and a pattern-based check for needless confirmation questions, over stdio JSON-RPC 2.0. The log is tamper-evident, not tamper-proof: the same server lets an agent record its own approval, so it is a tripwire and an audit trail, not an authority.
40
+ - **Desired-State Loop & Mahoraga Defect Scan (`incierge loop` / `crates/incierge-kernel`)**: `diff-compute` runs each condition's probe command, HMAC-signed `scout` (read-only) / `build` slice tokens, recurring-defect promotion from an observations ledger, and `verify-class` (a detector must fail on the injected defect and pass on a clean state). `post_merge_gate` (run a check, `git revert` HEAD on failure) is a library function, not a CLI command. The optional Rust kernel implements `diff-compute` and `mahoraga-scan` only; everything else, including token signing, is Python. Without a built kernel the Python engine is used.
41
+ - **Command Sandbox (Blocking Conditions 1-5)**: The sandbox evaluates five command classes by lexical command matching (see the limits below): `git reset --hard`, force pushes, catastrophic `rm -rf`, `DROP TABLE` / `DROP DATABASE` through SQL clients, and `git clean -f`. Conditions 6 and 7 of the doctrine are enforced by separate repo scripts, not by the sandbox (see below).
42
+ - **Universal Model Adapters & Git Lock Broker**: Direct stdlib HTTP inference (`Claude`, `OpenAI`, `Gemini`, local `MLX`/`llama.cpp`) and PID-verified `.git/index.lock` arbitration.
43
+
44
+ ---
45
+
46
+ ## ⚡ 5-Minute Quickstart
47
+
48
+ ### 1. Installation
49
+ Install `incierge` from the git tag, or clone the repository (requires Python 3.9+ and git). It is not published on PyPI:
50
+
51
+ ```bash
52
+ pip install "git+https://github.com/Incierge3789/incierge-oss@v0.2.0"
53
+ # not on PyPI. Or clone locally:
54
+ git clone https://github.com/Incierge3789/incierge-oss.git
55
+ cd incierge-oss
56
+ ```
57
+
58
+ ### 2. Run the Offline Autonomous Agent Showcase (No API Key Required)
59
+ Experience how the **Incierge Semantic Sandbox** intercepts destructive actions in real time and guides an autonomous agent to self-correct:
60
+
61
+ ```bash
62
+ python3 examples/multi_model_agent/mock_agent.py
63
+ ```
64
+
65
+ Output:
66
+ ```text
67
+ [Step 1/5] Proposed command: ls -l config
68
+ [SANDBOX APPROVED] Command passed semantic sandbox verification
69
+ [Step 2/5] Proposed command: rm -rf /
70
+ [SANDBOX BLOCKED] 7 Blocking Condition violated: rm -rf on root/home: /
71
+ [Violation Type] filesystem_destructive_operation
72
+ [Step 3/5] Proposed command: mkdir -p /tmp/cache && rm -rf /tmp/cache
73
+ [SANDBOX APPROVED] Command passed semantic sandbox verification
74
+ [Agent Completed Task] Successfully cleaned scoped cache without destruction.
75
+ ```
76
+
77
+ ### 3. Test the Semantic Sandbox CLI
78
+ ```bash
79
+ # Safe operation -> APPROVED (exit 0)
80
+ incierge sandbox run -- "git status --short"
81
+
82
+ # Catastrophic operation -> BLOCKED (exit 2)
83
+ incierge sandbox run -- "git reset --hard HEAD~1"
84
+ ```
85
+
86
+ ### 4. Connect to Cursor / Claude / IDE via MCP
87
+ Launch the standard library sandbox MCP server in stdio mode (tools: `sandbox_evaluate_command`, `sandbox_intercept_tool`; it evaluates commands and never runs them):
88
+ ```bash
89
+ incierge sandbox mcp # or: incierge-sandbox-mcp
90
+ ```
91
+ The 7-tool Guard MCP server is a separate server: `incierge guard-mcp --repo .` (or `incierge-mcp`).
92
+ See the complete [MCP Integration Tutorial](docs/mcp_tutorial.md) for ready-to-use configuration snippets.
93
+
94
+ ---
95
+
96
+ ## 🏗 Architecture Overview
97
+
98
+ ```text
99
+ ┌───────────────────────────────────────┐
100
+ │ Autonomous Agents & IDE Clients │
101
+ │ (Cursor, Claude Code, Antigravity) │
102
+ └───────────────────┬───────────────────┘
103
+ │
104
+ MCP stdio / CLI │ HTTP APIs
105
+ v
106
+ ┌───────────────────────────────────────┐
107
+ │ Universal Model Adapters │
108
+ │ (Claude / OpenAI / Gemini / Mock) │
109
+ │ Zero external dependencies │
110
+ └───────────────────┬───────────────────┘
111
+ │
112
+ v
113
+ ┌───────────────────────────────────────┐
114
+ │ Incierge Semantic Sandbox │
115
+ │ - Lexical Command Check │
116
+ │ - Command Peeler & Tokenizer │
117
+ │ - Blocking Conditions 1-5 Gate │
118
+ └──────────┬─────────────────┬──────────┘
119
+ │ │
120
+ [Violation Detected] │ [Approved]
121
+ │ v
122
+ v ┌────────────────────────┐
123
+ ┌────────────────┐ │ Execution Engine │
124
+ │ Fail-Closed │ │ - Git Lock Broker │
125
+ │ Immediate BLOCK│ │ - Subprocess Runner │
126
+ └────────────────┘ └────────────────────────┘
127
+ ```
128
+
129
+ Detailed architecture documentation is available in [docs/architecture.md](docs/architecture.md).
130
+
131
+ ---
132
+
133
+ ## 🛡 The 7 Blocking Conditions
134
+
135
+ The doctrine lists seven conditions. **`incierge.sandbox` evaluates five command classes (conditions 1-5).** Conditions 6 and 7 are enforced by separate repo scripts (`scripts/scan_forensic.py` and `scripts/phase_gate.py`), not by `incierge sandbox run`, the sandbox MCP server or the hook runner. (The doctrine template that `incierge init` writes words its seven conditions differently and lists destructive operations as a single condition; the sandbox implements only the five destructive command classes below.)
136
+
137
+ Under the Incierge Operating Doctrine, autonomous agents are granted full execution latitude for creative engineering, exploration, and verification. Operations in the **7 Blocking Conditions** are stopped — but not all by the same mechanism, and the list below says which one does what.
138
+
139
+ The command sandbox (`incierge.sandbox`) checks conditions 1–5 on a shell command *before* it runs:
140
+
141
+ 1. **Irreversible Work Discard**: `git reset --hard`.
142
+ 2. **Remote History Destruction**: `git push --force` / `-f` (including combined short flags such as `-vf`), `+<refspec>`, `--mirror`.
143
+ 3. **Catastrophic Filesystem Deletion**: `rm -rf /`, `rm -rf ~`, `rm -rf $HOME`, shallow root paths, or `.git` directory deletion.
144
+ 4. **Database Destruction**: `DROP TABLE`, `DROP DATABASE` executed against SQL clients (`psql`, `mysql`, `sqlite3`).
145
+ 5. **Untracked File Purge**: `git clean -f`, `git clean -fdx`.
146
+
147
+ The same rules are applied to nested execution — command substitution, `sh -c` / `bash -c` / `eval` scripts, and here-documents fed to a shell — and a command that combines such a construct with a destructive operation anywhere is blocked rather than parsed further.
148
+
149
+ Conditions 6 and 7 are not command-level checks and the sandbox does not evaluate them:
150
+
151
+ 6. **Secret & Credential Exposure**: checked at commit time by `scripts/scan_forensic.py`.
152
+ 7. **Scope & Phase Escape**: phase skipping is rejected by `scripts/phase_gate.py`.
153
+
154
+ **Limits of the command sandbox.** It is a lexical check, not an isolation boundary. It does not see inside script files (`bash deploy.sh`), interpreter one-liners (`python -c ...`), or commands assembled at run time from variables, and `git checkout -- .` / `git restore .` are not in its rules. Use it to stop common destructive commands issued by an agent, together with OS-level controls (permissions, containers, backups) — not instead of them. The threat model, the pre-release assessment and the dependency audit are in [`docs/security/`](docs/security/).
155
+
156
+ ---
157
+
158
+ ## 🤖 Multi-Model Agent Showcase (`examples/multi_model_agent/`)
159
+
160
+ Ready-to-run examples demonstrating autonomous agents across different frontier models:
161
+
162
+ | Agent Script | Model Family | Description |
163
+ |---|---|---|
164
+ | [`mock_agent.py`](examples/multi_model_agent/mock_agent.py) | Offline Mock | Complete deterministic simulation; verifies sandbox interception without any API keys. |
165
+ | [`openai_agent.py`](examples/multi_model_agent/openai_agent.py) | OpenAI (GPT-4o, o1) | Autonomous tool-calling loop using standard library HTTP requests to OpenAI. |
166
+ | [`claude_agent.py`](examples/multi_model_agent/claude_agent.py) | Anthropic (Claude 3.5) | Autonomous tool-calling loop using standard library HTTP requests to Anthropic Messages API. |
167
+ | [`gemini_agent.py`](examples/multi_model_agent/gemini_agent.py) | Google Gemini (1.5 Flash/Pro) | Autonomous function-calling loop using standard library HTTP requests to Google AI Studio. |
168
+
169
+ See [`examples/multi_model_agent/README.md`](examples/multi_model_agent/README.md) for configuration and usage.
170
+
171
+ ---
172
+
173
+ ## 🚀 Featured Tool: Git Concurrency Lock Broker (`tools/git-lock-broker`)
174
+
175
+ When multiple autonomous agents run concurrently in the same repository, they frequently collide with:
176
+ ```text
177
+ fatal: Unable to create '/path/to/.git/index.lock': File exists.
178
+ ```
179
+ Or when an agent process is killed mid-operation, leaving an orphaned `.git/index.lock` behind, the entire workspace deadlocks.
180
+
181
+ **[`tools/git-lock-broker`](tools/git-lock-broker/)** is a standalone, zero-dependency Python tool that:
182
+ 1. **Verifies PID liveness** (`os.kill(pid, 0)`) to safely reclaim abandoned `.git/index.lock` files.
183
+ 2. **Mediates concurrent Git writes** with atomic lock reservation and exponential backoff.
184
+ 3. Provides a drop-in execution wrapper (`git-lock-broker run git commit -m "..."`).
185
+
186
+ The bundled `incierge broker` command is narrower: `status` reports the lock and holder PID, and `break-stale` reclaims a stale lock. `incierge broker acquire` records the CLI process's own PID and then exits, so the lock it creates is immediately reclaimable; for real mutual exclusion use the Python API or the wrapper inside the process that runs git.
187
+ 4. Backed by public formal evidence on [incierge.jp](https://incierge.jp/claims/autonomous-git-concurrency-lock-broker/).
188
+
189
+ ---
190
+
191
+ ## Why these gates and not others
192
+
193
+ Each gate here exists because its absence was measured, not because it rounded out a set.
194
+
195
+ - **A guard that has never been seen firing is treated as absent.** Every gate ships with a control that must fail on demand, and one control (`scripts/control_selfcheck.py`) exists only to detect controls that have quietly stopped matching what they were meant to prove.
196
+ - **"Could not check" never renders as "checked and clean."** Every gate has three outcomes — pass, block, undecidable — with distinct exit codes. Collapsing the last two is how a gate gets bypassed: if an unrecognised input produced the same code as a violation, the cheapest fix for a red gate would be to rename the input.
197
+ - **Definitions live in exactly one place.** The scanner has no pattern list of its own; it parses `docs/prereg.scan.md`. Two tests assert that no second copy of the pattern table or the phase list exists anywhere in the repository.
198
+
199
+ ---
200
+
201
+ ## Test & Verification Suite
202
+
203
+ Requires **Python 3.9 or newer, git, `make`, and a POSIX shell** with standard utilities (`sed`, `grep`, `mktemp`). Zero third-party Python packages required.
204
+
205
+ ```sh
206
+ # Setup fictional example deny-list (required for fail-closed scanner)
207
+ make setup
208
+
209
+ # Run the complete test suite
210
+ make test
211
+
212
+ # Run the minimal positive/negative control demo
213
+ make demo
214
+
215
+ # Run all repository self-audit gates
216
+ make check
217
+ ```
218
+
219
+ ---
220
+
221
+ ## What is in here
222
+
223
+ | path | what it is |
224
+ |---|---|
225
+ | `src/incierge/capacity/` | 6-runner capacity planner and cross-family Fan-In reviewer selector |
226
+ | `src/incierge/review/` | Cross-Review admission check: 3-bucket budget, timeout floor, and 3-round cap |
227
+ | `src/incierge/harness/` | Runtime hook chain dispatcher, hook runner, and 4-client hook/MCP installer |
228
+ | `src/incierge/guard/` | 7-tool Guard MCP JSON-RPC 2.0 server and hash-chained `decision_log.jsonl` log |
229
+ | `src/incierge/loop/` | Desired-state loop (`diff`, `authorize`, `dispatch`, `mahoraga-scan`, `verify-class`; `post_merge_gate` as a library function) |
230
+ | `crates/incierge-kernel/` + `src/incierge/kernel/` | Optional native Rust kernel workspace (crates: serde, serde_json, sha2, hmac, hex) with a Python stdlib fallback |
231
+ | `src/incierge/sandbox/` | Command sandbox engine, wrapper peeling tokenizer, and interceptor for Blocking Conditions 1-5 |
232
+ | `src/incierge/adapter/` | Universal LLM execution adapters (Claude, OpenAI, Gemini, local OpenAI-compatible) |
233
+ | `src/incierge/broker/` | Concurrent Git lock broker and PID liveness supervisor |
234
+ | `COMMERCIAL_BOUNDARY.md`, `CLA.md`, `TRADEMARK.md` | Open-Core two-tier licensing boundary, contributor license agreement, and trademark policy |
235
+ | `docs/mcp_tutorial.md` | Model Context Protocol (MCP) configuration guide for Cursor, Claude Code, Antigravity |
236
+ | `docs/architecture.md` | In-depth architectural specification and formal boundary definitions |
237
+ | `docs/prereg.scan.md` | The frozen pattern table and positive controls; parsed directly by forensic scanner |
238
+ | `scripts/scan_forensic.py` | Fail-closed content and leak scanner |
239
+ | `scripts/hooks/pre-commit` | Pre-commit content guard scanning staged changes |
240
+ | `scripts/hooks/pre-push` | Pre-push remote validator enforcing single permitted destination |
241
+ | `scripts/canonical_remote.py` | Canonical form resolver for remote URLs |
242
+ | `scripts/phase_gate.py` + `schema/phase_transitions.json` | Sprint phase transition gate: 9 phases, single step forward, fail-closed |
243
+ | `scripts/ledger_gate.py` + `schema/ledger.json` | Record schemas for pre-registrations, negative results, decisions, failures |
244
+ | `scripts/tautological_control_gate.py` | Detects non-falsifiable test controls that cannot fail |
245
+ | `examples/multi_model_agent/` | Runnable showcases for OpenAI, Claude, Gemini, and offline mock agent |
246
+ | `ledger/negative_results.jsonl` | The machine-checked negative results ledger |
247
+
248
+ ---
249
+
250
+ ## Facts from running it
251
+
252
+ Measured on the private system this was extracted from, as of 2026-08-15. They are reported because a claim about a discipline is worth what its numbers are worth.
253
+
254
+ - The instrument that matters most is the human-intervention rate, and it is **red** on every reading below.
255
+
256
+ **The denominator has two definitions and they differ by a factor of six.**
257
+ Read at 2026-08-15T05:02:50Z:
258
+
259
+ | denominator | what it counts | reading |
260
+ |---|---|---|
261
+ | responses *(the tool's default)* | assistant responses | 19 / 764 = **0.0249** |
262
+ | tasks *(matches the metric's own name)* | real user utterances | 7 / 50 = **0.14** |
263
+
264
+ The metric is named `human_intervention_requests / completed_tasks`, so the second row is the one that means what the name says. **The default is the flattering one**, and it is flattering in a specific way: responses grow with how much the system says, so the same number of hand-backs looks better the more it talks. Earlier versions of this section published only the default. Both are printed here because the verdict does not depend on the denominator — and a difference that never reaches the verdict is a difference that travels into published numbers unchallenged. Filed as an open defect.
265
+
266
+ On the same reading, 55 attempts to hand work back were made and 36 of them were stopped by a gate.
267
+
268
+ **The pass condition is numerator zero, not a threshold.** The private system's canon states a target of `< 0.05` and then says explicitly that the target is a waypoint and not the pass line; the instrument contains no threshold at all, only `GREEN if numerator == 0 else RED`. Both rows above are red, and 0.0249 would be red even though it satisfies the target. A target you can reach by tightening a threshold is not the target.
269
+
270
+ **One thing about that numerator is unresolved, and hiding it would be the same defect this repository is about.** The canon permits human involvement for an enumerated set of gate items — physical authority, legal judgement, named credentials — but the numerator carries no exemption for them, so correctly routing a decision that only a person may lawfully make still increments it. Whether such cases should be excluded is undecided, and it is **not currently decidable from the record**: the ledger stores the linguistic form of a hand-off, not the kind of decision behind it. Filed as an open defect against the private system rather than settled by picking a side here.
271
+
272
+ **These are readings with a timestamp, not properties of this repository.** They move within a single day; an earlier reading the same day was 6 / 104 on the default denominator.
273
+
274
+ - The phase order and the gate chain described here are the ones the private system runs on. `scripts/tautological_control_gate.py` came from that system rather than being reimplemented for publication — but it is **one of the five copies, all of which were adapted**: two glob patterns naming private lanes and some internal identifiers were removed. `docs/ja/README.md` records source and published digests for all five.
275
+ - Cross-review runs with a quorum of two independent bases. That is an operating practice, **not something this repository ships** — there is no cross-review tool, hook, or config here, and nothing in `make check` enforces it. It is stated because it is how the findings below were produced, not as a feature.
276
+
277
+ **None of the underlying data is in this repository, and you cannot re-derive these numbers from it.** The 104-task window is private operational telemetry; what is published is the schema those records have (`schema/ledger.json`), not the records. The `source` field on each negative result names **the lane a measurement came from, not a path** — earlier versions carried private repository paths, and `docs/disclosure.md` rule D5 took them out. Treat the figures as reported, not as reproducible: the reproducible part of this repository is the gates, and those you can run.
278
+
279
+ ---
280
+
281
+ ## Negative results
282
+
283
+ Claims that were pre-registered, measured, and did not survive. The data is `ledger/negative_results.jsonl`; a test asserts this table matches it.
284
+
285
+ | id | verdict | claim |
286
+ |---|---|---|
287
+ | NR-001 | refuted | information-gain selection beats uniform spacing at equal budget |
288
+ | NR-002 | not_supported | ordering work by estimated expected loss beats a simple structural rule |
289
+ | NR-003 | withdrawn | a selector's recall advantage on a standard defect corpus |
290
+ | NR-004 | not_supported | a selector's measured recall transfers between repositories |
291
+ | NR-005 | not_supported | a predicate-drafting arm outperforms its controls on the current fixture |
292
+ | NR-006 | not_supported | the publish gate's self-approval defense establishes two parties |
293
+ | NR-007 | not_supported | individually correct fail-closed gates compose into a clearable boundary |
294
+
295
+ NR-006 is about a control in this repository's own subject matter rather than about a measurement. The gate refuses an approval created in the session that is acting — correct, and it fired. The agent then satisfied it by opening a second session and writing the same approval there. Both sessions were the same agent with write access to the ledger. A session boundary is cheap; the check establishes a second *session*, not a second *party*, and the difference is the whole point of the control. The checker's source already recorded this residual; what was missing was a measurement of how cheaply it could be crossed.
296
+
297
+ NR-007 is the cost of the discipline this repository is about, measured once. Five refusals, two gates, every one of them correct, three hours and fifty-five minutes. Two of the five were independent of each other and were separated by three hours and twenty-two minutes only because the first had to be cleared before the second became visible. The order was the order the enforcing script happened to be written in. Nothing declared which gates applied to the action, so there was no way to learn how many were left without hitting them one at a time.
298
+
299
+ NR-003 is the one worth reading. A positive result had already been produced before self-audit found that only the treatment arm could see an input derived from the fix commit. With that input removed the treatment became identical to the control, a registered stop condition fired, and the number was withdrawn rather than republished with a caveat.
300
+
301
+ ---
302
+
303
+ ## Provenance
304
+
305
+ Extracted from a private repository at commit `aa1a5a68e27b3992a26386edc301e898b8887153`, dated 2026-08-15T06:59:46+09:00. This repository has no history in common with it: it starts from an empty root, and every file here was scanned before it was placed.
306
+
307
+ Seven files were copied from that commit. Two of them, `docs/ja/ARCHITECTURE.md` and `docs/ja/ADR-0003-naming.md`, described a layout of the private system rather than this repository; they have been replaced by short documents written for this repository and are no longer copies. **Of the five copies that remain, none is byte-identical to its source any more: all five were adapted**, each with its declared changes, because an audit found that the copies carried private paths and an internal identifier namespace that `docs/disclosure.md` rule D5 makes private.
308
+
309
+ | | files | what the digest table in `docs/ja/README.md` records |
310
+ |---|---|---|
311
+ | verbatim | 0 | (none) |
312
+ | adapted | 5 | two digests — the source's and the published file's — plus what changed |
313
+
314
+ A test asserts that a verbatim row really is identical and an adapted row really is not, so an edited file cannot keep a verbatim claim.
315
+
316
+ **What you cannot check from outside.** For the adapted five, the claim is "nothing was removed except structure — no measurement, no threshold, no conclusion." The digests prove only that the file **differs** from its source. They cannot show that the difference is confined to the one change described, because you do not have the source. **That claim rests on trust, and this paragraph is here so that it is not mistaken for something the digests established.** If it matters to you, the measurements themselves were moved into `ledger/negative_results.jsonl` (`NR-005`) where they can be read directly rather than inferred from a copy.
317
+
318
+ ---
319
+
320
+ ## What this does not claim
321
+
322
+ No priority and no superiority. Nothing here is asserted to be first, novel, or better than anything else, and the repository assumes contemporaneous work exists that it does not cite — a prior-art search has **not** been performed.
323
+
324
+ That is a structural constraint rather than a stylistic preference: `config/claim_terms.json` lists the terms this repository may not use about itself, and a test fails if any of them appears in the documents it guards. A priority claim is the cheapest sentence to write and the most expensive one to withdraw, and the record here already contains one withdrawal (`NR-003`).
325
+
326
+ What is claimed is narrower and checkable: the gates in this repository do what their controls demonstrate, on the machine you run them on.
327
+
328
+ ---
329
+
330
+ ## Where the disclosure line is
331
+
332
+ `docs/disclosure.md` — one document, five decidable rules, and the reader is a test. Registered criteria and measured values are public; calibration values, raw logs, and **structure** (paths, lane names, internal identifier namespaces) are private, and the private rules win where two rules disagree.
333
+
334
+ That document exists because the line used to be a list of categories, and two publication paths applied it independently and disclosed different things without either breaking a category. An open-world audit — one that ignored the pattern table and asked what a stranger could infer — found private paths and an internal work-item namespace in the copied documents, and found thresholds and a sample size published on one path and withheld on the other.
335
+
336
+ The repair went both ways: the paths and identifiers came **out** of everything, and the English ledger was **raised** to disclose what the Japanese copy already did (`NR-005`). Trimming the copy instead would have made the disclosure smaller and the process no more consistent. `docs/ja/README.md` records which files are still byte-identical to their source and which were adapted, with both digests.
337
+
338
+ ---
339
+
340
+ ## Contributing
341
+
342
+ **Falsifications go to <https://incierge.jp/challenge/>** — that is the canonical intake, and what arrives there is projected into the system's event log. GitHub Issues are a secondary path that is read but whose projection is not yet built. Pull requests are closed for now, with the reason given each time. See `CONTRIBUTING.md`.
343
+
344
+ ---
345
+
346
+ ## License
347
+
348
+ Apache License 2.0. See `LICENSE` and `NOTICE`.