comcan-ctx 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.
- comcan_ctx-0.1.0/LICENSE +21 -0
- comcan_ctx-0.1.0/PKG-INFO +200 -0
- comcan_ctx-0.1.0/README.md +169 -0
- comcan_ctx-0.1.0/comcan/__init__.py +3 -0
- comcan_ctx-0.1.0/comcan/cli.py +579 -0
- comcan_ctx-0.1.0/comcan/config.py +119 -0
- comcan_ctx-0.1.0/comcan/context_budget.py +252 -0
- comcan_ctx-0.1.0/comcan/expertise_manager.py +438 -0
- comcan_ctx-0.1.0/comcan/file_parser.py +288 -0
- comcan_ctx-0.1.0/comcan/git_utils.py +212 -0
- comcan_ctx-0.1.0/comcan/security.py +156 -0
- comcan_ctx-0.1.0/comcan/state_manager.py +181 -0
- comcan_ctx-0.1.0/comcan/templates/__init__.py +0 -0
- comcan_ctx-0.1.0/comcan_ctx.egg-info/PKG-INFO +200 -0
- comcan_ctx-0.1.0/comcan_ctx.egg-info/SOURCES.txt +22 -0
- comcan_ctx-0.1.0/comcan_ctx.egg-info/dependency_links.txt +1 -0
- comcan_ctx-0.1.0/comcan_ctx.egg-info/entry_points.txt +2 -0
- comcan_ctx-0.1.0/comcan_ctx.egg-info/requires.txt +11 -0
- comcan_ctx-0.1.0/comcan_ctx.egg-info/top_level.txt +1 -0
- comcan_ctx-0.1.0/pyproject.toml +50 -0
- comcan_ctx-0.1.0/setup.cfg +4 -0
- comcan_ctx-0.1.0/tests/test_context_budget.py +98 -0
- comcan_ctx-0.1.0/tests/test_expertise.py +140 -0
- comcan_ctx-0.1.0/tests/test_security.py +116 -0
comcan_ctx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shriniwas Ramesh Suram
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: comcan-ctx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Context management for AI coding agents — state awareness + expertise memory.
|
|
5
|
+
Author: Shriniwas Ramesh Suram
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: ai,context,cursor,coding-agent,llm,git
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: typer>=0.9.0
|
|
21
|
+
Requires-Dist: rich>=13.0.0
|
|
22
|
+
Requires-Dist: tiktoken>=0.5.0
|
|
23
|
+
Requires-Dist: pathspec>=0.11.0
|
|
24
|
+
Requires-Dist: jinja2>=3.1.0
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: bandit>=1.7; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# 🧠 ComCan — Context Manager for AI Coding Agents
|
|
33
|
+
|
|
34
|
+
[](LICENSE)
|
|
35
|
+
[](https://www.python.org/downloads/)
|
|
36
|
+
|
|
37
|
+
A **single Python package** that gives AI coding agents (Cursor, Claude Code, etc.) a complete cognitive architecture:
|
|
38
|
+
|
|
39
|
+
- **🔄 State Engine (RAM)** — Auto-generates a context file on every commit/branch switch via Git hooks
|
|
40
|
+
- **📚 Expertise Engine (Hard Drive)** — Structured JSONL records that accumulate project knowledge over time
|
|
41
|
+
- **🛡️ Security First** — Zero network access, secret scrubbing, no post-install scripts
|
|
42
|
+
|
|
43
|
+
Designed for **large codebases** where naive context dumps overwhelm LLM token windows.
|
|
44
|
+
|
|
45
|
+
### Why not just use Cursor/Copilot's native indexing?
|
|
46
|
+
Standard IDE indexing (RAG) is great at finding *where* code is, but terrible at knowing *why* it's there or how branches differ.
|
|
47
|
+
- **Indexing vs. State:** IDE vector indexes don't understand that you just switched branches. ComCan's `CURRENT_STATE.md` is instantly updated via Git hooks to represent your exact branch reality.
|
|
48
|
+
- **RAG vs. Rules:** RAG discovers old code; it doesn't know what the *new* rules are. ComCan's `expertise` engine teaches agents the *current* architectural decisions.
|
|
49
|
+
- **Static `.md` vs. Dynamic JSONL:** Giant `.cursorrules` files cause merge conflicts and token bloat. ComCan uses domain-sharded, lock-safe JSONL ledgers that agents query surgically.
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install comcan-ctx
|
|
55
|
+
cd your-project/
|
|
56
|
+
comcan init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
That's it. ComCan will:
|
|
60
|
+
1. Create `.comcan/` directory with a `CURRENT_STATE.md` context file
|
|
61
|
+
2. Install Git hooks to auto-update context on commits and branch switches
|
|
62
|
+
3. Create `.cursorrules` so Cursor reads the context automatically
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Record Expertise
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Quick convention recording
|
|
70
|
+
comcan learn database "Always use WAL mode for SQLite"
|
|
71
|
+
|
|
72
|
+
# Full record syntax
|
|
73
|
+
comcan record api --type failure "Auth tokens not refreshed" --resolution "Added retry with exponential backoff"
|
|
74
|
+
|
|
75
|
+
# Add a new domain
|
|
76
|
+
comcan add frontend
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Query Knowledge
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# View all database expertise
|
|
83
|
+
comcan query database
|
|
84
|
+
|
|
85
|
+
# Search across everything
|
|
86
|
+
comcan search "authentication"
|
|
87
|
+
|
|
88
|
+
# Full context dump for agent injection
|
|
89
|
+
comcan prime
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Monitor State
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Dashboard
|
|
96
|
+
comcan status
|
|
97
|
+
|
|
98
|
+
# Manual sync (usually automatic via hooks)
|
|
99
|
+
comcan sync
|
|
100
|
+
|
|
101
|
+
# Health check
|
|
102
|
+
comcan doctor
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## How It Works
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
1. comcan init → Creates .comcan/, hooks, .cursorrules
|
|
109
|
+
2. You commit code → Hook fires, CURRENT_STATE.md auto-updates
|
|
110
|
+
3. AI reads context → Agent starts with full project awareness
|
|
111
|
+
4. AI solves problem → You record the lesson with comcan learn
|
|
112
|
+
7. git push → Teammates' agents get smarter too
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Enterprise Features
|
|
116
|
+
|
|
117
|
+
ComCan is purpose-built to solve the "AI Cold Start Problem" for large engineering teams:
|
|
118
|
+
|
|
119
|
+
### 1. Iterative Knowledge Building 🧠
|
|
120
|
+
Instead of pasting the same rules over and over, developers use `comcan learn` to permanently record patterns, bugs, and architectural decisions into domain-specific ledgers. AI agents query these automatically.
|
|
121
|
+
|
|
122
|
+
### 2. Branch-Aware Context 🔀
|
|
123
|
+
`CURRENT_STATE.md` regenerates on every `git checkout` and `git commit`. If Dev A is on `feature-auth` and Dev B is on `bugfix-ui`, their agents see completely different, branch-accurate contextual states.
|
|
124
|
+
|
|
125
|
+
### 3. Conflict-Free Merging 🤝
|
|
126
|
+
ComCan configures `.gitattributes` to use `merge=union` for expertise JSONL files. Multiple developers can record new knowledge on different branches simultaneously without ever triggering a merge conflict.
|
|
127
|
+
|
|
128
|
+
### 4. Concurrent Agent Safety 🔒
|
|
129
|
+
Multiple agents running in parallel? No problem. The expertise engine uses advisory file-locking with atomic temp-file rotation. Multiple IDE tools or CI scripts can write to the same domain simultaneously without data corruption.
|
|
130
|
+
|
|
131
|
+
### 5. Token Budget Efficiency 📉
|
|
132
|
+
Dumping an enterprise codebase into an LLM window causes hallucinations and massive API costs. ComCan uses a multi-model token budget engine (o200k_base tokenizer aware) to mathematically allocate context window limits across the directory tree, commits, diffs, and expertise records.
|
|
133
|
+
|
|
134
|
+
## Architecture
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
.comcan/
|
|
138
|
+
├── CURRENT_STATE.md # Auto-generated (branch, commits, tree)
|
|
139
|
+
├── comcan.config.yaml # Configuration
|
|
140
|
+
└── expertise/
|
|
141
|
+
├── database.jsonl # Domain expertise (one per domain)
|
|
142
|
+
├── api.jsonl
|
|
143
|
+
└── frontend.jsonl
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Context Budget Profiles
|
|
147
|
+
|
|
148
|
+
ComCan uses only ~5% of the model's context window, leaving 90%+ for actual work, via the `context_budget.py` engine (`tiktoken o200k_base`).
|
|
149
|
+
|
|
150
|
+
| Profile | Context Window | ComCan Budget | Target Models |
|
|
151
|
+
|---------|---------------|---------------|---------------|
|
|
152
|
+
| `standard` | 128k | ~6,400 tokens | GPT-4o, Claude 3.5 Sonnet |
|
|
153
|
+
| `large` | 200k | ~10,000 tokens | Claude 4, Cursor default |
|
|
154
|
+
| `max` | 1M+ | ~50,000 tokens | Gemini 2.5 Pro Max, Claude Opus |
|
|
155
|
+
|
|
156
|
+
*Note: Why use a budget? Without a token budget, dumping a large enterprise repo into an LLM causes severe "Lost in the Middle" syndrome and drains API credits. ComCan protects your context window by mathematically prioritizing recent commits, diffs, and surgical domain expertise.*
|
|
157
|
+
|
|
158
|
+
### Native AI Skills & PR Workflows
|
|
159
|
+
|
|
160
|
+
During `comcan init`, the CLI generates three native AI instruction files:
|
|
161
|
+
1. `.cursorrules` (Legacy IDE rules)
|
|
162
|
+
2. `.cursor/rules/comcan.mdc` (Cursor Rules format)
|
|
163
|
+
3. `.comcan/comcan-skill.md` (Portable generic AI skill)
|
|
164
|
+
|
|
165
|
+
**Human-in-the-Loop Security**: When an AI agent runs `comcan learn` to solve a problem, it writes directly to `.comcan/expertise/domain.jsonl`. Because this file is tracked in Git, the new "AI Skill" shows up in the Pull Request diff. If the AI hallucinates a bad rule, the Senior Engineer reviewing the PR rejects it. Bad AI knowledge never makes it to the `main` branch.
|
|
166
|
+
|
|
167
|
+
## CLI Reference
|
|
168
|
+
|
|
169
|
+
| Command | Description |
|
|
170
|
+
|---------|-------------|
|
|
171
|
+
| `comcan init` | Interactive setup wizard |
|
|
172
|
+
| `comcan sync` | Regenerate context state |
|
|
173
|
+
| `comcan add <domain>` | Create expertise domain |
|
|
174
|
+
| `comcan learn <domain> "lesson"` | Quick-record a convention |
|
|
175
|
+
| `comcan record <domain> --type <type> "content"` | Full record syntax |
|
|
176
|
+
| `comcan query [domain]` | View domain expertise |
|
|
177
|
+
| `comcan search <query>` | Search all expertise |
|
|
178
|
+
| `comcan prime [domains...]` | Full context for agent injection |
|
|
179
|
+
| `comcan status` | Context dashboard |
|
|
180
|
+
| `comcan forget <domain> <id>` | Delete a record |
|
|
181
|
+
| `comcan doctor` | Health & security check |
|
|
182
|
+
|
|
183
|
+
## Security
|
|
184
|
+
|
|
185
|
+
ComCan is designed to **never trigger security scanners**:
|
|
186
|
+
|
|
187
|
+
- ✅ No `shell=True` — all subprocess calls target only `git`
|
|
188
|
+
- ✅ No `setup.py` — pure `pyproject.toml`, no post-install scripts
|
|
189
|
+
- ✅ No network access — zero HTTP calls, no telemetry
|
|
190
|
+
- ✅ No `eval()`/`exec()` — plain readable Python
|
|
191
|
+
- ✅ Secret scrubbing — API keys stripped before writing state files
|
|
192
|
+
- ✅ Path validation — all writes scoped to Git repo root
|
|
193
|
+
|
|
194
|
+
## Contributing
|
|
195
|
+
|
|
196
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# 🧠 ComCan — Context Manager for AI Coding Agents
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
|
|
6
|
+
A **single Python package** that gives AI coding agents (Cursor, Claude Code, etc.) a complete cognitive architecture:
|
|
7
|
+
|
|
8
|
+
- **🔄 State Engine (RAM)** — Auto-generates a context file on every commit/branch switch via Git hooks
|
|
9
|
+
- **📚 Expertise Engine (Hard Drive)** — Structured JSONL records that accumulate project knowledge over time
|
|
10
|
+
- **🛡️ Security First** — Zero network access, secret scrubbing, no post-install scripts
|
|
11
|
+
|
|
12
|
+
Designed for **large codebases** where naive context dumps overwhelm LLM token windows.
|
|
13
|
+
|
|
14
|
+
### Why not just use Cursor/Copilot's native indexing?
|
|
15
|
+
Standard IDE indexing (RAG) is great at finding *where* code is, but terrible at knowing *why* it's there or how branches differ.
|
|
16
|
+
- **Indexing vs. State:** IDE vector indexes don't understand that you just switched branches. ComCan's `CURRENT_STATE.md` is instantly updated via Git hooks to represent your exact branch reality.
|
|
17
|
+
- **RAG vs. Rules:** RAG discovers old code; it doesn't know what the *new* rules are. ComCan's `expertise` engine teaches agents the *current* architectural decisions.
|
|
18
|
+
- **Static `.md` vs. Dynamic JSONL:** Giant `.cursorrules` files cause merge conflicts and token bloat. ComCan uses domain-sharded, lock-safe JSONL ledgers that agents query surgically.
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install comcan-ctx
|
|
24
|
+
cd your-project/
|
|
25
|
+
comcan init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
That's it. ComCan will:
|
|
29
|
+
1. Create `.comcan/` directory with a `CURRENT_STATE.md` context file
|
|
30
|
+
2. Install Git hooks to auto-update context on commits and branch switches
|
|
31
|
+
3. Create `.cursorrules` so Cursor reads the context automatically
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Record Expertise
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Quick convention recording
|
|
39
|
+
comcan learn database "Always use WAL mode for SQLite"
|
|
40
|
+
|
|
41
|
+
# Full record syntax
|
|
42
|
+
comcan record api --type failure "Auth tokens not refreshed" --resolution "Added retry with exponential backoff"
|
|
43
|
+
|
|
44
|
+
# Add a new domain
|
|
45
|
+
comcan add frontend
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Query Knowledge
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# View all database expertise
|
|
52
|
+
comcan query database
|
|
53
|
+
|
|
54
|
+
# Search across everything
|
|
55
|
+
comcan search "authentication"
|
|
56
|
+
|
|
57
|
+
# Full context dump for agent injection
|
|
58
|
+
comcan prime
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Monitor State
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Dashboard
|
|
65
|
+
comcan status
|
|
66
|
+
|
|
67
|
+
# Manual sync (usually automatic via hooks)
|
|
68
|
+
comcan sync
|
|
69
|
+
|
|
70
|
+
# Health check
|
|
71
|
+
comcan doctor
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## How It Works
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
1. comcan init → Creates .comcan/, hooks, .cursorrules
|
|
78
|
+
2. You commit code → Hook fires, CURRENT_STATE.md auto-updates
|
|
79
|
+
3. AI reads context → Agent starts with full project awareness
|
|
80
|
+
4. AI solves problem → You record the lesson with comcan learn
|
|
81
|
+
7. git push → Teammates' agents get smarter too
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Enterprise Features
|
|
85
|
+
|
|
86
|
+
ComCan is purpose-built to solve the "AI Cold Start Problem" for large engineering teams:
|
|
87
|
+
|
|
88
|
+
### 1. Iterative Knowledge Building 🧠
|
|
89
|
+
Instead of pasting the same rules over and over, developers use `comcan learn` to permanently record patterns, bugs, and architectural decisions into domain-specific ledgers. AI agents query these automatically.
|
|
90
|
+
|
|
91
|
+
### 2. Branch-Aware Context 🔀
|
|
92
|
+
`CURRENT_STATE.md` regenerates on every `git checkout` and `git commit`. If Dev A is on `feature-auth` and Dev B is on `bugfix-ui`, their agents see completely different, branch-accurate contextual states.
|
|
93
|
+
|
|
94
|
+
### 3. Conflict-Free Merging 🤝
|
|
95
|
+
ComCan configures `.gitattributes` to use `merge=union` for expertise JSONL files. Multiple developers can record new knowledge on different branches simultaneously without ever triggering a merge conflict.
|
|
96
|
+
|
|
97
|
+
### 4. Concurrent Agent Safety 🔒
|
|
98
|
+
Multiple agents running in parallel? No problem. The expertise engine uses advisory file-locking with atomic temp-file rotation. Multiple IDE tools or CI scripts can write to the same domain simultaneously without data corruption.
|
|
99
|
+
|
|
100
|
+
### 5. Token Budget Efficiency 📉
|
|
101
|
+
Dumping an enterprise codebase into an LLM window causes hallucinations and massive API costs. ComCan uses a multi-model token budget engine (o200k_base tokenizer aware) to mathematically allocate context window limits across the directory tree, commits, diffs, and expertise records.
|
|
102
|
+
|
|
103
|
+
## Architecture
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
.comcan/
|
|
107
|
+
├── CURRENT_STATE.md # Auto-generated (branch, commits, tree)
|
|
108
|
+
├── comcan.config.yaml # Configuration
|
|
109
|
+
└── expertise/
|
|
110
|
+
├── database.jsonl # Domain expertise (one per domain)
|
|
111
|
+
├── api.jsonl
|
|
112
|
+
└── frontend.jsonl
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Context Budget Profiles
|
|
116
|
+
|
|
117
|
+
ComCan uses only ~5% of the model's context window, leaving 90%+ for actual work, via the `context_budget.py` engine (`tiktoken o200k_base`).
|
|
118
|
+
|
|
119
|
+
| Profile | Context Window | ComCan Budget | Target Models |
|
|
120
|
+
|---------|---------------|---------------|---------------|
|
|
121
|
+
| `standard` | 128k | ~6,400 tokens | GPT-4o, Claude 3.5 Sonnet |
|
|
122
|
+
| `large` | 200k | ~10,000 tokens | Claude 4, Cursor default |
|
|
123
|
+
| `max` | 1M+ | ~50,000 tokens | Gemini 2.5 Pro Max, Claude Opus |
|
|
124
|
+
|
|
125
|
+
*Note: Why use a budget? Without a token budget, dumping a large enterprise repo into an LLM causes severe "Lost in the Middle" syndrome and drains API credits. ComCan protects your context window by mathematically prioritizing recent commits, diffs, and surgical domain expertise.*
|
|
126
|
+
|
|
127
|
+
### Native AI Skills & PR Workflows
|
|
128
|
+
|
|
129
|
+
During `comcan init`, the CLI generates three native AI instruction files:
|
|
130
|
+
1. `.cursorrules` (Legacy IDE rules)
|
|
131
|
+
2. `.cursor/rules/comcan.mdc` (Cursor Rules format)
|
|
132
|
+
3. `.comcan/comcan-skill.md` (Portable generic AI skill)
|
|
133
|
+
|
|
134
|
+
**Human-in-the-Loop Security**: When an AI agent runs `comcan learn` to solve a problem, it writes directly to `.comcan/expertise/domain.jsonl`. Because this file is tracked in Git, the new "AI Skill" shows up in the Pull Request diff. If the AI hallucinates a bad rule, the Senior Engineer reviewing the PR rejects it. Bad AI knowledge never makes it to the `main` branch.
|
|
135
|
+
|
|
136
|
+
## CLI Reference
|
|
137
|
+
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `comcan init` | Interactive setup wizard |
|
|
141
|
+
| `comcan sync` | Regenerate context state |
|
|
142
|
+
| `comcan add <domain>` | Create expertise domain |
|
|
143
|
+
| `comcan learn <domain> "lesson"` | Quick-record a convention |
|
|
144
|
+
| `comcan record <domain> --type <type> "content"` | Full record syntax |
|
|
145
|
+
| `comcan query [domain]` | View domain expertise |
|
|
146
|
+
| `comcan search <query>` | Search all expertise |
|
|
147
|
+
| `comcan prime [domains...]` | Full context for agent injection |
|
|
148
|
+
| `comcan status` | Context dashboard |
|
|
149
|
+
| `comcan forget <domain> <id>` | Delete a record |
|
|
150
|
+
| `comcan doctor` | Health & security check |
|
|
151
|
+
|
|
152
|
+
## Security
|
|
153
|
+
|
|
154
|
+
ComCan is designed to **never trigger security scanners**:
|
|
155
|
+
|
|
156
|
+
- ✅ No `shell=True` — all subprocess calls target only `git`
|
|
157
|
+
- ✅ No `setup.py` — pure `pyproject.toml`, no post-install scripts
|
|
158
|
+
- ✅ No network access — zero HTTP calls, no telemetry
|
|
159
|
+
- ✅ No `eval()`/`exec()` — plain readable Python
|
|
160
|
+
- ✅ Secret scrubbing — API keys stripped before writing state files
|
|
161
|
+
- ✅ Path validation — all writes scoped to Git repo root
|
|
162
|
+
|
|
163
|
+
## Contributing
|
|
164
|
+
|
|
165
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT — see [LICENSE](LICENSE).
|