saicode 0.3.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.
@@ -0,0 +1,27 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+
8
+ # Virtual environments
9
+ .venv/
10
+ venv/
11
+
12
+ # Tool caches
13
+ .pytest_cache/
14
+ .mypy_cache/
15
+ .ruff_cache/
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Editors and OS
20
+ .DS_Store
21
+ .idea/
22
+ .vscode/
23
+
24
+ # Secrets and local saicode state
25
+ .env
26
+ .env.*
27
+ .saicode/
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+ While the version is `0.x`, minor releases may contain breaking changes.
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [0.3.0] - 2026-11-24
12
+
13
+ First public release. Completes roadmap phase A1 (Foundation).
14
+
15
+ ### Added
16
+
17
+ - Layered configuration: built-in defaults, user config, project config and
18
+ system policy. The system policy always wins and locks the keys it sets.
19
+ - `permissions.deny` and `permissions.deny_read` are combined across all layers,
20
+ so no layer can remove a rule another layer added.
21
+ - Policy engine that allows, asks or denies every tool action, confines the agent
22
+ to the project folder and always blocks protected files (`.env`, keys, `.ssh`,
23
+ `secrets/`, ...).
24
+ - Event bus with stable session, turn and event IDs, and an append-only JSONL
25
+ session log that leaves out file contents and command output by default.
26
+ - API keys read from environment variables or the system keychain
27
+ (`saicode login`, `saicode logout`); keys are never written to config files.
28
+ - Provider-neutral agent loop with automatic retry on rate limits and transient
29
+ server errors, and fallback models when a quota is used up.
30
+ - Gemini provider behind a common interface and an administrator allowlist.
31
+ - Tools: list, read, write, edit and run. Changes and commands ask for approval
32
+ with a diff or command preview.
33
+ - Terminal UI with `/help`, `/model`, `/models`, `/status`, `/config`, `/clear`
34
+ and `/exit`, and the `saicode config` command.
35
+
36
+ ### Security
37
+
38
+ - A project config (which comes from the repository) cannot loosen permissions,
39
+ mark itself as trusted, or change logging, identity or the provider allowlist.
40
+
41
+ [Unreleased]: https://github.com/the-schoolofai/saicode/compare/v0.3.0...HEAD
42
+ [0.3.0]: https://github.com/the-schoolofai/saicode/releases/tag/v0.3.0
saicode-0.3.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.
saicode-0.3.0/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ SAI Code
2
+ Copyright 2026 SAI Code Team
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
5
+ See the LICENSE file for the full license text.
saicode-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.5
2
+ Name: saicode
3
+ Version: 0.3.0
4
+ Summary: A terminal coding agent: small core, safe by default, enterprise-ready foundations.
5
+ Project-URL: Homepage, https://github.com/the-schoolofai/saicode
6
+ Project-URL: Repository, https://github.com/the-schoolofai/saicode
7
+ Project-URL: Issues, https://github.com/the-schoolofai/saicode/issues
8
+ Project-URL: Changelog, https://github.com/the-schoolofai/saicode/blob/main/CHANGELOG.md
9
+ Project-URL: Security, https://github.com/the-schoolofai/saicode/security/policy
10
+ Author: SAI Code Team
11
+ Maintainer: Muhammad Rizwan
12
+ License-Expression: Apache-2.0
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Keywords: agent,ai,cli,coding-agent,developer-tools,gemini,llm,terminal
16
+ Classifier: Development Status :: 3 - Alpha
17
+ Classifier: Environment :: Console
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Operating System :: MacOS
20
+ Classifier: Operating System :: Microsoft :: Windows
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
+ Classifier: Topic :: Software Development
30
+ Requires-Python: >=3.11
31
+ Requires-Dist: google-genai<4,>=1.50
32
+ Requires-Dist: keyring<27,>=25
33
+ Requires-Dist: prompt-toolkit<4,>=3.0.40
34
+ Requires-Dist: rich<15,>=13.7
35
+ Provides-Extra: dev
36
+ Requires-Dist: mypy>=2.4; extra == 'dev'
37
+ Requires-Dist: pytest>=8; extra == 'dev'
38
+ Requires-Dist: ruff>=0.17; extra == 'dev'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # SAI Code
42
+
43
+ A terminal coding agent: small core, safe by default, built on enterprise-ready foundations.
44
+
45
+ Version 0.3.0 completes roadmap phase **A1 (Foundation)**.
46
+
47
+ > **Safety note.** saicode reads files, edits files and runs shell commands in your project.
48
+ > It asks before every change and command, but in 0.3.x approved commands run **without an
49
+ > OS sandbox**, with your own permissions. Review each command before you approve it.
50
+
51
+ ## Install
52
+
53
+ Requires Python 3.11 or newer on macOS, Linux or Windows.
54
+
55
+ ```bash
56
+ uv tool install saicode # recommended
57
+ # or
58
+ pipx install saicode
59
+ ```
60
+
61
+ Upgrade with `uv tool upgrade saicode` (or `pipx upgrade saicode`).
62
+
63
+ ### From source
64
+
65
+ ```bash
66
+ git clone https://github.com/the-schoolofai/saicode.git
67
+ cd saicode
68
+ uv tool install .
69
+ ```
70
+
71
+ ## Store your API key (once)
72
+
73
+ ```bash
74
+ saicode login
75
+ ```
76
+
77
+ The key goes into the system keychain (macOS Keychain). You can also use the
78
+ `GEMINI_API_KEY` environment variable; it takes priority over the keychain.
79
+
80
+ ## Use
81
+
82
+ ```bash
83
+ cd ~/your-project
84
+ saicode
85
+ saicode --model gemini-3-flash-preview
86
+ ```
87
+
88
+ Inside saicode: `/help`, `/model`, `/models`, `/status`, `/config`, `/clear`, `/exit`.
89
+
90
+ Other commands:
91
+
92
+ ```bash
93
+ saicode config # effective settings and where each one comes from
94
+ saicode logout # remove the stored key
95
+ saicode --version
96
+ ```
97
+
98
+ ## Configuration layers
99
+
100
+ Later layers win. The system policy always wins and cannot be overridden.
101
+
102
+ | Layer | File |
103
+ | ------- | ---- |
104
+ | default | built in |
105
+ | user | `~/.saicode/config.toml` |
106
+ | project | `<project>/.saicode/config.toml` |
107
+ | system | macOS `/Library/Application Support/saicode/policy.toml`, Linux `/etc/saicode/policy.toml`, Windows `%ProgramData%\saicode\policy.toml` |
108
+
109
+ Rules that make the layers safe:
110
+
111
+ - `permissions.deny` and `permissions.deny_read` are combined across all layers. No layer can remove a rule.
112
+ - A project config comes from the repository, so its `permissions.allow`, `permissions.mode` and
113
+ `permissions.allow_always` are ignored unless your user config sets `trust_project_permissions = true`
114
+ (and the system policy does not forbid it).
115
+ - A project config can never change `logging.*`, `identity.email` or `providers.allowed`, so a
116
+ cloned repository cannot switch off or redirect your session log.
117
+
118
+ Example user config:
119
+
120
+ ```toml
121
+ [model]
122
+ name = "gemini-3-flash-preview"
123
+
124
+ [permissions]
125
+ allow = ["run:git status*", "run:pytest*"]
126
+
127
+ [identity]
128
+ email = "you@example.com"
129
+ ```
130
+
131
+ Example system policy (set by an administrator):
132
+
133
+ ```toml
134
+ [providers]
135
+ allowed = ["gemini"]
136
+
137
+ [permissions]
138
+ mode = "ask" # or "read-only"
139
+ allow_always = false # users must approve every change
140
+ deny = ["run:git push*"]
141
+
142
+ [logging]
143
+ sessions = true
144
+ include_content = false
145
+ ```
146
+
147
+ ## Permissions
148
+
149
+ | Action | Default |
150
+ | ------ | ------- |
151
+ | list and read files | allowed |
152
+ | protected files (`.env`, keys, `.ssh`, `secrets/`, ...) | always blocked |
153
+ | anything outside the project folder | always blocked |
154
+ | write or edit files | asks, with a diff |
155
+ | run commands | asks; dangerous patterns blocked |
156
+
157
+ Rules use the form `run:<command glob>`, `write:<path glob>`, `read:<path glob>`.
158
+
159
+ ## Session logs
160
+
161
+ Every session is written to `~/.saicode/sessions/<date>/<session id>.jsonl`, one event per line,
162
+ each with a session ID, turn ID, event ID, user and timestamp. File contents and command output are
163
+ left out unless `logging.include_content = true`.
164
+
165
+ ## Project layout
166
+
167
+ ```
168
+ src/saicode/
169
+ ai/ providers behind one interface (Gemini today), provider allowlist
170
+ core/ config layers, policy engine, events and session log, credentials, agent loop
171
+ tools/ list, read, write, edit, run - each checks the policy first
172
+ sandbox/ command runner interface (OS sandbox arrives in phase A2)
173
+ tui/ the terminal screen; the only package that draws
174
+ cli/ the `saicode` command
175
+ tests/ pytest suite
176
+ ```
177
+
178
+ The core never imports the UI. Editor integrations (ACP, VS Code) and headless mode will reuse the same core.
179
+
180
+ ## Development
181
+
182
+ ```bash
183
+ uv sync --extra dev # install saicode and the dev tools
184
+ uv run pytest # tests
185
+ uv run ruff check # lint
186
+ uv run ruff format # format
187
+ uv run mypy # type check
188
+ ```
189
+
190
+ CI runs all of these on every push and pull request: Python 3.11 to 3.14 on Linux,
191
+ and Python 3.11 and 3.14 on macOS and Windows. A pull request should keep every check green.
192
+
193
+ Maintainers: the release process is described in [RELEASING.md](https://github.com/the-schoolofai/saicode/blob/main/RELEASING.md).
194
+
195
+ ## Known limits in 0.3.0
196
+
197
+ - Commands run without an OS sandbox (phase A2). Set `sandbox.required = true` to refuse commands until then.
198
+ - Blocking protected files inside shell commands is best-effort text matching until the sandbox ships.
199
+ - Gemini is the only provider (phase A3 adds more).
200
+
201
+ ## Security
202
+
203
+ Please report vulnerabilities privately. See [SECURITY.md](https://github.com/the-schoolofai/saicode/blob/main/SECURITY.md).
204
+
205
+ ## Changelog
206
+
207
+ See [CHANGELOG.md](https://github.com/the-schoolofai/saicode/blob/main/CHANGELOG.md).
208
+
209
+ ## License
210
+
211
+ Licensed under the [Apache License, Version 2.0](https://github.com/the-schoolofai/saicode/blob/main/LICENSE). Copyright 2026 SAI Code Team.
@@ -0,0 +1,171 @@
1
+ # SAI Code
2
+
3
+ A terminal coding agent: small core, safe by default, built on enterprise-ready foundations.
4
+
5
+ Version 0.3.0 completes roadmap phase **A1 (Foundation)**.
6
+
7
+ > **Safety note.** saicode reads files, edits files and runs shell commands in your project.
8
+ > It asks before every change and command, but in 0.3.x approved commands run **without an
9
+ > OS sandbox**, with your own permissions. Review each command before you approve it.
10
+
11
+ ## Install
12
+
13
+ Requires Python 3.11 or newer on macOS, Linux or Windows.
14
+
15
+ ```bash
16
+ uv tool install saicode # recommended
17
+ # or
18
+ pipx install saicode
19
+ ```
20
+
21
+ Upgrade with `uv tool upgrade saicode` (or `pipx upgrade saicode`).
22
+
23
+ ### From source
24
+
25
+ ```bash
26
+ git clone https://github.com/the-schoolofai/saicode.git
27
+ cd saicode
28
+ uv tool install .
29
+ ```
30
+
31
+ ## Store your API key (once)
32
+
33
+ ```bash
34
+ saicode login
35
+ ```
36
+
37
+ The key goes into the system keychain (macOS Keychain). You can also use the
38
+ `GEMINI_API_KEY` environment variable; it takes priority over the keychain.
39
+
40
+ ## Use
41
+
42
+ ```bash
43
+ cd ~/your-project
44
+ saicode
45
+ saicode --model gemini-3-flash-preview
46
+ ```
47
+
48
+ Inside saicode: `/help`, `/model`, `/models`, `/status`, `/config`, `/clear`, `/exit`.
49
+
50
+ Other commands:
51
+
52
+ ```bash
53
+ saicode config # effective settings and where each one comes from
54
+ saicode logout # remove the stored key
55
+ saicode --version
56
+ ```
57
+
58
+ ## Configuration layers
59
+
60
+ Later layers win. The system policy always wins and cannot be overridden.
61
+
62
+ | Layer | File |
63
+ | ------- | ---- |
64
+ | default | built in |
65
+ | user | `~/.saicode/config.toml` |
66
+ | project | `<project>/.saicode/config.toml` |
67
+ | system | macOS `/Library/Application Support/saicode/policy.toml`, Linux `/etc/saicode/policy.toml`, Windows `%ProgramData%\saicode\policy.toml` |
68
+
69
+ Rules that make the layers safe:
70
+
71
+ - `permissions.deny` and `permissions.deny_read` are combined across all layers. No layer can remove a rule.
72
+ - A project config comes from the repository, so its `permissions.allow`, `permissions.mode` and
73
+ `permissions.allow_always` are ignored unless your user config sets `trust_project_permissions = true`
74
+ (and the system policy does not forbid it).
75
+ - A project config can never change `logging.*`, `identity.email` or `providers.allowed`, so a
76
+ cloned repository cannot switch off or redirect your session log.
77
+
78
+ Example user config:
79
+
80
+ ```toml
81
+ [model]
82
+ name = "gemini-3-flash-preview"
83
+
84
+ [permissions]
85
+ allow = ["run:git status*", "run:pytest*"]
86
+
87
+ [identity]
88
+ email = "you@example.com"
89
+ ```
90
+
91
+ Example system policy (set by an administrator):
92
+
93
+ ```toml
94
+ [providers]
95
+ allowed = ["gemini"]
96
+
97
+ [permissions]
98
+ mode = "ask" # or "read-only"
99
+ allow_always = false # users must approve every change
100
+ deny = ["run:git push*"]
101
+
102
+ [logging]
103
+ sessions = true
104
+ include_content = false
105
+ ```
106
+
107
+ ## Permissions
108
+
109
+ | Action | Default |
110
+ | ------ | ------- |
111
+ | list and read files | allowed |
112
+ | protected files (`.env`, keys, `.ssh`, `secrets/`, ...) | always blocked |
113
+ | anything outside the project folder | always blocked |
114
+ | write or edit files | asks, with a diff |
115
+ | run commands | asks; dangerous patterns blocked |
116
+
117
+ Rules use the form `run:<command glob>`, `write:<path glob>`, `read:<path glob>`.
118
+
119
+ ## Session logs
120
+
121
+ Every session is written to `~/.saicode/sessions/<date>/<session id>.jsonl`, one event per line,
122
+ each with a session ID, turn ID, event ID, user and timestamp. File contents and command output are
123
+ left out unless `logging.include_content = true`.
124
+
125
+ ## Project layout
126
+
127
+ ```
128
+ src/saicode/
129
+ ai/ providers behind one interface (Gemini today), provider allowlist
130
+ core/ config layers, policy engine, events and session log, credentials, agent loop
131
+ tools/ list, read, write, edit, run - each checks the policy first
132
+ sandbox/ command runner interface (OS sandbox arrives in phase A2)
133
+ tui/ the terminal screen; the only package that draws
134
+ cli/ the `saicode` command
135
+ tests/ pytest suite
136
+ ```
137
+
138
+ The core never imports the UI. Editor integrations (ACP, VS Code) and headless mode will reuse the same core.
139
+
140
+ ## Development
141
+
142
+ ```bash
143
+ uv sync --extra dev # install saicode and the dev tools
144
+ uv run pytest # tests
145
+ uv run ruff check # lint
146
+ uv run ruff format # format
147
+ uv run mypy # type check
148
+ ```
149
+
150
+ CI runs all of these on every push and pull request: Python 3.11 to 3.14 on Linux,
151
+ and Python 3.11 and 3.14 on macOS and Windows. A pull request should keep every check green.
152
+
153
+ Maintainers: the release process is described in [RELEASING.md](https://github.com/the-schoolofai/saicode/blob/main/RELEASING.md).
154
+
155
+ ## Known limits in 0.3.0
156
+
157
+ - Commands run without an OS sandbox (phase A2). Set `sandbox.required = true` to refuse commands until then.
158
+ - Blocking protected files inside shell commands is best-effort text matching until the sandbox ships.
159
+ - Gemini is the only provider (phase A3 adds more).
160
+
161
+ ## Security
162
+
163
+ Please report vulnerabilities privately. See [SECURITY.md](https://github.com/the-schoolofai/saicode/blob/main/SECURITY.md).
164
+
165
+ ## Changelog
166
+
167
+ See [CHANGELOG.md](https://github.com/the-schoolofai/saicode/blob/main/CHANGELOG.md).
168
+
169
+ ## License
170
+
171
+ Licensed under the [Apache License, Version 2.0](https://github.com/the-schoolofai/saicode/blob/main/LICENSE). Copyright 2026 SAI Code Team.