foretop-charter 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- foretop_charter-0.1.0/LICENSE +202 -0
- foretop_charter-0.1.0/PKG-INFO +355 -0
- foretop_charter-0.1.0/README.md +340 -0
- foretop_charter-0.1.0/pyproject.toml +73 -0
- foretop_charter-0.1.0/pyproject.toml.orig +89 -0
- foretop_charter-0.1.0/src/charter/__init__.py +1 -0
- foretop_charter-0.1.0/src/charter/__main__.py +4 -0
- foretop_charter-0.1.0/src/charter/brand.py +6 -0
- foretop_charter-0.1.0/src/charter/canonical.py +35 -0
- foretop_charter-0.1.0/src/charter/capability.py +144 -0
- foretop_charter-0.1.0/src/charter/cli.py +232 -0
- foretop_charter-0.1.0/src/charter/collect.py +33 -0
- foretop_charter-0.1.0/src/charter/drift.py +119 -0
- foretop_charter-0.1.0/src/charter/enumerate.py +266 -0
- foretop_charter-0.1.0/src/charter/findings.py +293 -0
- foretop_charter-0.1.0/src/charter/git_ref.py +30 -0
- foretop_charter-0.1.0/src/charter/lockfile.py +109 -0
- foretop_charter-0.1.0/src/charter/models.py +60 -0
- foretop_charter-0.1.0/src/charter/parsers/__init__.py +0 -0
- foretop_charter-0.1.0/src/charter/parsers/claude_code.py +100 -0
- foretop_charter-0.1.0/src/charter/parsers/cursor.py +88 -0
- foretop_charter-0.1.0/src/charter/render/__init__.py +0 -0
- foretop_charter-0.1.0/src/charter/render/annotations.py +53 -0
- foretop_charter-0.1.0/src/charter/render/json_renderer.py +14 -0
- foretop_charter-0.1.0/src/charter/render/markdown.py +100 -0
- foretop_charter-0.1.0/src/charter/render/sarif.py +92 -0
- foretop_charter-0.1.0/src/charter/render/terminal.py +131 -0
- foretop_charter-0.1.0/src/charter/rules/capability_taxonomy.yaml +216 -0
- foretop_charter-0.1.0/src/charter/triage.py +140 -0
- foretop_charter-0.1.0/src/keel/__init__.py +1 -0
- foretop_charter-0.1.0/src/keel/collect/__init__.py +0 -0
- foretop_charter-0.1.0/src/keel/collect/line_tracking.py +48 -0
- foretop_charter-0.1.0/src/keel/finding.py +105 -0
- foretop_charter-0.1.0/src/keel/gate.py +152 -0
- foretop_charter-0.1.0/src/keel/git_ref.py +45 -0
- foretop_charter-0.1.0/src/keel/owner.py +58 -0
- foretop_charter-0.1.0/src/keel/render/__init__.py +0 -0
- foretop_charter-0.1.0/src/keel/render/annotations.py +62 -0
- foretop_charter-0.1.0/src/keel/render/markdown.py +40 -0
- foretop_charter-0.1.0/src/keel/render/terminal.py +38 -0
- foretop_charter-0.1.0/src/keel/render/triage_json.py +15 -0
- foretop_charter-0.1.0/src/keel/report.py +98 -0
- foretop_charter-0.1.0/src/keel/run.py +67 -0
- foretop_charter-0.1.0/src/keel/triage.py +167 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 the foretop authors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: foretop-charter
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Scans an agent configuration and produces a reviewable record of every MCP server, tool, scope and credential path — then fails CI when an update quietly expands what the agent can reach.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: typer>=0.15
|
|
8
|
+
Requires-Dist: rich>=13.9
|
|
9
|
+
Requires-Dist: pyyaml>=6.0
|
|
10
|
+
Requires-Dist: pydantic>=2.9
|
|
11
|
+
Requires-Dist: pathspec>=0.12
|
|
12
|
+
Requires-Dist: httpx>=0.28
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# charter
|
|
17
|
+
|
|
18
|
+
> Scans an agent configuration and produces a reviewable record of every MCP server, tool,
|
|
19
|
+
> scope and credential path — then fails CI when an update quietly expands what the agent can
|
|
20
|
+
> reach.
|
|
21
|
+
|
|
22
|
+
Full product spec: `../../specs/charter.md`. This file tracks build status; the spec is the
|
|
23
|
+
source of truth for scope and decisions.
|
|
24
|
+
|
|
25
|
+
**Scope note (Session 15):** specs/charter.md's own §0 describes a much larger build —
|
|
26
|
+
Supabase-backed org inventory, GitHub OAuth, Paddle/Lemon Squeezy billing, a hosted dashboard
|
|
27
|
+
(FR-007, its own Slice 5). None of that is in scope here, same boundary ebb and telltale both
|
|
28
|
+
shipped within: the OSS CLI + CI Action is the whole product until `PILOT_STATUS >= 3`
|
|
29
|
+
(specs/charter.md's own "Validation gate"). Sessions 15-17 build exactly the pattern
|
|
30
|
+
CLAUDE_CODE_PLAN.md's Part 4 describes: collector, distinctive engine, renderers + golden
|
|
31
|
+
corpus, Action + PR comment + publish-prep.
|
|
32
|
+
|
|
33
|
+
**Decisions locked in from specs/charter.md §1's checkpoint** (all defaults except DEC-03,
|
|
34
|
+
which the user picked explicitly):
|
|
35
|
+
- **DEC-01** (config sources): Claude Code's `.mcp.json` and Cursor's `.cursor/mcp.json`, both
|
|
36
|
+
project-root, both meant to be committed — matches DEC-04's "the review is a code review"
|
|
37
|
+
framing. Claude Desktop's `claude_desktop_config.json` lives in a per-machine app-support
|
|
38
|
+
directory, never committed to a repo, so it's out of scope for a "review this in CI" tool.
|
|
39
|
+
- **DEC-02** (tool inventories): static parse by default; live `tools/list` enumeration behind
|
|
40
|
+
an explicit `--enumerate` flag, since that means launching third-party code.
|
|
41
|
+
- **DEC-03** (classification): rules-only for v1 — no LLM dependency, no API key, no cost. The
|
|
42
|
+
spec's own default is hybrid (rules + a cached LLM assist for unrecognized tools); that part
|
|
43
|
+
is deliberately not built yet, same as every other real-external-dependency decision this
|
|
44
|
+
build has paused on rather than deciding unilaterally. An unrecognized tool is classified
|
|
45
|
+
`unknown` — a real, honest verdict — not guessed at.
|
|
46
|
+
- **DEC-04** (diff baseline): a committed `charter.lock` file.
|
|
47
|
+
- **DEC-05** (policy language): YAML.
|
|
48
|
+
- **DEC-06** (secret detection depth): names and paths only. This is a hard invariant, not
|
|
49
|
+
just a convention — see below.
|
|
50
|
+
|
|
51
|
+
## Status
|
|
52
|
+
|
|
53
|
+
**Slice 1 (Session 15): config parse + manifest write + the stable-hash property test.**
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
uv run --package foretop-charter charter scan <path>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Checks a small, fixed set of committed, project-scoped config paths under `path` —
|
|
60
|
+
`.mcp.json` (Claude Code) and `.cursor/mcp.json` (Cursor), both confirmed live against each
|
|
61
|
+
client's own docs this session, not a full repo walk (`src/charter/collect.py`; same reasoning
|
|
62
|
+
telltale's own OpenAPI-spec autodetection uses for a fixed candidate list). Parses whichever
|
|
63
|
+
exist into `Server` records (`src/charter/models.py`) and writes a canonical, deterministic
|
|
64
|
+
`charter.lock` (`src/charter/lockfile.py`) — the committed diff baseline DEC-04 calls for:
|
|
65
|
+
"it makes the review a code review, which is the whole product." No policy engine or differ
|
|
66
|
+
yet (that's Slice 3) — for now, git's own diff on the committed lock file *is* the review
|
|
67
|
+
mechanism, the same way a `package-lock.json` works.
|
|
68
|
+
|
|
69
|
+
**Canonical serialization** (`src/charter/canonical.py`) — specs/charter.md §6: "sorted keys,
|
|
70
|
+
no floats, LF endings, trailing newline. Test byte-equality across two runs." Recursive
|
|
71
|
+
`sort_keys=True` makes dict-insertion-order irrelevant; a value that would serialize unstably
|
|
72
|
+
(a float) is rejected outright rather than trusted to `repr()` consistently; the lock file is
|
|
73
|
+
written with `Path.write_bytes`, never a text-mode handle, so Windows can't silently turn `\n`
|
|
74
|
+
into `\r\n`. Proven with a genuine Hypothesis property test
|
|
75
|
+
(`tests/unit/test_stable_hash_property.py`), not just a fixed fixture run twice: generates
|
|
76
|
+
~100 arbitrary (valid-shaped) `.mcp.json` documents per run and asserts the rendered manifest
|
|
77
|
+
is byte-identical across two scans of the same unchanged file.
|
|
78
|
+
|
|
79
|
+
**DEC-06 as a hard invariant, not a convention**: `Server` has no field that could carry a
|
|
80
|
+
credential's *value* — `env_var_names`/`header_names` are exactly that, names only (evidence
|
|
81
|
+
that a server references a credential, e.g. `AIRTABLE_API_KEY`), never what's assigned to
|
|
82
|
+
them. This is structural (there's nowhere on the dataclass to put a value even by accident),
|
|
83
|
+
not just tested — though it's tested too, at the parser, lockfile, and CLI layers, each
|
|
84
|
+
asserting a planted fake secret value never appears in output. `args` is the one field
|
|
85
|
+
captured verbatim rather than name-only, a deliberate choice made after a real fixture
|
|
86
|
+
surfaced why it matters — see `Server`'s own docstring in `models.py` for the full reasoning
|
|
87
|
+
(short version: a positional CLI argument can itself be a connection string with a literal
|
|
88
|
+
password in it, and DEC-06's own default is "never attempt to detect actual secret values" —
|
|
89
|
+
which applies to `args` exactly as much as it applies to `env`/`headers`; hiding `args` would
|
|
90
|
+
also hide the launch command a reviewer needs to actually understand what a server does).
|
|
91
|
+
|
|
92
|
+
**Two client config formats, confirmed live, not from memory**: Claude Code's `.mcp.json`
|
|
93
|
+
(`code.claude.com/docs/en/mcp`) requires an explicit `type` on any `url`-having entry — Claude
|
|
94
|
+
Code itself treats a bare `url` with no `type` as a configuration error and skips that server;
|
|
95
|
+
`src/charter/parsers/claude_code.py` mirrors that exact real behavior rather than guessing a
|
|
96
|
+
transport Claude Code itself wouldn't have used. Cursor's `.cursor/mcp.json`
|
|
97
|
+
(`cursor.com/docs/context/mcp`) has no `type` field at all — presence of `command` vs. `url`
|
|
98
|
+
is what distinguishes stdio from remote, and Cursor's own docs don't expose a separate SSE/
|
|
99
|
+
WebSocket distinction the way Claude Code's `type` does, so every Cursor remote entry is
|
|
100
|
+
recorded as `http`, a documented limitation of what the format itself reveals. `envFile` and
|
|
101
|
+
`auth` (real fields in Cursor's format) aren't read yet — left for a later slice rather than
|
|
102
|
+
half-modeled now.
|
|
103
|
+
|
|
104
|
+
**`keel.collect.line_tracking`**: charter's two parsers get real `evidence_line` values from
|
|
105
|
+
the exact same line-tracking YAML/JSON loader telltale's own parsers already used — extracted
|
|
106
|
+
from `apps/telltale/src/telltale/yaml_lines.py` into `packages/keel` this session, since
|
|
107
|
+
charter's need for it was genuinely identical, not merely similar (see
|
|
108
|
+
`packages/keel/README.md`'s own Session 15 note for the full extraction story).
|
|
109
|
+
|
|
110
|
+
**Verified for real** against a fixture covering all three interesting cases at once — a
|
|
111
|
+
stdio server with a real credential env var, a remote HTTP server with a real credential
|
|
112
|
+
header, and a `url`-with-no-`type` misconfigured entry — before any of this shipped: ran
|
|
113
|
+
`charter scan` against it, confirmed the misconfigured entry was correctly skipped, confirmed
|
|
114
|
+
the terminal output and `charter.lock` both showed `AIRTABLE_API_KEY`/`Authorization` as
|
|
115
|
+
*names* and never the planted fake secret *values*, and confirmed a Cursor-format server in
|
|
116
|
+
`.cursor/mcp.json` with a connection-string-in-args was captured (which is what surfaced the
|
|
117
|
+
`args`-verbatim design note above).
|
|
118
|
+
|
|
119
|
+
**Slice 2, part 1 (Session 15): live enumeration.**
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
uv run --package foretop-charter charter scan <path> --enumerate
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
DEC-02: "launching third-party servers is a security decision the user must make consciously"
|
|
126
|
+
— static parsing (Slice 1) never launches anything; `--enumerate` does, so it's opt-in and
|
|
127
|
+
never the default. Stdio servers only for now — remote (http/sse/ws) enumeration would mean
|
|
128
|
+
building an OAuth-capable HTTP+SSE MCP client, real scope creep beyond what this slice needs;
|
|
129
|
+
a documented gap, not a silent one.
|
|
130
|
+
|
|
131
|
+
`src/charter/enumerate.py` is a real MCP client speaking the classic
|
|
132
|
+
`initialize` → `notifications/initialized` → `tools/list` handshake over newline-delimited
|
|
133
|
+
JSON-RPC on the child's stdin/stdout — built from `modelcontextprotocol.io`'s own lifecycle
|
|
134
|
+
and stdio-transport spec pages, fetched live this session, not from memory. Deliberately pinned
|
|
135
|
+
to protocol version `2025-06-18` rather than the `2026-07-28` draft's newer
|
|
136
|
+
`server/discover`-based "modern" era: essentially no real-world server speaks the new one yet,
|
|
137
|
+
and specs/charter.md §11 already names protocol churn as an ongoing risk to revisit, not solve
|
|
138
|
+
preemptively.
|
|
139
|
+
|
|
140
|
+
**A hard timeout, and a real one** — a background thread runs the whole exchange, an overall
|
|
141
|
+
`queue.Queue.get(timeout=...)` bounds it, and shutdown always follows the spec's own sequence
|
|
142
|
+
(close stdin → wait → `SIGTERM` → `SIGKILL`). Verified for real, not asserted: a dedicated
|
|
143
|
+
`--sleep-forever` mode in the test fixture below proves a hung server is actually killed within
|
|
144
|
+
the timeout, not left running — `ps aux` was checked by hand after the first run to confirm no
|
|
145
|
+
orphaned process was left behind before this shipped.
|
|
146
|
+
|
|
147
|
+
**`${VAR}`/`${VAR:-default}` expansion** — Claude Code's own documented syntax
|
|
148
|
+
(`code.claude.com/docs/en/mcp`, fetched live). A real server needs its real `command`/`args`/
|
|
149
|
+
`env` values to actually launch, which `Server` itself never carries (DEC-06). `_resolve_launch`
|
|
150
|
+
re-reads the original config entry for exactly the one server being enumerated and resolves
|
|
151
|
+
values only as local variables inside `enumerate.py`'s own call stack, passed straight into
|
|
152
|
+
`subprocess.Popen`'s `env=` — never assigned to any field, logged, or serialized anywhere else.
|
|
153
|
+
Confirmed by a dedicated test that plants a fake secret value and asserts it never appears in
|
|
154
|
+
`repr()` of the result.
|
|
155
|
+
|
|
156
|
+
**`tests/fixtures/toy_mcp_server.py`**: a real, minimal MCP server, hand-written from the same
|
|
157
|
+
spec pages `enumerate.py` was built against — no MCP SDK, no charter code — so a passing test
|
|
158
|
+
against it is evidence the wire protocol handling actually works against a real subprocess
|
|
159
|
+
exchanging real messages, not just that two halves of a mock agree with each other. Supports
|
|
160
|
+
`--fail-tools-list`, `--crash-on-init`, `--sleep-forever` flags to exercise every failure mode
|
|
161
|
+
`enumerate_stdio_server` has to degrade through.
|
|
162
|
+
|
|
163
|
+
**Lock file schema v2**: adds `tools`/`enumeration_error` per server, three states mirroring
|
|
164
|
+
telltale's own three-state coverage discipline — `tools: null` means not attempted (a plain
|
|
165
|
+
scan, or this server isn't stdio), `tools: []` means attempted and the server genuinely
|
|
166
|
+
advertised none, and a real tools array means it succeeded. Never conflating "we didn't check"
|
|
167
|
+
with "we checked and found nothing" is the same principle either way.
|
|
168
|
+
|
|
169
|
+
Verified end-to-end for real: `charter scan --enumerate` against a config pointing at the toy
|
|
170
|
+
server, confirming the terminal output and `charter.lock` both show the two real discovered
|
|
171
|
+
tools (`read_file`, `write_file`) with their real input schemas.
|
|
172
|
+
|
|
173
|
+
**Slice 2, part 2 (Session 15): the rules-only capability classifier.**
|
|
174
|
+
|
|
175
|
+
`src/charter/capability.py` classifies every tool live enumeration discovers into
|
|
176
|
+
specs/charter.md §2.2's exact five categories (`read`/`write`/`network_egress`/
|
|
177
|
+
`code_execution`/`credential_access`) — DEC-03's rules-only choice, no LLM. A tool can match
|
|
178
|
+
more than one: `web_search` is both `read` (returns information) and `network_egress` (makes
|
|
179
|
+
an outbound call) — under-reporting either would hide something real. Overall severity is the
|
|
180
|
+
*maximum* across every capability a tool matched (`credential_access`/`code_execution` →
|
|
181
|
+
CRITICAL, `write` → HIGH, `network_egress` → MEDIUM, `read` → LOW), per specs/charter.md's own
|
|
182
|
+
accuracy strategy: "errs toward higher severity; a misclassified-as-dangerous tool is
|
|
183
|
+
annoying, the reverse is a breach." An unrecognized tool matches nothing and gets `unknown`
|
|
184
|
+
(`capabilities: []`, severity MEDIUM) — a real, honest verdict, not guessed at, and not
|
|
185
|
+
silently treated as safe either.
|
|
186
|
+
|
|
187
|
+
Rules live in one versioned YAML file with a changelog
|
|
188
|
+
(`src/charter/rules/capability_taxonomy.yaml`, specs/charter.md §6's explicit requirement),
|
|
189
|
+
matched by substring on the tool's lowercased name/description and by lowercased input-schema
|
|
190
|
+
property-name membership — deliberately simple, the same "good enough, not semantically
|
|
191
|
+
perfect" scope call telltale's own PromQL/OTTL condition matching already makes. Patterns were
|
|
192
|
+
derived from real tool-naming conventions seen across the official filesystem/GitHub/Slack/
|
|
193
|
+
Postgres MCP servers and the `tools/list` spec's own examples, not invented from nothing. A
|
|
194
|
+
real accuracy floor (golden corpus, precision/recall) is Slice 3's job, not this file's.
|
|
195
|
+
|
|
196
|
+
Lock file schema v3 adds `capabilities`/`severity`/`rule_version` per tool — capabilities are
|
|
197
|
+
sorted before serializing, not left in `frozenset` iteration order, which Python does not
|
|
198
|
+
guarantee stable across separate process runs (string-hash randomization);
|
|
199
|
+
`test_capabilities_are_sorted_for_byte_stability` guards this directly.
|
|
200
|
+
|
|
201
|
+
**A real bug, found before this shipped, not after**: the terminal renderer's Tools column
|
|
202
|
+
started annotating each tool name with its severity (`read_file [low]`), and a smoke test
|
|
203
|
+
against a real enumerated server showed the `[low]`/`[high]` suffix silently vanishing —
|
|
204
|
+
Rich's `Table` parses plain cell strings as its own markup language, and `[low]` isn't a
|
|
205
|
+
recognized style tag, so Rich absorbed it instead of erroring. Worse: a tool name or
|
|
206
|
+
enumeration-error string containing real markup syntax (`[/bold red]`) didn't just render
|
|
207
|
+
oddly, it **crashed** the renderer outright (`rich.errors.MarkupError`) — confirmed by
|
|
208
|
+
deliberately reverting the fix and re-running the test suite before shipping, not just
|
|
209
|
+
reasoned about. Tool names and error messages come verbatim from a live, untrusted third-party
|
|
210
|
+
server's own response (DEC-02's whole point), so every dynamic value reaching Rich now goes
|
|
211
|
+
through `rich.markup.escape` — server-config strings and, especially, anything sourced from a
|
|
212
|
+
live server's own output. Regression tests plant literal `[...]` sequences in a tool name, a
|
|
213
|
+
server name, and an enumeration error to prove none of them can vanish or crash rendering
|
|
214
|
+
again.
|
|
215
|
+
|
|
216
|
+
Verified end-to-end for real: `charter scan --enumerate` against the toy server, confirming
|
|
217
|
+
`read_file [low], write_file [high]` (or the equivalent ANSI-colored form) actually appears in
|
|
218
|
+
both the terminal table and matches `charter.lock`'s own `capabilities`/`severity` fields.
|
|
219
|
+
|
|
220
|
+
**Slice 3 (Session 16): markdown/SARIF renderers, the capability classifier's golden corpus,
|
|
221
|
+
and the CI accuracy gate.**
|
|
222
|
+
|
|
223
|
+
**Scope calls, same style as Session 15's:** no differ yet — `specs/charter.md`'s FR-006
|
|
224
|
+
"capability diff" PR comment needs one, and Session 15's own note already deferred that ("git's
|
|
225
|
+
own diff on the committed `charter.lock` is the review mechanism" until a real one exists);
|
|
226
|
+
building it belongs with the Action work in Session 17, where it has an actual consumer. So
|
|
227
|
+
`render_markdown`/`render_sarif` (`src/charter/render/markdown.py`,
|
|
228
|
+
`src/charter/render/sarif.py`) show the **current scan snapshot** — the same content
|
|
229
|
+
`render_terminal` already shows, reformatted — not a before/after. No JSON renderer either:
|
|
230
|
+
spec §6 lists `markdown | sarif | json`, but `charter.lock` (schema v3) already *is* the
|
|
231
|
+
canonical JSON artifact; a second one would just duplicate it. `charter scan --format
|
|
232
|
+
{table,markdown,sarif}` selects the display format (default `table`, unchanged); `charter.lock`
|
|
233
|
+
is still always written regardless.
|
|
234
|
+
|
|
235
|
+
**SARIF locations point at the server's config source**, not the tool — `server.source_file`/
|
|
236
|
+
`server.source_line`, since a live-enumerated tool has no line of its own to point at (DEC-02:
|
|
237
|
+
it comes from a `tools/list` call, not static text). Severity collapses charter's four levels
|
|
238
|
+
into SARIF's three real ones the same way ebb's own `render/sarif.py` does:
|
|
239
|
+
`LOW→note, MEDIUM→warning, HIGH→error, CRITICAL→error`. A tool matching more than one
|
|
240
|
+
capability produces one SARIF result per capability, same "don't under-report" stance
|
|
241
|
+
`capability.py`'s own docstring takes for `Classification.capabilities`. `--format sarif`
|
|
242
|
+
without `--enumerate` is not an error — it prints the full rule catalog with zero results,
|
|
243
|
+
since there's genuinely nothing to report yet.
|
|
244
|
+
|
|
245
|
+
**The golden corpus** (`tests/golden/<capability>/<NN_name>/tool.json`,
|
|
246
|
+
`tests/golden_manifest.yaml`, `tests/unit/test_golden_corpus.py`) scores the rules-only
|
|
247
|
+
classifier per capability group — never pooled into one aggregate, same "an average must never
|
|
248
|
+
hide one broken group" discipline `apps/ebb/tests/unit/test_golden_corpus.py` established —
|
|
249
|
+
against the same `PRECISION_FLOOR = 0.95` / `RECALL_FLOOR = 0.85` every other product in this
|
|
250
|
+
suite uses. 30 fixtures across six groups (the five `CapabilityClass` values plus `unknown`),
|
|
251
|
+
grounded in real tool definitions from the actual official filesystem/GitHub/Slack/Puppeteer/
|
|
252
|
+
Brave-Search MCP servers the taxonomy's own changelog already cites — not invented vocabulary.
|
|
253
|
+
Every group with an expected capability carries at least one pure-decoy fixture (a tool that
|
|
254
|
+
shares surface vocabulary with a real match without containing the actual matched pattern —
|
|
255
|
+
e.g. `readiness_probe`, which contains "read" but not the `read_`/`_read` substrings the rules
|
|
256
|
+
actually check for), enforced by its own test so a rule that over-matches can't hide behind
|
|
257
|
+
fixtures that only ever offer true positives. `golden/unknown/` is exempt from that
|
|
258
|
+
requirement: every one of its fixtures is already a negative case by construction.
|
|
259
|
+
|
|
260
|
+
**A real precision bug, found by the corpus before it shipped, not after**: `get_pull_request`
|
|
261
|
+
(a real GitHub MCP tool) was classified `network_egress` in addition to the correct `read` —
|
|
262
|
+
network_egress's bare `"request"` name pattern matched the substring "request" inside
|
|
263
|
+
"pull_**request**", nothing to do with an actual outbound call. The same bug would have hit
|
|
264
|
+
`create_merge_request`, `approve_service_request`, or any other tool whose name merely contains
|
|
265
|
+
the English word "request". Fixed in `capability_taxonomy.yaml` v2 (changelog entry in the file
|
|
266
|
+
itself): bare `"request"` replaced with the specific compound forms a real HTTP-client-shaped
|
|
267
|
+
tool actually uses — `http_request`, `api_request`, `make_request`, `send_request`,
|
|
268
|
+
`web_request`. Confirmed by re-running the full corpus before and after: 0.800 precision on
|
|
269
|
+
`read` before the fix, 1.000 after, every other group unaffected.
|
|
270
|
+
|
|
271
|
+
Verified end-to-end for real: `charter scan --enumerate --format markdown` and `--format sarif`
|
|
272
|
+
against the toy server, confirming real tool names/capabilities/severities appear in both, the
|
|
273
|
+
`--format sarif` SARIF log validates as well-formed JSON with the expected rule catalog, and
|
|
274
|
+
neither renderer leaks a planted fake secret value from a config fixture that has one (only the
|
|
275
|
+
existing `AIRTABLE_API_KEY` *name*, never its value — DEC-06, same check Slice 1 and 2 each
|
|
276
|
+
ran). `make accuracy-charter` reports 1.000 precision / 1.000 recall on every scored group.
|
|
277
|
+
|
|
278
|
+
**Slice 4 (Session 17): the capability-drift gate, the composite Action, PR comment, and
|
|
279
|
+
publish-prep.**
|
|
280
|
+
|
|
281
|
+
**The gap this session closes:** unlike ebb (`--fail-on`) and telltale (regression-vs-merge-
|
|
282
|
+
base), charter's `scan` had no failure condition at all through Session 16 — a naive Action
|
|
283
|
+
would only ever comment, never fail a PR, undercutting the product's own pitch ("fails CI when
|
|
284
|
+
an update quietly expands what the agent can reach"). `charter scan --base <ref>` now exits 1
|
|
285
|
+
when a new server appears, or an existing tool's capability severity increases, since the
|
|
286
|
+
merge base — never an absolute threshold, mirroring telltale's own regression-only philosophy
|
|
287
|
+
exactly (`src/charter/drift.py`).
|
|
288
|
+
|
|
289
|
+
**The baseline is the committed `charter.lock`, not a live re-scan** — DEC-04's own framing
|
|
290
|
+
("`charter.lock` *is* the review mechanism") drives this directly: `charter/git_ref.py`'s
|
|
291
|
+
`show_file_at_ref` reads the lock file's content at the merge base via `git show`, never
|
|
292
|
+
launching whatever third-party MCP server versions existed at an old commit the way telltale's
|
|
293
|
+
worktree-based `--base` has to (it has no single lockfile-shaped artifact to diff against).
|
|
294
|
+
`toplevel`/`merge_base`/`GitError` moved to `packages/keel/src/keel/git_ref.py` this session —
|
|
295
|
+
pure git plumbing telltale's own `git_ref.py` already had, extracted because charter needed
|
|
296
|
+
the identical thing (same "genuinely identical, not merely similar" bar Session 15 used to
|
|
297
|
+
extract `keel.collect.line_tracking`); telltale now re-imports them, keeping only its
|
|
298
|
+
telltale-specific `checkout_ref`.
|
|
299
|
+
|
|
300
|
+
**A real, honest limitation, not a silent one**: tool-level drift (`NEW_TOOL`/
|
|
301
|
+
`SEVERITY_INCREASED`) is only computed when *both* the current scan and the baseline commit
|
|
302
|
+
were `--enumerate`'d — a server that wasn't enumerated on either side has nothing honest to
|
|
303
|
+
compare (not "no tools", not "no drift", just unknown), the same null/empty/populated
|
|
304
|
+
discipline `lockfile.py`'s own `tools: null` already encodes. `NEW_SERVER` drift has no such
|
|
305
|
+
limitation — a server's mere presence in the config is real evidence regardless of
|
|
306
|
+
enumeration.
|
|
307
|
+
|
|
308
|
+
**`apps/charter/action.yml`** (subpath, not the repo root — ebb already claimed that):
|
|
309
|
+
`enumerate` defaults to `"false"` (DEC-02 extended to the Action layer — launching third-party
|
|
310
|
+
servers in a shared CI runner is still a conscious opt-in, not a default; the documented
|
|
311
|
+
consequence is that only `NEW_SERVER` drift fires out of the box), `base` defaults to the PR's
|
|
312
|
+
base SHA (the gate itself *does* default on, unlike `enumerate` — matching telltale's own
|
|
313
|
+
`base` default). Steps mirror `apps/telltale/action.yml` exactly: scan with `--format
|
|
314
|
+
annotations` → render `--format markdown` for the sticky PR comment → upsert by marker
|
|
315
|
+
(`apps/charter/scripts/upsert_pr_comment.sh`, a byte-identical copy of the generic root-level
|
|
316
|
+
script) → fail on the captured exit code.
|
|
317
|
+
|
|
318
|
+
**Annotations, not a SARIF-upload step, for inline PR feedback** — verified live against
|
|
319
|
+
GitHub's own code-scanning docs before deciding: `github/codeql-action/upload-sarif` needs
|
|
320
|
+
`security-events: write` and, on private repos, GitHub Advanced Security/Code Security enabled.
|
|
321
|
+
Workflow-command annotations (`src/charter/render/annotations.py`, same
|
|
322
|
+
`::error file=...,line=...::` mechanism and escaping helpers ebb's and telltale's own
|
|
323
|
+
`render/annotations.py` use, duplicated on purpose) need neither — zero extra permissions, works
|
|
324
|
+
on every plan — so that's the composite Action's default. SARIF (`render/sarif.py`) stays
|
|
325
|
+
available for anyone who wants to wire their own upload step; it was not extended with a drift
|
|
326
|
+
section this session (still a snapshot renderer, Session 16's own call) since annotations
|
|
327
|
+
already cover the narrative-diff job.
|
|
328
|
+
|
|
329
|
+
**Publish-prep, matching `docs/adr/0002-ebb-public-mirror.md` and telltale's own Session 16
|
|
330
|
+
boundary exactly**: `.github/workflows/charter-release.yml` (tag prefix `charter-v*`),
|
|
331
|
+
`scripts/mirror-workflows/charter-{ci,release}.yml`, and `scripts/sync-charter-mirror.sh` were
|
|
332
|
+
added, but the script was **not run against a real repo**. `apps/charter/LICENSE` (Apache-2.0,
|
|
333
|
+
"the foretop authors", byte-identical to ebb's/telltale's own) is new; `license-files =
|
|
334
|
+
["LICENSE"]` added to `pyproject.toml` and verified for real by building the wheel and
|
|
335
|
+
confirming `LICENSE` lands in `dist-info/licenses/` — telltale's own Session 16 found this
|
|
336
|
+
missing the hard way, so it was checked directly this time rather than assumed. The
|
|
337
|
+
`foretop-charter`/`charter` dual script entries telltale's Session 16 had to add were already
|
|
338
|
+
both present in charter's `pyproject.toml` from Slice 1 — nothing to fix there.
|
|
339
|
+
|
|
340
|
+
**Still the user's job, not this session's** (`NEXT_STEPS.md` Track A, same split every
|
|
341
|
+
predecessor used): creating the `foretop-dev/charter` repo, actually running
|
|
342
|
+
`sync-charter-mirror.sh`, creating the `foretop-charter` PyPI project, configuring its trusted
|
|
343
|
+
publisher (owner `foretop-dev`, repository `charter`, workflow `release.yml`, environment
|
|
344
|
+
`pypi`), cutting a `charter-v0.1.0` release, and Marketplace submission. The `foretop-keel`
|
|
345
|
+
workspace-only dependency problem `packages/keel/README.md` used to document as unresolved for
|
|
346
|
+
this mirror (and ebb's/telltale's) is fixed as of a later session — see that file's own
|
|
347
|
+
"Packaging note" — `scripts/sync-charter-mirror.sh` now vendors the exact `keel` submodules
|
|
348
|
+
charter imports (`git_ref.py`, `collect/line_tracking.py`) into the mirror at sync time.
|
|
349
|
+
|
|
350
|
+
Verified end-to-end for real: a real git repo fixture (commit a `charter.lock` with one
|
|
351
|
+
server, branch, add a second server) drives `charter scan --base <branch>` to exit 1 with a
|
|
352
|
+
`NEW_SERVER` finding visible in both `--format annotations` and `--format markdown`; an
|
|
353
|
+
unrelated change on the same branch exits 0; an unknown `--base` ref exits 2. `make check`
|
|
354
|
+
passes across `packages/keel`, `apps/telltale`, and `apps/charter` together, confirming the
|
|
355
|
+
`keel.git_ref` extraction didn't regress telltale.
|