catch-the-gist 0.0.3__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 (82) hide show
  1. catch_the_gist-0.0.3/.gitignore +12 -0
  2. catch_the_gist-0.0.3/LICENSE +202 -0
  3. catch_the_gist-0.0.3/NOTICE +4 -0
  4. catch_the_gist-0.0.3/PKG-INFO +77 -0
  5. catch_the_gist-0.0.3/README.md +61 -0
  6. catch_the_gist-0.0.3/pyproject.toml +51 -0
  7. catch_the_gist-0.0.3/src/catch_the_gist/__init__.py +1 -0
  8. catch_the_gist-0.0.3/src/catch_the_gist/__main__.py +3 -0
  9. catch_the_gist-0.0.3/src/catch_the_gist/cache.py +66 -0
  10. catch_the_gist-0.0.3/src/catch_the_gist/cli.py +112 -0
  11. catch_the_gist-0.0.3/src/catch_the_gist/core/__init__.py +0 -0
  12. catch_the_gist-0.0.3/src/catch_the_gist/core/chunk.py +45 -0
  13. catch_the_gist-0.0.3/src/catch_the_gist/core/frontmatter.py +50 -0
  14. catch_the_gist-0.0.3/src/catch_the_gist/core/lockfile.py +84 -0
  15. catch_the_gist-0.0.3/src/catch_the_gist/core/provenance.py +47 -0
  16. catch_the_gist-0.0.3/src/catch_the_gist/core/skillwriter.py +263 -0
  17. catch_the_gist-0.0.3/src/catch_the_gist/core/validate.py +323 -0
  18. catch_the_gist-0.0.3/src/catch_the_gist/errors.py +26 -0
  19. catch_the_gist-0.0.3/src/catch_the_gist/ids.py +13 -0
  20. catch_the_gist-0.0.3/src/catch_the_gist/ingest/__init__.py +12 -0
  21. catch_the_gist-0.0.3/src/catch_the_gist/ingest/registry.py +36 -0
  22. catch_the_gist-0.0.3/src/catch_the_gist/ingest/text.py +195 -0
  23. catch_the_gist-0.0.3/src/catch_the_gist/install/__init__.py +0 -0
  24. catch_the_gist-0.0.3/src/catch_the_gist/install/installer.py +171 -0
  25. catch_the_gist-0.0.3/src/catch_the_gist/install/targets.py +22 -0
  26. catch_the_gist-0.0.3/src/catch_the_gist/mcp_server.py +97 -0
  27. catch_the_gist-0.0.3/src/catch_the_gist/prompts/write-skill.md +11 -0
  28. catch_the_gist-0.0.3/src/catch_the_gist/schema.py +180 -0
  29. catch_the_gist-0.0.3/src/catch_the_gist/service.py +134 -0
  30. catch_the_gist-0.0.3/tests/conftest.py +6 -0
  31. catch_the_gist-0.0.3/tests/fixtures/skills/bad/anchor.unresolved/demo-skill/PROVENANCE.json +22 -0
  32. catch_the_gist-0.0.3/tests/fixtures/skills/bad/anchor.unresolved/demo-skill/SKILL.md +12 -0
  33. catch_the_gist-0.0.3/tests/fixtures/skills/bad/body.est-tokens/demo-skill/SKILL.md +91 -0
  34. catch_the_gist-0.0.3/tests/fixtures/skills/bad/body.max-lines/demo-skill/SKILL.md +521 -0
  35. catch_the_gist-0.0.3/tests/fixtures/skills/bad/description.angle-brackets/demo-skill/SKILL.md +12 -0
  36. catch_the_gist-0.0.3/tests/fixtures/skills/bad/description.length/demo-skill/SKILL.md +12 -0
  37. catch_the_gist-0.0.3/tests/fixtures/skills/bad/description.trigger/demo-skill/SKILL.md +12 -0
  38. catch_the_gist-0.0.3/tests/fixtures/skills/bad/frontmatter.metadata-type/demo-skill/SKILL.md +12 -0
  39. catch_the_gist-0.0.3/tests/fixtures/skills/bad/frontmatter.missing/demo-skill/SKILL.md +3 -0
  40. catch_the_gist-0.0.3/tests/fixtures/skills/bad/frontmatter.unknown-key/demo-skill/SKILL.md +13 -0
  41. catch_the_gist-0.0.3/tests/fixtures/skills/bad/link.broken/demo-skill/SKILL.md +12 -0
  42. catch_the_gist-0.0.3/tests/fixtures/skills/bad/link.depth/demo-skill/SKILL.md +12 -0
  43. catch_the_gist-0.0.3/tests/fixtures/skills/bad/link.depth/demo-skill/references/a.md +3 -0
  44. catch_the_gist-0.0.3/tests/fixtures/skills/bad/link.depth/demo-skill/references/b.md +3 -0
  45. catch_the_gist-0.0.3/tests/fixtures/skills/bad/name.folder-mismatch/demo-skill/SKILL.md +12 -0
  46. catch_the_gist-0.0.3/tests/fixtures/skills/bad/name.pattern/Bad_Name/SKILL.md +12 -0
  47. catch_the_gist-0.0.3/tests/fixtures/skills/bad/name.reserved/claude-helper/SKILL.md +12 -0
  48. catch_the_gist-0.0.3/tests/fixtures/skills/bad/provenance.local-path/demo-skill/PROVENANCE.json +23 -0
  49. catch_the_gist-0.0.3/tests/fixtures/skills/bad/provenance.local-path/demo-skill/SKILL.md +12 -0
  50. catch_the_gist-0.0.3/tests/fixtures/skills/bad/reference.toc/demo-skill/SKILL.md +12 -0
  51. catch_the_gist-0.0.3/tests/fixtures/skills/bad/reference.toc/demo-skill/references/long.md +122 -0
  52. catch_the_gist-0.0.3/tests/fixtures/skills/bad/secret.detected/demo-skill/SKILL.md +12 -0
  53. catch_the_gist-0.0.3/tests/fixtures/skills/good/demo-skill/PROVENANCE.json +31 -0
  54. catch_the_gist-0.0.3/tests/fixtures/skills/good/demo-skill/SKILL.md +15 -0
  55. catch_the_gist-0.0.3/tests/fixtures/skills/good/demo-skill/references/long.md +117 -0
  56. catch_the_gist-0.0.3/tests/fixtures/skills/good/demo-skill/references/topic.md +3 -0
  57. catch_the_gist-0.0.3/tests/fixtures/skills/good/no-anchors-skill/SKILL.md +13 -0
  58. catch_the_gist-0.0.3/tests/fixtures/text/bom_crlf.srt +16 -0
  59. catch_the_gist-0.0.3/tests/fixtures/text/dupes.md +9 -0
  60. catch_the_gist-0.0.3/tests/fixtures/text/empty.md +3 -0
  61. catch_the_gist-0.0.3/tests/fixtures/text/guide.md +23 -0
  62. catch_the_gist-0.0.3/tests/fixtures/text/latin1.txt +1 -0
  63. catch_the_gist-0.0.3/tests/fixtures/text/notes.txt +6 -0
  64. catch_the_gist-0.0.3/tests/fixtures/text/talk.srt +16 -0
  65. catch_the_gist-0.0.3/tests/fixtures/text/talk.vtt +20 -0
  66. catch_the_gist-0.0.3/tests/test_cache.py +73 -0
  67. catch_the_gist-0.0.3/tests/test_chunk.py +82 -0
  68. catch_the_gist-0.0.3/tests/test_cli.py +83 -0
  69. catch_the_gist-0.0.3/tests/test_cli_version.py +9 -0
  70. catch_the_gist-0.0.3/tests/test_docs.py +17 -0
  71. catch_the_gist-0.0.3/tests/test_errors.py +23 -0
  72. catch_the_gist-0.0.3/tests/test_ingest_text.py +120 -0
  73. catch_the_gist-0.0.3/tests/test_installer.py +251 -0
  74. catch_the_gist-0.0.3/tests/test_lockfile.py +70 -0
  75. catch_the_gist-0.0.3/tests/test_mcp_contract.py +105 -0
  76. catch_the_gist-0.0.3/tests/test_mcp_server.py +115 -0
  77. catch_the_gist-0.0.3/tests/test_plugin_manifests.py +125 -0
  78. catch_the_gist-0.0.3/tests/test_provenance.py +59 -0
  79. catch_the_gist-0.0.3/tests/test_schema.py +117 -0
  80. catch_the_gist-0.0.3/tests/test_service.py +110 -0
  81. catch_the_gist-0.0.3/tests/test_skillwriter.py +383 -0
  82. catch_the_gist-0.0.3/tests/test_validate.py +156 -0
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .coverage
9
+ .venv/
10
+ .catch-the-gist/
11
+ out/
12
+ .superpowers/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ catch-the-gist
2
+ Copyright 2026 Brainferno
3
+
4
+ This product includes software developed at Brainferno.
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.5
2
+ Name: catch-the-gist
3
+ Version: 0.0.3
4
+ Summary: Turn sources into Agent Skills.
5
+ Project-URL: Homepage, https://github.com/Brainferno/catch-the-gist
6
+ Project-URL: Source, https://github.com/Brainferno/catch-the-gist
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: mcp<3,>=2.3
12
+ Requires-Dist: pydantic>=2.8
13
+ Requires-Dist: pyyaml>=6
14
+ Requires-Dist: typer>=0.12
15
+ Description-Content-Type: text/markdown
16
+
17
+ # catch-the-gist
18
+
19
+ catch-the-gist turns documents, transcripts and notes into Agent Skills for Claude Code and Codex. Your coding agent reads the source in chunks through a small set of deterministic MCP tools, drafts the skill with you, and catch-the-gist writes, validates and installs it. Every instruction in the generated skill carries a provenance anchor that points back to the source passage it came from.
20
+
21
+ ## What works in 0.0.3
22
+
23
+ - Text sources only: `.md`, `.markdown`, `.txt`, `.srt` and `.vtt` files. Video, PDF, images and other formats arrive in later sub-projects.
24
+ - Agent mode only: the agent you already run does the reading and writing. catch-the-gist itself makes no model calls.
25
+ - Output is a standard Agent Skill folder (`SKILL.md`, `references/`, `PROVENANCE.json`), installed to `.agents/skills/<name>` with a symlink at `.claude/skills/<name>` (project scope) or the equivalent under your home directory (user scope).
26
+
27
+ ## Install the plugin
28
+
29
+ Claude Code:
30
+
31
+ ```
32
+ /plugin marketplace add Brainferno/catch-the-gist
33
+ /plugin install catch-the-gist@catch-the-gist
34
+ ```
35
+
36
+ Codex: add the same repository as a plugin marketplace (it ships `.agents/plugins/marketplace.json`) and install `catch-the-gist` from it.
37
+
38
+ The plugin starts the MCP server with `uvx`, pinned to the `v0.0.3` tag of the GitHub repository. To run Claude Code against a local checkout instead:
39
+
40
+ ```
41
+ git clone https://github.com/Brainferno/catch-the-gist
42
+ CATCH_THE_GIST_FROM=$PWD/catch-the-gist claude --plugin-dir ./catch-the-gist/plugin
43
+ ```
44
+
45
+ You need `uv` installed (`uvx` must be on your PATH).
46
+
47
+ ## Use it
48
+
49
+ In Claude Code:
50
+
51
+ ```
52
+ /catch-the-gist:catch-the-gist path/to/notes.md
53
+ ```
54
+
55
+ The agent ingests the file, reads its chunks, proposes a skill name and description, and waits for your confirmation before writing and installing it.
56
+
57
+ ## CLI
58
+
59
+ The same package has a command line for the deterministic steps. From a clone, run the commands with `uv run` inside the checkout, as below; after the PyPI release you can drop the `uv run` prefix and call `catch-the-gist` directly.
60
+
61
+ ```
62
+ uv run catch-the-gist version
63
+ uv run catch-the-gist ingest path/to/notes.md [--json]
64
+ uv run catch-the-gist validate .agents/skills/<name> [--json]
65
+ uv run catch-the-gist install <skill-dir> [--scope project|user] [--agent claude-code|codex] [--force] [--copy] [--json]
66
+ uv run catch-the-gist mcp
67
+ ```
68
+
69
+ `ctgist` is a short alias for `catch-the-gist` and takes the same commands. `validate` exits 8 when the skill has errors. Set `CATCH_THE_GIST_WORKDIR` to run somewhere other than the current directory; the cache lives in `<workdir>/.catch-the-gist/cache`.
70
+
71
+ ## Privacy
72
+
73
+ catch-the-gist itself makes no network calls and reads no credentials, including nothing under `~/.claude`. It never calls `claude` or `codex`. The one network access is outside the code: `uvx` downloads the package (and its Python dependencies) the first time the plugin starts the server, and it may also download a Python 3.13 interpreter on that first run. Your sources stay on your machine, and what your agent does with the chunks it reads is governed by that agent's own settings.
74
+
75
+ ## License
76
+
77
+ Apache-2.0. See `LICENSE` and `NOTICE`.
@@ -0,0 +1,61 @@
1
+ # catch-the-gist
2
+
3
+ catch-the-gist turns documents, transcripts and notes into Agent Skills for Claude Code and Codex. Your coding agent reads the source in chunks through a small set of deterministic MCP tools, drafts the skill with you, and catch-the-gist writes, validates and installs it. Every instruction in the generated skill carries a provenance anchor that points back to the source passage it came from.
4
+
5
+ ## What works in 0.0.3
6
+
7
+ - Text sources only: `.md`, `.markdown`, `.txt`, `.srt` and `.vtt` files. Video, PDF, images and other formats arrive in later sub-projects.
8
+ - Agent mode only: the agent you already run does the reading and writing. catch-the-gist itself makes no model calls.
9
+ - Output is a standard Agent Skill folder (`SKILL.md`, `references/`, `PROVENANCE.json`), installed to `.agents/skills/<name>` with a symlink at `.claude/skills/<name>` (project scope) or the equivalent under your home directory (user scope).
10
+
11
+ ## Install the plugin
12
+
13
+ Claude Code:
14
+
15
+ ```
16
+ /plugin marketplace add Brainferno/catch-the-gist
17
+ /plugin install catch-the-gist@catch-the-gist
18
+ ```
19
+
20
+ Codex: add the same repository as a plugin marketplace (it ships `.agents/plugins/marketplace.json`) and install `catch-the-gist` from it.
21
+
22
+ The plugin starts the MCP server with `uvx`, pinned to the `v0.0.3` tag of the GitHub repository. To run Claude Code against a local checkout instead:
23
+
24
+ ```
25
+ git clone https://github.com/Brainferno/catch-the-gist
26
+ CATCH_THE_GIST_FROM=$PWD/catch-the-gist claude --plugin-dir ./catch-the-gist/plugin
27
+ ```
28
+
29
+ You need `uv` installed (`uvx` must be on your PATH).
30
+
31
+ ## Use it
32
+
33
+ In Claude Code:
34
+
35
+ ```
36
+ /catch-the-gist:catch-the-gist path/to/notes.md
37
+ ```
38
+
39
+ The agent ingests the file, reads its chunks, proposes a skill name and description, and waits for your confirmation before writing and installing it.
40
+
41
+ ## CLI
42
+
43
+ The same package has a command line for the deterministic steps. From a clone, run the commands with `uv run` inside the checkout, as below; after the PyPI release you can drop the `uv run` prefix and call `catch-the-gist` directly.
44
+
45
+ ```
46
+ uv run catch-the-gist version
47
+ uv run catch-the-gist ingest path/to/notes.md [--json]
48
+ uv run catch-the-gist validate .agents/skills/<name> [--json]
49
+ uv run catch-the-gist install <skill-dir> [--scope project|user] [--agent claude-code|codex] [--force] [--copy] [--json]
50
+ uv run catch-the-gist mcp
51
+ ```
52
+
53
+ `ctgist` is a short alias for `catch-the-gist` and takes the same commands. `validate` exits 8 when the skill has errors. Set `CATCH_THE_GIST_WORKDIR` to run somewhere other than the current directory; the cache lives in `<workdir>/.catch-the-gist/cache`.
54
+
55
+ ## Privacy
56
+
57
+ catch-the-gist itself makes no network calls and reads no credentials, including nothing under `~/.claude`. It never calls `claude` or `codex`. The one network access is outside the code: `uvx` downloads the package (and its Python dependencies) the first time the plugin starts the server, and it may also download a Python 3.13 interpreter on that first run. Your sources stay on your machine, and what your agent does with the chunks it reads is governed by that agent's own settings.
58
+
59
+ ## License
60
+
61
+ Apache-2.0. See `LICENSE` and `NOTICE`.
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "catch-the-gist"
7
+ version = "0.0.3"
8
+ description = "Turn sources into Agent Skills."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE", "NOTICE"]
13
+ dependencies = [
14
+ "pydantic>=2.8",
15
+ "typer>=0.12",
16
+ "pyyaml>=6",
17
+ "mcp>=2.3,<3",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/Brainferno/catch-the-gist"
22
+ Source = "https://github.com/Brainferno/catch-the-gist"
23
+
24
+ [project.scripts]
25
+ catch-the-gist = "catch_the_gist.cli:app"
26
+ ctgist = "catch_the_gist.cli:app"
27
+
28
+ [dependency-groups]
29
+ dev = [
30
+ "pytest>=8",
31
+ "pytest-cov",
32
+ "ruff",
33
+ "pyright",
34
+ ]
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/catch_the_gist"]
38
+
39
+ [tool.hatch.build.targets.sdist]
40
+ only-include = ["src", "tests", "README.md", "LICENSE", "NOTICE", "pyproject.toml"]
41
+
42
+ [tool.ruff]
43
+ line-length = 100
44
+ target-version = "py311"
45
+ extend-exclude = ["docs", "research", ".superpowers"]
46
+
47
+ [tool.pyright]
48
+ typeCheckingMode = "basic"
49
+
50
+ [tool.pytest.ini_options]
51
+ testpaths = ["tests"]
@@ -0,0 +1 @@
1
+ __version__ = "0.0.3"
@@ -0,0 +1,3 @@
1
+ from catch_the_gist.cli import app
2
+
3
+ app()
@@ -0,0 +1,66 @@
1
+ """Content-hash cache: JSON files under <workdir>/.catch-the-gist/cache/<stage>/<key>.json."""
2
+
3
+ import os
4
+ import re
5
+ import tempfile
6
+ from pathlib import Path
7
+ from typing import TypeVar
8
+
9
+ from pydantic import BaseModel
10
+
11
+ from catch_the_gist.errors import UsageError
12
+
13
+ T = TypeVar("T", bound=BaseModel)
14
+
15
+ _SAFE_NAME = re.compile(r"^[A-Za-z0-9_][A-Za-z0-9_.-]*$")
16
+
17
+
18
+ def workdir() -> Path:
19
+ env = os.environ.get("CATCH_THE_GIST_WORKDIR")
20
+ return (Path(env) if env else Path.cwd()).resolve()
21
+
22
+
23
+ def _check(kind: str, name: str) -> str:
24
+ if not _SAFE_NAME.fullmatch(name):
25
+ raise UsageError(
26
+ f"Invalid cache {kind}: {name!r}",
27
+ hint="Use only letters, digits, '_', '.', '-', and do not start with '.'.",
28
+ )
29
+ return name
30
+
31
+
32
+ class Cache:
33
+ def __init__(self, root: Path) -> None:
34
+ self.root = root
35
+
36
+ @classmethod
37
+ def for_workdir(cls, wd: Path) -> "Cache":
38
+ return cls(wd / ".catch-the-gist" / "cache")
39
+
40
+ def _path(self, stage: str, key: str) -> Path:
41
+ return self.root / _check("stage", stage) / f"{_check('key', key)}.json"
42
+
43
+ def put(self, stage: str, key: str, model: BaseModel) -> Path:
44
+ path = self._path(stage, key)
45
+ path.parent.mkdir(parents=True, exist_ok=True)
46
+ fd, tmp = tempfile.mkstemp(dir=path.parent, prefix=".tmp-", suffix=".json")
47
+ try:
48
+ with os.fdopen(fd, "w", encoding="utf-8") as f:
49
+ f.write(model.model_dump_json(indent=2))
50
+ os.replace(tmp, path)
51
+ except BaseException:
52
+ Path(tmp).unlink(missing_ok=True)
53
+ raise
54
+ return path
55
+
56
+ def get(self, stage: str, key: str, model_type: type[T]) -> T | None:
57
+ path = self._path(stage, key)
58
+ if not path.is_file():
59
+ return None
60
+ return model_type.model_validate_json(path.read_text(encoding="utf-8"))
61
+
62
+ def list(self, stage: str) -> list[str]:
63
+ directory = self.root / _check("stage", stage)
64
+ if not directory.is_dir():
65
+ return []
66
+ return sorted(p.stem for p in directory.glob("*.json") if not p.name.startswith("."))
@@ -0,0 +1,112 @@
1
+ import json
2
+ from collections.abc import Callable
3
+ from functools import wraps
4
+ from typing import Annotated, Any, Literal
5
+
6
+ import typer
7
+
8
+ from catch_the_gist import __version__, service
9
+ from catch_the_gist.cache import workdir
10
+ from catch_the_gist.errors import CatchTheGistError
11
+
12
+ app = typer.Typer(help="catch-the-gist: turn sources into Agent Skills.", no_args_is_help=True)
13
+
14
+ JsonOpt = Annotated[bool, typer.Option("--json", help="Print machine-readable JSON.")]
15
+ ALL_AGENTS = ["claude-code", "codex"]
16
+
17
+
18
+ def handled(fn: Callable[..., Any]) -> Callable[..., Any]:
19
+ """Turn CatchTheGistError into the documented error output and exit code."""
20
+
21
+ @wraps(fn)
22
+ def wrapper(*args: Any, **kwargs: Any) -> Any:
23
+ try:
24
+ return fn(*args, **kwargs)
25
+ except CatchTheGistError as exc:
26
+ if kwargs.get("as_json"):
27
+ err = {"type": type(exc).__name__, "message": exc.message, "hint": exc.hint}
28
+ typer.echo(json.dumps({"error": err}, indent=2))
29
+ else:
30
+ typer.echo(f"error: {exc.message}", err=True)
31
+ if exc.hint:
32
+ typer.echo(f"hint: {exc.hint}", err=True)
33
+ raise typer.Exit(exc.exit_code) from exc
34
+
35
+ return wrapper
36
+
37
+
38
+ @app.callback()
39
+ def main() -> None:
40
+ """catch-the-gist command line interface."""
41
+
42
+
43
+ @app.command()
44
+ def version() -> None:
45
+ """Print the catch-the-gist version."""
46
+ typer.echo(f"catch-the-gist {__version__}")
47
+
48
+
49
+ @app.command()
50
+ @handled
51
+ def ingest(source: str, as_json: Annotated[bool, typer.Option("--json")] = False) -> None:
52
+ """Ingest a source and cache it as chunks."""
53
+ result = service.ingest_source(source, workdir())
54
+ if as_json:
55
+ typer.echo(json.dumps(result, indent=2))
56
+ return
57
+ typer.echo(f"doc_id: {result['doc_id']}")
58
+ typer.echo(f"title: {result['source']['title']}")
59
+ typer.echo(f"chunk_count: {result['chunk_count']}")
60
+ typer.echo(f"est_tokens: {result['est_tokens']}")
61
+
62
+
63
+ @app.command()
64
+ @handled
65
+ def validate(path: str, as_json: Annotated[bool, typer.Option("--json")] = False) -> None:
66
+ """Validate a skill folder."""
67
+ result = service.validate(path, workdir())
68
+ violations = result["violations"]
69
+ if as_json:
70
+ typer.echo(json.dumps(result, indent=2))
71
+ else:
72
+ for v in violations:
73
+ line = v["line"] if v["line"] is not None else "-"
74
+ typer.echo(f"{v['severity']} {v['rule']} {v['file']}:{line} {v['message']}")
75
+ errors = sum(1 for v in violations if v["severity"] == "error")
76
+ typer.echo("ok" if result["ok"] else f"{errors} error(s)")
77
+ if not result["ok"]:
78
+ raise typer.Exit(8)
79
+
80
+
81
+ @app.command()
82
+ @handled
83
+ def install(
84
+ path: str,
85
+ scope: Annotated[str, typer.Option(help="project or user")] = "project",
86
+ agent: Annotated[list[str] | None, typer.Option(help="Repeat for several agents.")] = None,
87
+ force: bool = False,
88
+ copy: bool = False,
89
+ as_json: Annotated[bool, typer.Option("--json")] = False,
90
+ ) -> None:
91
+ """Install a skill for Claude Code and Codex."""
92
+ if scope not in ("project", "user"):
93
+ raise typer.BadParameter("scope must be 'project' or 'user'", param_hint="--scope")
94
+ chosen_scope: Literal["project", "user"] = "user" if scope == "user" else "project"
95
+ result = service.install_skill(
96
+ path, chosen_scope, agent or ALL_AGENTS, workdir(), force=force, copy=copy
97
+ )
98
+ if as_json:
99
+ typer.echo(json.dumps(result, indent=2))
100
+ return
101
+ for item in result["installed"]:
102
+ typer.echo(f"{item['agent']} {item['mode']} {item['path']}")
103
+ for warning in result["warnings"]:
104
+ typer.echo(f"warning: {warning}", err=True)
105
+
106
+
107
+ @app.command()
108
+ def mcp() -> None:
109
+ """Run the MCP server over stdio."""
110
+ from catch_the_gist import mcp_server
111
+
112
+ mcp_server.main()
@@ -0,0 +1,45 @@
1
+ """Segment-preserving chunker: packs whole segments greedily, never splitting one."""
2
+
3
+ import math
4
+
5
+ from catch_the_gist.schema import Chunk, Document
6
+
7
+ HEADING_CLOSE_RATIO = 0.75
8
+
9
+
10
+ def est_tokens(text: str) -> int:
11
+ return math.ceil(len(text) / 4)
12
+
13
+
14
+ def chunk(doc: Document, max_tokens: int = 3000) -> list[Chunk]:
15
+ suffix = doc.doc_id.removeprefix("doc_")
16
+ chunks: list[Chunk] = []
17
+ ids: list[str] = []
18
+ text = ""
19
+
20
+ def close() -> None:
21
+ nonlocal ids, text
22
+ if ids:
23
+ chunks.append(
24
+ Chunk(
25
+ id=f"chk_{suffix}_{len(chunks)}",
26
+ doc_id=doc.doc_id,
27
+ segment_ids=ids,
28
+ text=text,
29
+ est_tokens=est_tokens(text),
30
+ )
31
+ )
32
+ ids, text = [], ""
33
+
34
+ for seg in doc.segments:
35
+ piece = f"{seg.loc.marker()} {seg.text}"
36
+ if ids:
37
+ current = est_tokens(text)
38
+ overflows = est_tokens(text + "\n\n" + piece) > max_tokens
39
+ heading_close = seg.kind == "heading" and current >= HEADING_CLOSE_RATIO * max_tokens
40
+ if overflows or heading_close:
41
+ close()
42
+ text = f"{text}\n\n{piece}" if ids else piece
43
+ ids.append(seg.id)
44
+ close()
45
+ return chunks