File size: 8,276 Bytes
3fbbaab
 
 
 
 
 
6c0b346
3fbbaab
 
 
 
 
 
 
e18385d
3fbbaab
 
 
e18385d
3fbbaab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7609903
 
 
 
 
 
 
 
 
3fbbaab
 
 
 
 
 
 
 
b14b10e
e18385d
 
 
3fbbaab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e18385d
 
 
3fbbaab
 
 
 
 
7609903
 
 
 
 
 
 
 
 
 
 
3fbbaab
 
0c5b275
 
3fbbaab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7609903
 
 
 
 
3fbbaab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7609903
 
3fbbaab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
[build-system]
requires = ["setuptools>=77"]
build-backend = "setuptools.build_meta"

[project]
name = "claude-ctx"
version = "1.0.11"
description = "Skill and agent recommendation system for Claude Code — knowledge graph, wiki, and intake quality gates"
authors = [{ name = "Steve Solun" }]
license = "MIT"
readme = "README.md"
requires-python = ">=3.11"

dependencies = [
    "markdown>=3.6,<4",
    "networkx>=3,<4",
    "numpy>=1.24,<3",
    "plotly>=5,<7",
    "pymdown-extensions>=10,<11",
    "pyyaml>=6,<7",
]

[project.urls]
Homepage = "https://stevesolun.github.io/ctx/"
Repository = "https://github.com/stevesolun/ctx"
Documentation = "https://stevesolun.github.io/ctx/"
Changelog = "https://github.com/stevesolun/ctx/blob/main/CHANGELOG.md"

[project.scripts]
# Plan 001 phase R5: entrypoints for modules moved in R1-R4 now point at
# their canonical package path. Entrypoints for modules still at the
# flat layout (ctx_init, ctx_monitor, etc.) stay unchanged — they will
# move in a later R-phase. The legacy flat shims continue to exist so
# anyone invoking the CLIs via `python path/to/module.py` keeps working.
ctx-init = "ctx_init:main"
ctx-install-hooks = "ctx.adapters.claude_code.inject_hooks:main"
ctx-monitor = "ctx_monitor:main"
ctx-scan-repo = "scan_repo:main"
ctx-skill-quality = "skill_quality:main"
ctx-skill-health = "ctx.adapters.claude_code.skill_health:main"
ctx-toolbox = "toolbox:main"
ctx-lifecycle = "ctx_lifecycle:main"
ctx-skill-add = "skill_add:main"
ctx-skill-install = "ctx.adapters.claude_code.install.skill_install:main"
ctx-skill-mirror = "skill_mirror:main"
ctx-bundle-suggest = "ctx.adapters.claude_code.hooks.bundle_orchestrator:main"
ctx-recommend = "ctx.cli.recommend:main"
ctx-agent-add = "agent_add:main"
ctx-agent-mirror = "agent_mirror:main"
ctx-agent-install = "ctx.adapters.claude_code.install.agent_install:main"
ctx-harness-add = "harness_add:main"
ctx-harness-install = "harness_install:main"
ctx-mcp-add = "mcp_add:main"
ctx-mcp-fetch = "mcp_fetch:main"
ctx-mcp-ingest = "mcp_ingest:main"
ctx-mcp-enrich = "mcp_enrich:main"
ctx-mcp-install = "ctx.adapters.claude_code.install.mcp_install:install_main"
ctx-mcp-uninstall = "ctx.adapters.claude_code.install.mcp_install:uninstall_main"
ctx-mcp-quality = "mcp_quality:main"
ctx-mcp-rebuild-index = "mcp_rebuild_index:main"
ctx-wiki-graphify = "ctx.core.wiki.wiki_graphify:main"
ctx-wiki-worker = "ctx.core.wiki.wiki_queue_worker:main"
ctx-incremental-attach = "ctx.core.graph.incremental_attach:main"
ctx-incremental-shadow = "ctx.core.graph.incremental_shadow:main"
ctx-source-registry = "ctx.core.source_registry:main"
# Pre-ship dedup gate: flag entity pairs at or above the given cosine
# similarity threshold (default 0.85). Cross-type by design — finds
# duplicates across skills, agents, and MCPs in any combination.
ctx-dedup-check = "ctx.core.quality.dedup_check:main"
# Pre-ship tag-completeness gate: scan skills/agents for empty
# `tags:` frontmatter and propose backfills from slug tokens + body
# keywords + the existing tag vocabulary. Report-only by default;
# `--apply` to write.
ctx-tag-backfill = "ctx.core.quality.tag_backfill:main"
# Plan 001 phase H7: the generic harness CLI — `ctx run`,
# `ctx resume`, `ctx sessions`. Ships v1 of the model-agnostic
# harness; requires the [harness] optional dep for LiteLLM.
ctx = "ctx.cli.run:main"
# Plan 001 phase H8: standalone MCP server exposing ctx-core.
# Any MCP-aware host (Cline, Goose, Claude Code itself, Claude
# Agent SDK, custom harness) can attach this server and gain
# access to the skill/agent/MCP recommendation surface WITHOUT
# using our ``ctx run`` harness loop.
ctx-mcp-server = "ctx.mcp_server.server:main"

[project.optional-dependencies]
dev = [
    "pytest>=8",
    "pytest-cov>=5",
    "hypothesis>=6",
    "mypy>=1.8",
    "ruff>=0.4",
]
browser = [
    "playwright>=1.52",
]
embeddings = [
    "sentence-transformers>=2,<4",
    "torch>=2,<3",
]
ann = [
    "hnswlib>=0.8,<0.9; platform_python_implementation == 'CPython'",
]
harness = [
    # LiteLLM is the substrate for the model-agnostic harness
    # (ctx.adapters.generic.providers). Every remote provider —
    # OpenRouter (the tier-1 aggregator), Anthropic, OpenAI, Gemini,
    # Mistral, ... — and local inference servers (Ollama, vLLM) all
    # flow through a single litellm.completion() call. Keeping the
    # dep optional means users who only want the Claude Code
    # integration (ctx-skill-install, the hooks pipeline) don't pay
    # the LiteLLM dependency-tree cost.
    # LiteLLM 1.83.x pins click==8.1.8. Typer 0.17+ requires newer
    # click, so cap Typer for users who install [embeddings,harness]
    # together through sentence-transformers/transformers.
    "click==8.1.8",
    "typer>=0.16,<0.17",
    "litellm>=1.40,<2",
]

[tool.setuptools]
# Incremental package-layout migration.
# During migration phases the codebase lives in TWO shapes simultaneously:
#   - The legacy flat modules listed in ``py-modules`` below.
#   - The target ``ctx`` package tree (ctx.core, ctx.adapters, ctx.cli,
#     ctx.mcp_server, ctx.utils) declared in ``packages`` below.
# Each R-phase moves a small batch from the flat list into the package
# tree, updates imports, and drops the corresponding py-modules entry.
# Running both layouts at once is intentional — it lets the migration
# ship one commit at a time with the suite green at every step.
package-dir = {"" = "src"}
py-modules = [
    "agent_add",
    "agent_mirror",
    "backup_config",
    "backup_mirror",
    "backup_retention",
    "backup_watchdog",
    "batch_convert",
    "behavior_miner",
    "catalog_builder",
    "change_detector",
    "corpus_cache",
    "cosine_ranker",
    "council_runner",
    "ctx_audit_log",
    "ctx_config",
    "ctx_init",
    "ctx_lifecycle",
    "ctx_monitor",
    "harness_add",
    "harness_install",
    "embedding_backend",
    "flatten_agents",
    "import_strix_skills",
    "intake_gate",
    "intake_pipeline",
    "intent_interview",
    "kpi_dashboard",
    "link_conversions",
    "mcp_add",
    "mcp_canonical_index",
    "mcp_enrich",
    "mcp_entity",
    "mcp_fetch",
    "mcp_ingest",
    "mcp_quality",
    "mcp_quality_signals",
    "mcp_rebuild_index",
    "memory_anchor",
    "scan_repo",
    "skill_add",
    "skill_add_detector",
    "skill_category",
    "skill_mirror",
    "skill_quality",
    "skill_telemetry",
    "toolbox",
    "toolbox_config",
    "toolbox_hooks",
    "toolbox_verdict",
    "update_repo_stats",
    "usage_tracker",
    "versions_catalog",
    "wiki_batch_entities",
    "wiki_orchestrator",
    "wiki_visualize",
]
# Do NOT ship the test suite to PyPI. The previous build inadvertently
# bundled src/tests/ because it was the only directory with __init__.py.
# The ``mcp_sources`` subpackage is listed here because setuptools'
# ``py-modules`` is flat-only; subpackages need an explicit ``packages``
# entry to be installed. Plan 001 (phase R0) adds the ``ctx`` tree
# alongside; both layouts coexist until R6 drops the flat modules.
packages = [
    "mcp_sources",
    "ctx",
    "ctx.core",
    "ctx.core.graph",
    "ctx.core.quality",
    "ctx.core.wiki",
    "ctx.core.resolve",
    "ctx.core.bundle",
    "ctx.adapters",
    "ctx.adapters.claude_code",
    "ctx.adapters.claude_code.hooks",
    "ctx.adapters.claude_code.install",
    "ctx.adapters.generic",
    "ctx.adapters.generic.providers",
    "ctx.adapters.generic.tools",
    "ctx.cli",
    "ctx.mcp_server",
    "ctx.utils",
]

[tool.setuptools.package-data]
ctx = ["config.json", "skill-registry.json"]

[tool.pytest.ini_options]
testpaths = ["src/tests"]
markers = [
    "integration: marks tests that require external models or network (deselect with -m 'not integration')",
    "browser: marks tests that drive a real browser with Playwright",
]

[tool.mypy]
python_version = "3.11"
mypy_path = "src"
namespace_packages = true
explicit_package_bases = true
ignore_missing_imports = true

[tool.ruff]
line-length = 100
target-version = "py311"