ctxora 6.2.0
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.
- package/LICENSE +21 -0
- package/README.md +441 -0
- package/README.vi.md +441 -0
- package/bin/ctxora.mjs +147 -0
- package/package.json +45 -0
- package/pyproject.toml +59 -0
- package/src/chunking/compressor.py +104 -0
- package/src/chunking/treesitter_chunker.py +240 -0
- package/src/compact/anthropic.py +98 -0
- package/src/compact/gemini.py +88 -0
- package/src/compact/handoff.py +179 -0
- package/src/compact/openai.py +318 -0
- package/src/compact/summarizer.py +186 -0
- package/src/context/assembler.py +298 -0
- package/src/context/budgeting.py +137 -0
- package/src/context/sanitizer.py +23 -0
- package/src/evaluation/__init__.py +1 -0
- package/src/evaluation/gates.py +172 -0
- package/src/evaluation/metrics.py +41 -0
- package/src/harness_context/__init__.py +5 -0
- package/src/harness_context/adapters/__init__.py +1 -0
- package/src/harness_context/adapters/clients/__init__.py +4 -0
- package/src/harness_context/adapters/clients/formatters.py +47 -0
- package/src/harness_context/adapters/clients/profiles.py +29 -0
- package/src/harness_context/adapters/ecc/__init__.py +4 -0
- package/src/harness_context/adapters/ecc/detection.py +41 -0
- package/src/harness_context/adapters/ecc/mapping.py +32 -0
- package/src/harness_context/adapters/ecc/memory_reader.py +162 -0
- package/src/harness_context/adapters/ecc/provenance.py +16 -0
- package/src/harness_context/api/__init__.py +1 -0
- package/src/harness_context/api/v2/__init__.py +12 -0
- package/src/harness_context/api/v2/contracts.py +119 -0
- package/src/harness_context/api/v2/diagnostics.py +13 -0
- package/src/harness_context/api/v2/enums.py +17 -0
- package/src/harness_context/api/v2/errors.py +32 -0
- package/src/harness_context/api/v2/models.py +4 -0
- package/src/harness_context/api/v2/requests.py +17 -0
- package/src/harness_context/api/v2/responses.py +22 -0
- package/src/harness_context/application/__init__.py +3 -0
- package/src/harness_context/application/container.py +31 -0
- package/src/harness_context/application/context_service.py +51 -0
- package/src/harness_context/application/ecc_service.py +7 -0
- package/src/harness_context/application/handoff_service.py +11 -0
- package/src/harness_context/application/memory_service.py +9 -0
- package/src/harness_context/application/protocols.py +46 -0
- package/src/harness_context/application/refresh_service.py +25 -0
- package/src/harness_context/application/retrieval_service.py +22 -0
- package/src/harness_context/application/services.py +4 -0
- package/src/harness_context/application/workspace_service.py +18 -0
- package/src/harness_context/bootstrap.py +47 -0
- package/src/harness_context/branding.py +16 -0
- package/src/harness_context/cli/__init__.py +1 -0
- package/src/harness_context/cli/app.py +239 -0
- package/src/harness_context/cli/exit_codes.py +25 -0
- package/src/harness_context/domain/__init__.py +9 -0
- package/src/harness_context/domain/cag.py +18 -0
- package/src/harness_context/domain/chunking.py +17 -0
- package/src/harness_context/domain/planning.py +30 -0
- package/src/harness_context/domain/ports.py +24 -0
- package/src/harness_context/domain/retrieval.py +46 -0
- package/src/harness_context/engine.py +10 -0
- package/src/harness_context/free_tools.py +143 -0
- package/src/harness_context/infrastructure/__init__.py +10 -0
- package/src/harness_context/infrastructure/graph.py +26 -0
- package/src/harness_context/infrastructure/indexes.py +33 -0
- package/src/harness_context/infrastructure/local_engine.py +296 -0
- package/src/harness_context/infrastructure/parsing.py +38 -0
- package/src/harness_context/infrastructure/scanning.py +51 -0
- package/src/harness_context/installer/__init__.py +4 -0
- package/src/harness_context/installer/models.py +22 -0
- package/src/harness_context/installer/service.py +168 -0
- package/src/harness_context/mcp/__init__.py +3 -0
- package/src/harness_context/mcp/capabilities.py +11 -0
- package/src/harness_context/mcp/errors.py +8 -0
- package/src/harness_context/mcp/lifecycle.py +72 -0
- package/src/harness_context/mcp/middleware.py +57 -0
- package/src/harness_context/mcp/server.py +3 -0
- package/src/harness_context/mcp/tool_handlers/__init__.py +7 -0
- package/src/harness_context/mcp/tool_handlers/context.py +16 -0
- package/src/harness_context/mcp/tool_handlers/ecc.py +8 -0
- package/src/harness_context/mcp/tool_handlers/handoffs.py +20 -0
- package/src/harness_context/mcp/tool_handlers/memory.py +16 -0
- package/src/harness_context/mcp/tool_handlers/workspace.py +12 -0
- package/src/harness_context/mcp/tools.py +15 -0
- package/src/harness_context/observability/__init__.py +6 -0
- package/src/harness_context/observability/events.py +25 -0
- package/src/harness_context/observability/metrics.py +20 -0
- package/src/harness_context/paths.py +35 -0
- package/src/harness_context/runtime.py +127 -0
- package/src/harness_context/schemas.py +38 -0
- package/src/harness_context/security/__init__.py +3 -0
- package/src/harness_context/security/secret_patterns.py +15 -0
- package/src/harness_context/server.py +1077 -0
- package/src/harness_context/storage/__init__.py +6 -0
- package/src/harness_context/storage/migrations.py +24 -0
- package/src/harness_context/storage/pins.py +10 -0
- package/src/harness_context/storage/snapshots.py +149 -0
- package/src/harness_context/tokenize.py +12 -0
- package/src/harness_context/topology.py +65 -0
- package/src/harness_context/watcher/__init__.py +3 -0
- package/src/harness_context/watcher/service.py +32 -0
- package/src/harness_context/workspace/__init__.py +13 -0
- package/src/harness_context/workspace/identity.py +9 -0
- package/src/harness_context/workspace/lock.py +24 -0
- package/src/harness_context/workspace/policy.py +3 -0
- package/src/harness_context/workspace/roots.py +84 -0
- package/src/harness_context/workspace/state.py +35 -0
- package/src/memory/episodic.py +257 -0
- package/src/memory/vector_store.py +104 -0
- package/src/retrieval/bm25.py +23 -0
- package/src/retrieval/cache.py +76 -0
- package/src/retrieval/embeddings.py +75 -0
- package/src/retrieval/graph.py +45 -0
- package/src/retrieval/reranker.py +78 -0
- package/src/retrieval/tokenize.py +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nguyen Trung Hieu
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# CTXORA Engine
|
|
4
|
+
|
|
5
|
+
### Index once. Ground every agent.
|
|
6
|
+
|
|
7
|
+
**Local-first context engine for coding agents.**
|
|
8
|
+
|
|
9
|
+
[](https://github.com/nguyentrunghieutcu/ctxora-engine/actions/workflows/ci.yml)
|
|
10
|
+
[](https://www.npmjs.com/package/ctxora)
|
|
11
|
+
[](https://skills.sh/nguyentrunghieutcu/ctxora-engine)
|
|
12
|
+
[](https://www.python.org/)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
[](#privacy-and-security)
|
|
15
|
+
[](docs/PRICING.md)
|
|
16
|
+
|
|
17
|
+
**English** · [Tiếng Việt](README.vi.md)
|
|
18
|
+
|
|
19
|
+
[Quick start](#quick-start) · [Installation](#installation) · [Agent skills](#agent-skills) · [CLI](#cli-reference) · [MCP](#mcp-tools) · [Security](#privacy-and-security)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
> [!IMPORTANT]
|
|
24
|
+
> **Official sources:** use the `ctxora` package on npm or this GitHub repository. The `ctxora-engine` package is not published on PyPI. Third-party packages using the CTXORA name are not maintained or reviewed by this project.
|
|
25
|
+
|
|
26
|
+
CTXORA Engine builds a reusable, local representation of a repository and supplies the right evidence to Codex, Claude Code, Cursor, GitHub Copilot, or any MCP-compatible agent. Source code, indexes, embeddings, graph data, memory, and handoffs remain on your machine.
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx ctxora setup --workspace /path/to/your/project
|
|
32
|
+
npx ctxora index --workspace /path/to/your/project
|
|
33
|
+
npx ctxora explain --workspace /path/to/your/project \
|
|
34
|
+
"Where is authentication implemented?"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Expected output is structured JSON containing relevant files, symbols, dependency signals, provenance, coverage diagnostics, and recommended tests or conventions when available.
|
|
38
|
+
|
|
39
|
+
## Why CTXORA?
|
|
40
|
+
|
|
41
|
+
Coding agents often spend tokens rediscovering a repository, select the wrong layer, miss local conventions, or lose context between sessions. Static instruction files help, but they cannot select task-specific evidence.
|
|
42
|
+
|
|
43
|
+
CTXORA adds a local context layer:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
Repository
|
|
47
|
+
↓ scan, parse, chunk
|
|
48
|
+
Immutable local snapshot
|
|
49
|
+
↓ lexical + semantic + symbol + path + graph indexes
|
|
50
|
+
Context planner
|
|
51
|
+
↓ CAG / RAG / long context / graph-augmented retrieval
|
|
52
|
+
Codex · Claude Code · Cursor · Copilot · MCP clients
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- **Fewer wrong edits** — retrieve the module, dependency path, and tests related to the task.
|
|
56
|
+
- **Less repeated prompting** — reuse repository knowledge across agent sessions.
|
|
57
|
+
- **Agent-neutral context** — one engine serves multiple coding tools.
|
|
58
|
+
- **Private by default** — no hosted index, remote telemetry, or required cloud account.
|
|
59
|
+
- **Deterministic evidence** — every retrieved item includes source path and provenance.
|
|
60
|
+
|
|
61
|
+
## What you get
|
|
62
|
+
|
|
63
|
+
### Local context engine
|
|
64
|
+
|
|
65
|
+
- AST-aware chunking for Python, JavaScript, and TypeScript, with bounded fallback chunking for other text formats.
|
|
66
|
+
- Hybrid lexical and local semantic retrieval using BM25, TF-IDF/LSA, keyword overlap, symbols, and paths.
|
|
67
|
+
- Code dependency graph traversal and graph-augmented context selection.
|
|
68
|
+
- CAG, RAG, hybrid CAG/RAG, long-context, and graph-augmented planning strategies.
|
|
69
|
+
- Immutable snapshots with candidate validation, atomic promotion, recovery, and incremental refresh.
|
|
70
|
+
- Workspace-scoped SQLite memory and raw conversation handoffs.
|
|
71
|
+
- Token budgeting for OpenAI, Anthropic, and Gemini context windows.
|
|
72
|
+
|
|
73
|
+
### Agent onboarding
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
ctxora repo-map --workspace .
|
|
77
|
+
ctxora context-score --workspace .
|
|
78
|
+
ctxora generate-agents-md --workspace .
|
|
79
|
+
ctxora generate-copilot-instructions --workspace .
|
|
80
|
+
ctxora generate-cursor-rules --workspace .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Generated instruction files are deterministic and are never overwritten unless `--force` is provided.
|
|
84
|
+
|
|
85
|
+
### Safety and operations
|
|
86
|
+
|
|
87
|
+
- Canonical workspace-root authorization and symlink-escape rejection.
|
|
88
|
+
- Secret-like, binary, dependency, VCS, generated-state, and oversized-file exclusions.
|
|
89
|
+
- Retrieved repository content is always treated as untrusted evidence, never as agent instructions.
|
|
90
|
+
- Machine-readable diagnostics, context health reports, evaluation gates, and stable CLI exit codes.
|
|
91
|
+
- Local `ctxora ci` support for indexing changed files between Git refs.
|
|
92
|
+
|
|
93
|
+
## Installation
|
|
94
|
+
|
|
95
|
+
### npm / npx — recommended
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx ctxora setup --workspace /path/to/your/project
|
|
99
|
+
npx ctxora doctor --workspace /path/to/your/project
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The dependency-free npm launcher bundles the MIT-licensed Python source and installs CTXORA Engine into a versioned local environment. It does not require a global Python package or a cloud account. Python 3.10–3.13 must already be available.
|
|
103
|
+
|
|
104
|
+
For a persistent shell command:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm install --global ctxora
|
|
108
|
+
ctxora setup --workspace /path/to/your/project
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Install from GitHub
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
python3 -m pip install \
|
|
115
|
+
"git+https://github.com/nguyentrunghieutcu/ctxora-engine.git"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Install from a clone
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/nguyentrunghieutcu/ctxora-engine.git
|
|
122
|
+
cd ctxora-engine
|
|
123
|
+
python3 -m pip install .
|
|
124
|
+
ctxora doctor --workspace .
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Development environment
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python3 -m venv .venv
|
|
131
|
+
source .venv/bin/activate
|
|
132
|
+
python -m pip install -e '.[dev]'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Requirements: Python 3.10–3.13 and Git. Runtime state is stored under `.ctxora/`; compatible legacy `.harness/` state remains readable during migration.
|
|
136
|
+
|
|
137
|
+
## Agent skills
|
|
138
|
+
|
|
139
|
+
Install all CTXORA skills from this repository:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npx skills add nguyentrunghieutcu/ctxora-engine
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
List or install one skill:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npx skills add nguyentrunghieutcu/ctxora-engine --list
|
|
149
|
+
npx skills add nguyentrunghieutcu/ctxora-engine --skill ctxora-setup
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The pack includes setup, grounded repository context, and context-health workflows. The current `skills` CLI requires Node.js 22.20 or newer.
|
|
153
|
+
|
|
154
|
+
## Connect a coding agent
|
|
155
|
+
|
|
156
|
+
CTXORA can safely edit supported client configuration while preserving unrelated entries:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
ctxora profile --workspace .
|
|
160
|
+
ctxora install --workspace . --profile codex
|
|
161
|
+
ctxora install --workspace . --profile claude-code
|
|
162
|
+
ctxora install --workspace . --profile cursor
|
|
163
|
+
ctxora install --workspace . --profile generic-mcp
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Use `--dry-run` to preview changes and `--client-config` to target a non-default file. Supported defaults:
|
|
167
|
+
|
|
168
|
+
| Profile | Default configuration |
|
|
169
|
+
|---|---|
|
|
170
|
+
| Codex | `~/.codex/config.toml` |
|
|
171
|
+
| Claude Code | `~/.claude.json` |
|
|
172
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
173
|
+
| Generic MCP | `~/.config/mcp/servers.json` |
|
|
174
|
+
|
|
175
|
+
Manual MCP configuration:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"mcpServers": {
|
|
180
|
+
"ctxora": {
|
|
181
|
+
"command": "ctxora",
|
|
182
|
+
"args": ["run", "--workspace", "/absolute/path/to/project", "--transport", "stdio"],
|
|
183
|
+
"env": {
|
|
184
|
+
"CTXORA_ALLOWED_ROOTS": "/absolute/path/to/project",
|
|
185
|
+
"PYTHONUTF8": "1"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Do not commit client configuration containing personal absolute paths.
|
|
193
|
+
|
|
194
|
+
## Core workflows
|
|
195
|
+
|
|
196
|
+
### Understand a repository
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
ctxora setup --workspace .
|
|
200
|
+
ctxora index --workspace .
|
|
201
|
+
ctxora query --workspace . "How does request authentication flow?"
|
|
202
|
+
ctxora explain --workspace . "Where should token rotation be changed?"
|
|
203
|
+
ctxora inspect --workspace . snapshot
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Refresh changed files
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
ctxora index --workspace . --incremental
|
|
210
|
+
ctxora ci --workspace . --base origin/main --head HEAD
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Run the MCP server
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Recommended local transport
|
|
217
|
+
ctxora run --workspace . --transport stdio
|
|
218
|
+
|
|
219
|
+
# Local HTTP transport
|
|
220
|
+
ctxora run --workspace . --transport streamable-http \
|
|
221
|
+
--host 127.0.0.1 --port 8765
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Non-loopback HTTP binding requires `--allow-external` and must be protected by an authorization layer before production use.
|
|
225
|
+
|
|
226
|
+
### Export local state
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
ctxora export --workspace . --output ./ctxora-snapshot.json
|
|
230
|
+
ctxora doctor --workspace .
|
|
231
|
+
ctxora repair --workspace .
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## CLI reference
|
|
235
|
+
|
|
236
|
+
| Command | Purpose |
|
|
237
|
+
|---|---|
|
|
238
|
+
| `setup` | Create local workspace configuration. |
|
|
239
|
+
| `register` | Register and authorize a workspace. |
|
|
240
|
+
| `run` | Start CTXORA MCP in the foreground. |
|
|
241
|
+
| `start`, `status`, `stop` | Manage the local background process. |
|
|
242
|
+
| `index` | Build or refresh the local snapshot. |
|
|
243
|
+
| `query` | Return a structured context package. |
|
|
244
|
+
| `explain` | Explain where and how a change should be made. |
|
|
245
|
+
| `context-score` | Score repository context readiness. |
|
|
246
|
+
| `repo-map` | Produce a compact repository map. |
|
|
247
|
+
| `inspect` | Inspect workspace, snapshot, bundle, or ECC state. |
|
|
248
|
+
| `doctor`, `repair` | Diagnose or rebuild local state. |
|
|
249
|
+
| `export` | Export a snapshot to JSON. |
|
|
250
|
+
| `profile` | List supported coding-agent profiles. |
|
|
251
|
+
| `install`, `uninstall` | Add or remove MCP client configuration safely. |
|
|
252
|
+
| `ci` | Refresh files changed between two Git refs. |
|
|
253
|
+
| `generate-agents-md` | Generate repository instructions for agents. |
|
|
254
|
+
| `generate-copilot-instructions` | Generate GitHub Copilot instructions. |
|
|
255
|
+
| `generate-cursor-rules` | Generate Cursor rules. |
|
|
256
|
+
| `pro` | Show CTXORA Pro waitlist status; installs no paid functionality. |
|
|
257
|
+
|
|
258
|
+
All commands support `--workspace`. Run `ctxora <command> --help` for command-specific options.
|
|
259
|
+
|
|
260
|
+
## MCP tools
|
|
261
|
+
|
|
262
|
+
CTXORA MCP currently exposes 24 tools.
|
|
263
|
+
|
|
264
|
+
### Context and workspace
|
|
265
|
+
|
|
266
|
+
| Tool | Purpose |
|
|
267
|
+
|---|---|
|
|
268
|
+
| `register_workspace` | Register an allowed repository root. |
|
|
269
|
+
| `refresh_workspace` | Build or incrementally refresh its snapshot. |
|
|
270
|
+
| `plan_context` | Select the best retrieval strategy for a task. |
|
|
271
|
+
| `retrieve_context` | Return ranked evidence with coverage diagnostics. |
|
|
272
|
+
| `prepare_context` | Produce the final budgeted context package. |
|
|
273
|
+
| `context_stats` | Inspect index and snapshot statistics. |
|
|
274
|
+
| `invalidate_context` | Invalidate indexes or cached state. |
|
|
275
|
+
| `retrieve_context_legacy` | Compatibility entry point for older clients. |
|
|
276
|
+
|
|
277
|
+
### Memory and handoffs
|
|
278
|
+
|
|
279
|
+
| Tool | Purpose |
|
|
280
|
+
|---|---|
|
|
281
|
+
| `memory_save`, `memory_search`, `memory_inject` | Persist, retrieve, and inject scoped knowledge. |
|
|
282
|
+
| `memory_list`, `memory_delete`, `memory_evict`, `memory_stats` | Manage local memory lifecycle. |
|
|
283
|
+
| `handoff_conversation` | Store a raw provider-format conversation handoff. |
|
|
284
|
+
| `restore_conversation_handoff` | Restore an explicitly selected handoff. |
|
|
285
|
+
| `list_conversation_handoffs` | List retained handoffs. |
|
|
286
|
+
| `delete_conversation_handoff`, `purge_expired_handoffs` | Remove selected or expired handoffs. |
|
|
287
|
+
|
|
288
|
+
### Utilities
|
|
289
|
+
|
|
290
|
+
| Tool | Purpose |
|
|
291
|
+
|---|---|
|
|
292
|
+
| `estimate_tokens` | Estimate token usage for supplied text. |
|
|
293
|
+
| `get_token_budget` | Return model context budget and reserved headroom. |
|
|
294
|
+
| `invalidate_cache` | Clear the retrieval cache. |
|
|
295
|
+
| `reindex_paths` | Force reindexing for selected paths. |
|
|
296
|
+
|
|
297
|
+
JSON Schemas for API v2 are published under [`schemas/mcp-v2/`](schemas/mcp-v2/).
|
|
298
|
+
|
|
299
|
+
## Retrieval strategies
|
|
300
|
+
|
|
301
|
+
| Strategy | Best for |
|
|
302
|
+
|---|---|
|
|
303
|
+
| `cag` | Stable instructions and compact repository knowledge. |
|
|
304
|
+
| `hybrid_rag` | Focused code questions requiring ranked evidence. |
|
|
305
|
+
| `long_context` | Small repositories that fit within the target budget. |
|
|
306
|
+
| `hybrid_cag_rag` | Stable guidance plus task-specific code evidence. |
|
|
307
|
+
| `graph_augmented` | Architecture, call paths, dependencies, and impact analysis. |
|
|
308
|
+
|
|
309
|
+
The planner is deterministic and can be overridden when a caller needs a specific strategy.
|
|
310
|
+
|
|
311
|
+
## ECC integration
|
|
312
|
+
|
|
313
|
+
CTXORA can read the [`ecc.memory.v1`](https://github.com/affaan-m/ECC) vault format as optional external context. It does not install, clone, invoke, or modify ECC.
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
ctxora run --workspace . --transport stdio --ecc
|
|
317
|
+
ctxora inspect --workspace . --ecc ecc
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Project memory at `.ecc/memory` is read-only. User-level memory at `~/.ecc/memory` stays disabled unless `--ecc-user-scope` or `ecc_allow_user_scope = true` is explicitly configured. Imported memories are marked with external provenance and unreviewed trust.
|
|
321
|
+
|
|
322
|
+
## Architecture
|
|
323
|
+
|
|
324
|
+
```text
|
|
325
|
+
CLI / MCP / CI transports
|
|
326
|
+
↓
|
|
327
|
+
Application services
|
|
328
|
+
↓
|
|
329
|
+
Domain contracts and planning
|
|
330
|
+
↓
|
|
331
|
+
Local scanners · parsers · indexes · graph · snapshots · SQLite
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Production packages use the `src/` layout. `harness_context` remains the internal Python namespace for compatibility; public branding and commands use CTXORA. See [Architecture](docs/ARCHITECTURE.md) and [OSS release scope](docs/OSS-IMPLEMENTATION-PLAN.md).
|
|
335
|
+
|
|
336
|
+
## Privacy and security
|
|
337
|
+
|
|
338
|
+
- No remote telemetry by default.
|
|
339
|
+
- No required cloud account or hosted index.
|
|
340
|
+
- Workspace roots are explicitly authorized and canonicalized.
|
|
341
|
+
- Symlinks cannot escape an authorized root.
|
|
342
|
+
- Secret-like and binary files are excluded before indexing.
|
|
343
|
+
- Retrieved source is untrusted evidence and cannot override agent instructions.
|
|
344
|
+
- External HTTP is opt-in and requires your own authorization layer.
|
|
345
|
+
|
|
346
|
+
Report vulnerabilities through [GitHub Private Vulnerability Reporting](https://github.com/nguyentrunghieutcu/ctxora-engine/security/advisories/new). If that channel is unavailable, email `nguyentrunghieutcu@gmail.com`. See [SECURITY.md](SECURITY.md).
|
|
347
|
+
|
|
348
|
+
## Free and Pro
|
|
349
|
+
|
|
350
|
+
### CTXORA Free — available now
|
|
351
|
+
|
|
352
|
+
The entire local engine in this MIT-licensed repository is free and unlimited: manual indexing, CAG/RAG/graph retrieval, MCP, local memory, handoffs, health tools, repository maps, and instruction generation.
|
|
353
|
+
|
|
354
|
+
### CTXORA Pro — waitlist
|
|
355
|
+
|
|
356
|
+
Planned paid scope is limited to managed repository automation, private workflow operations, and shared team context. Billing, entitlements, hosted automation, and team services are not implemented in this repository. Running `ctxora pro` only returns waitlist information.
|
|
357
|
+
|
|
358
|
+
See [the product boundary](docs/PRICING.md).
|
|
359
|
+
|
|
360
|
+
## Project structure
|
|
361
|
+
|
|
362
|
+
```text
|
|
363
|
+
src/harness_context/ Runtime, domain, application, MCP, CLI, storage
|
|
364
|
+
src/chunking/ AST-aware and fallback chunking
|
|
365
|
+
src/context/ Assembly, sanitization, token budgeting
|
|
366
|
+
src/retrieval/ BM25, local embeddings, graph, reranking, cache
|
|
367
|
+
src/memory/ Local episodic and vector memory
|
|
368
|
+
src/compact/ Provider handoff and compaction helpers
|
|
369
|
+
src/evaluation/ Quality metrics and release gates
|
|
370
|
+
bin/ Dependency-free npm/npx launcher
|
|
371
|
+
skills/ Installable coding-agent skills
|
|
372
|
+
schemas/mcp-v2/ Published API v2 JSON Schemas
|
|
373
|
+
tests/ Unit, security, evaluation, E2E, packaging tests
|
|
374
|
+
scripts/ Install, uninstall, migration, topology audit
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## Development and verification
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
npm test
|
|
381
|
+
npm pack --dry-run
|
|
382
|
+
ruff check .
|
|
383
|
+
python scripts/audit_topology.py
|
|
384
|
+
python -m unittest discover -s tests -t . -v
|
|
385
|
+
python -m evaluation.gates
|
|
386
|
+
python -m compileall -q src tests scripts
|
|
387
|
+
git diff --check
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
The CI matrix runs on Python 3.10, 3.11, 3.12, and 3.13. Evaluation fixtures cover Python, TypeScript, Flutter, monorepos, Vietnamese content, malicious prompt-like files, long documents, and duplicate symbols.
|
|
391
|
+
|
|
392
|
+
## Troubleshooting
|
|
393
|
+
|
|
394
|
+
### `ctxora` is not found
|
|
395
|
+
|
|
396
|
+
Use the npm launcher without installing a global command:
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
npx ctxora --version
|
|
400
|
+
npx ctxora doctor --workspace .
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Workspace is rejected
|
|
404
|
+
|
|
405
|
+
Use an absolute existing path and ensure it is included in `CTXORA_ALLOWED_ROOTS` when the MCP client sets an allowlist.
|
|
406
|
+
|
|
407
|
+
### Existing instruction file is not replaced
|
|
408
|
+
|
|
409
|
+
This is intentional. Review the generated output path or rerun the generator with `--force` only when replacement is desired.
|
|
410
|
+
|
|
411
|
+
### HTTP binding is rejected
|
|
412
|
+
|
|
413
|
+
Loopback is the default security boundary. Use `--allow-external` only behind an authentication and network-access layer you control.
|
|
414
|
+
|
|
415
|
+
### Local state needs rebuilding
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
ctxora doctor --workspace .
|
|
419
|
+
ctxora repair --workspace .
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Documentation
|
|
423
|
+
|
|
424
|
+
- [OSS release scope](docs/OSS-IMPLEMENTATION-PLAN.md)
|
|
425
|
+
- [Architecture](docs/ARCHITECTURE.md)
|
|
426
|
+
- [Operations](docs/OPERATIONS.md)
|
|
427
|
+
- [Free and Pro boundary](docs/PRICING.md)
|
|
428
|
+
- [Security policy](SECURITY.md)
|
|
429
|
+
- [Support policy](SUPPORT.md)
|
|
430
|
+
- [Contributing](CONTRIBUTING.md)
|
|
431
|
+
- [Changelog](CHANGELOG.md)
|
|
432
|
+
|
|
433
|
+
## Community
|
|
434
|
+
|
|
435
|
+
- Open a [GitHub issue](https://github.com/nguyentrunghieutcu/ctxora-engine/issues) for reproducible bugs and feature requests.
|
|
436
|
+
- Use private vulnerability reporting for security issues.
|
|
437
|
+
- Contributions that preserve the local-first and paid-control-plane independence boundaries are welcome.
|
|
438
|
+
|
|
439
|
+
## License
|
|
440
|
+
|
|
441
|
+
CTXORA Engine is released under the [MIT License](LICENSE).
|