k0ntext 3.0.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 +623 -0
- package/bin/k0ntext.js +12 -0
- package/dist/agents/cleanup-agent.d.ts +39 -0
- package/dist/agents/cleanup-agent.d.ts.map +1 -0
- package/dist/agents/cleanup-agent.js +56 -0
- package/dist/agents/cleanup-agent.js.map +1 -0
- package/dist/agents/performance-agent.d.ts +37 -0
- package/dist/agents/performance-agent.d.ts.map +1 -0
- package/dist/agents/performance-agent.js +91 -0
- package/dist/agents/performance-agent.js.map +1 -0
- package/dist/analyzer/index.d.ts +5 -0
- package/dist/analyzer/index.d.ts.map +1 -0
- package/dist/analyzer/index.js +5 -0
- package/dist/analyzer/index.js.map +1 -0
- package/dist/analyzer/intelligent-analyzer.d.ts +111 -0
- package/dist/analyzer/intelligent-analyzer.d.ts.map +1 -0
- package/dist/analyzer/intelligent-analyzer.js +537 -0
- package/dist/analyzer/intelligent-analyzer.js.map +1 -0
- package/dist/cli/commands/cleanup.d.ts +3 -0
- package/dist/cli/commands/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/cleanup.js +24 -0
- package/dist/cli/commands/cleanup.js.map +1 -0
- package/dist/cli/commands/export.d.ts +9 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +72 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/import.d.ts +9 -0
- package/dist/cli/commands/import.d.ts.map +1 -0
- package/dist/cli/commands/import.js +62 -0
- package/dist/cli/commands/import.js.map +1 -0
- package/dist/cli/commands/performance.d.ts +9 -0
- package/dist/cli/commands/performance.d.ts.map +1 -0
- package/dist/cli/commands/performance.js +36 -0
- package/dist/cli/commands/performance.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +9 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +82 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +9 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +72 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/generate.d.ts +3 -0
- package/dist/cli/generate.d.ts.map +1 -0
- package/dist/cli/generate.js +194 -0
- package/dist/cli/generate.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +448 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/sync.d.ts +26 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +163 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/config/cleanup-config.d.ts +26 -0
- package/dist/config/cleanup-config.d.ts.map +1 -0
- package/dist/config/cleanup-config.js +21 -0
- package/dist/config/cleanup-config.js.map +1 -0
- package/dist/db/client.d.ts +284 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +688 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +6 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +41 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +226 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/embeddings/index.d.ts +5 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +5 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/openrouter.d.ts +133 -0
- package/dist/embeddings/openrouter.d.ts.map +1 -0
- package/dist/embeddings/openrouter.js +455 -0
- package/dist/embeddings/openrouter.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +29 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +257 -0
- package/dist/mcp.js.map +1 -0
- package/docs/ARCHIVE/MIGRATE_TO_NEW_REPO.md +222 -0
- package/docs/ARCHIVE/MIGRATE_TO_UNIFIED.md +220 -0
- package/docs/CLEANUP.md +76 -0
- package/docs/MCP_QUICKSTART.md +219 -0
- package/docs/QUICKSTART.md +119 -0
- package/docs/TROUBLESHOOTING.md +611 -0
- package/package.json +100 -0
- package/skills/context-optimize/SKILL.md +86 -0
- package/skills/implement/SKILL.md +150 -0
- package/skills/plan/SKILL.md +143 -0
- package/skills/research/SKILL.md +103 -0
- package/skills/validate/SKILL.md +62 -0
- package/skills/verify-docs/SKILL.md +77 -0
- package/src/agents/cleanup-agent.ts +96 -0
- package/src/agents/performance-agent.ts +117 -0
- package/src/analyzer/index.ts +10 -0
- package/src/analyzer/intelligent-analyzer.ts +640 -0
- package/src/cli/commands/cleanup.ts +26 -0
- package/src/cli/commands/export.ts +82 -0
- package/src/cli/commands/import.ts +73 -0
- package/src/cli/commands/performance.ts +40 -0
- package/src/cli/commands/validate.ts +98 -0
- package/src/cli/commands/watch.ts +83 -0
- package/src/cli/generate.ts +219 -0
- package/src/cli/index.ts +510 -0
- package/src/cli/sync.ts +194 -0
- package/src/config/cleanup-config.ts +42 -0
- package/src/db/client.ts +949 -0
- package/src/db/index.ts +19 -0
- package/src/db/schema.ts +241 -0
- package/src/embeddings/index.ts +11 -0
- package/src/embeddings/openrouter.ts +592 -0
- package/src/index.ts +57 -0
- package/src/mcp.ts +354 -0
- package/templates/AI_CONTEXT.md.template +245 -0
- package/templates/base/README.md +260 -0
- package/templates/base/RPI_WORKFLOW_PLAN.md +325 -0
- package/templates/base/agents/api-developer.md +76 -0
- package/templates/base/agents/context-engineer.md +525 -0
- package/templates/base/agents/core-architect.md +76 -0
- package/templates/base/agents/database-ops.md +76 -0
- package/templates/base/agents/deployment-ops.md +76 -0
- package/templates/base/agents/integration-hub.md +76 -0
- package/templates/base/analytics/README.md +114 -0
- package/templates/base/automation/config.json +58 -0
- package/templates/base/automation/generators/code-mapper.js +308 -0
- package/templates/base/automation/generators/index-builder.js +321 -0
- package/templates/base/automation/hooks/post-commit.sh +83 -0
- package/templates/base/automation/hooks/pre-commit.sh +103 -0
- package/templates/base/ci-templates/README.md +108 -0
- package/templates/base/ci-templates/github-actions/context-check.yml +144 -0
- package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -0
- package/templates/base/commands/analytics.md +238 -0
- package/templates/base/commands/auto-sync.md +172 -0
- package/templates/base/commands/collab.md +194 -0
- package/templates/base/commands/context-optimize.md +226 -0
- package/templates/base/commands/help.md +485 -0
- package/templates/base/commands/rpi-implement.md +164 -0
- package/templates/base/commands/rpi-plan.md +147 -0
- package/templates/base/commands/rpi-research.md +145 -0
- package/templates/base/commands/session-resume.md +144 -0
- package/templates/base/commands/session-save.md +112 -0
- package/templates/base/commands/validate-all.md +77 -0
- package/templates/base/commands/verify-docs-current.md +86 -0
- package/templates/base/config/base.json +57 -0
- package/templates/base/config/environments/development.json +13 -0
- package/templates/base/config/environments/production.json +17 -0
- package/templates/base/config/environments/staging.json +13 -0
- package/templates/base/config/local.json.example +21 -0
- package/templates/base/context/.meta/generated-at.json +18 -0
- package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -0
- package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -0
- package/templates/base/context/FILE_OWNERSHIP.md +57 -0
- package/templates/base/context/INTEGRATION_POINTS.md +92 -0
- package/templates/base/context/KNOWN_GOTCHAS.md +195 -0
- package/templates/base/context/TESTING_MAP.md +95 -0
- package/templates/base/context/WORKFLOW_INDEX.md +129 -0
- package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -0
- package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -0
- package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -0
- package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -0
- package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -0
- package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -0
- package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -0
- package/templates/base/knowledge/README.md +98 -0
- package/templates/base/knowledge/sessions/README.md +88 -0
- package/templates/base/knowledge/sessions/TEMPLATE.md +150 -0
- package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -0
- package/templates/base/knowledge/shared/decisions/README.md +49 -0
- package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -0
- package/templates/base/knowledge/shared/patterns/README.md +62 -0
- package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -0
- package/templates/base/plans/PLAN_TEMPLATE.md +316 -0
- package/templates/base/plans/active/.gitkeep +0 -0
- package/templates/base/plans/completed/.gitkeep +0 -0
- package/templates/base/research/RESEARCH_TEMPLATE.md +245 -0
- package/templates/base/research/active/.gitkeep +0 -0
- package/templates/base/research/completed/.gitkeep +0 -0
- package/templates/base/schemas/agent.schema.json +141 -0
- package/templates/base/schemas/anchors.schema.json +54 -0
- package/templates/base/schemas/automation.schema.json +93 -0
- package/templates/base/schemas/command.schema.json +134 -0
- package/templates/base/schemas/hashes.schema.json +40 -0
- package/templates/base/schemas/manifest.schema.json +117 -0
- package/templates/base/schemas/plan.schema.json +136 -0
- package/templates/base/schemas/research.schema.json +115 -0
- package/templates/base/schemas/roles.schema.json +34 -0
- package/templates/base/schemas/session.schema.json +77 -0
- package/templates/base/schemas/settings.schema.json +244 -0
- package/templates/base/schemas/staleness.schema.json +53 -0
- package/templates/base/schemas/team-config.schema.json +42 -0
- package/templates/base/schemas/workflow.schema.json +126 -0
- package/templates/base/session/checkpoints/.gitkeep +2 -0
- package/templates/base/session/current/state.json +20 -0
- package/templates/base/session/history/.gitkeep +2 -0
- package/templates/base/settings.json +3 -0
- package/templates/base/standards/COMPATIBILITY.md +219 -0
- package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -0
- package/templates/base/standards/QUALITY_CHECKLIST.md +211 -0
- package/templates/base/standards/README.md +66 -0
- package/templates/base/sync/anchors.json +6 -0
- package/templates/base/sync/hashes.json +6 -0
- package/templates/base/sync/staleness.json +10 -0
- package/templates/base/team/README.md +168 -0
- package/templates/base/team/config.json +79 -0
- package/templates/base/team/roles.json +145 -0
- package/templates/base/tools/bin/claude-context.js +151 -0
- package/templates/base/tools/lib/anchor-resolver.js +276 -0
- package/templates/base/tools/lib/config-loader.js +363 -0
- package/templates/base/tools/lib/detector.js +350 -0
- package/templates/base/tools/lib/diagnose.js +206 -0
- package/templates/base/tools/lib/drift-detector.js +373 -0
- package/templates/base/tools/lib/errors.js +199 -0
- package/templates/base/tools/lib/index.js +36 -0
- package/templates/base/tools/lib/init.js +192 -0
- package/templates/base/tools/lib/logger.js +230 -0
- package/templates/base/tools/lib/placeholder.js +201 -0
- package/templates/base/tools/lib/session-manager.js +354 -0
- package/templates/base/tools/lib/validate.js +521 -0
- package/templates/base/tools/package.json +49 -0
- package/templates/handlebars/aider-config.hbs +146 -0
- package/templates/handlebars/antigravity.hbs +377 -0
- package/templates/handlebars/claude.hbs +183 -0
- package/templates/handlebars/cline.hbs +62 -0
- package/templates/handlebars/continue-config.hbs +116 -0
- package/templates/handlebars/copilot.hbs +130 -0
- package/templates/handlebars/partials/gotcha-list.hbs +11 -0
- package/templates/handlebars/partials/header.hbs +3 -0
- package/templates/handlebars/partials/workflow-summary.hbs +16 -0
- package/templates/handlebars/windsurf-rules.hbs +69 -0
- package/templates/hooks/post-commit.hbs +28 -0
- package/templates/hooks/pre-commit.hbs +46 -0
package/docs/CLEANUP.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Context Cleanup
|
|
2
|
+
|
|
3
|
+
The context cleanup feature helps you remove leftover context folders from various AI tools that may be cluttering your project directory.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
k0ntext cleanup [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
- `--dry-run` - Show what would be removed without actually deleting anything
|
|
14
|
+
- `--keep <folders>` - Folders to keep (comma-separated list)
|
|
15
|
+
- `--verbose` - Show detailed output during cleanup
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Basic cleanup (dry run)
|
|
20
|
+
```bash
|
|
21
|
+
k0ntext cleanup --dry-run
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Clean up with specific folders to keep
|
|
25
|
+
```bash
|
|
26
|
+
k0ntext cleanup --keep .vscode,.github
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Full cleanup with verbose output
|
|
30
|
+
```bash
|
|
31
|
+
k0ntext cleanup --verbose
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Folders Cleaned
|
|
35
|
+
|
|
36
|
+
The cleanup agent removes the following tool-specific folders:
|
|
37
|
+
|
|
38
|
+
- `.cursor` - Cursor AI tool
|
|
39
|
+
- `.windsurf` - Windsurf AI tool
|
|
40
|
+
- `.cline` - Cline AI tool
|
|
41
|
+
- `.aider` - Aider AI tool
|
|
42
|
+
- `.continue` - Continue AI tool
|
|
43
|
+
- `.copilot` - GitHub Copilot
|
|
44
|
+
- `.cursorrules` - Cursor rules
|
|
45
|
+
- `.ai-context` - Legacy AI context folders
|
|
46
|
+
- `.github` - GitHub configuration
|
|
47
|
+
- `.vscode` - VSCode settings
|
|
48
|
+
- `.idea` - IntelliJ IDEA settings
|
|
49
|
+
- `.devcontainer` - Dev container configuration
|
|
50
|
+
|
|
51
|
+
## Safety Features
|
|
52
|
+
|
|
53
|
+
- **Dry Run Mode**: Always run with `--dry-run` first to see what will be removed
|
|
54
|
+
- **Keep Option**: Specify folders to preserve using the `--keep` flag
|
|
55
|
+
- **Verbose Output**: See detailed information about what's being processed
|
|
56
|
+
- **Error Handling**: Errors during removal are caught and reported without stopping the process
|
|
57
|
+
|
|
58
|
+
## Best Practices
|
|
59
|
+
|
|
60
|
+
1. Always run with `--dry-run` first to review what will be removed
|
|
61
|
+
2. Use the `--keep` option to preserve important configuration folders
|
|
62
|
+
3. Backup your project before running a full cleanup
|
|
63
|
+
4. Run cleanup periodically to maintain a clean project structure
|
|
64
|
+
|
|
65
|
+
## Troubleshooting
|
|
66
|
+
|
|
67
|
+
If you encounter permission errors:
|
|
68
|
+
- Ensure you have proper file system permissions
|
|
69
|
+
- Try running with elevated privileges if needed
|
|
70
|
+
- Check if folders are in use by running processes
|
|
71
|
+
|
|
72
|
+
## Related Commands
|
|
73
|
+
|
|
74
|
+
- `k0ntext init` - Initialize AI context for a project
|
|
75
|
+
- `k0ntext index` - Index codebase content into the database
|
|
76
|
+
- `k0ntext sync` - Sync across AI tools
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# K0ntext - MCP Server Quick Start
|
|
2
|
+
|
|
3
|
+
Connect the K0ntext MCP server to Claude Desktop (or other MCP-compatible AI assistants) to give your AI intelligent access to your codebase.
|
|
4
|
+
|
|
5
|
+
## What is MCP?
|
|
6
|
+
|
|
7
|
+
The Model Context Protocol (MCP) is a standard for AI assistants to access external tools and data. With K0ntext's MCP server, your AI can:
|
|
8
|
+
|
|
9
|
+
- Search your codebase semantically
|
|
10
|
+
- Retrieve specific files and context
|
|
11
|
+
- Query the knowledge graph
|
|
12
|
+
- Run intelligent analysis
|
|
13
|
+
- Check documentation drift
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
1. **K0ntext installed:**
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g k0ntext
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. **Claude Desktop** (or another MCP-compatible client)
|
|
23
|
+
|
|
24
|
+
3. **A project initialized with K0ntext:**
|
|
25
|
+
```bash
|
|
26
|
+
cd your-project
|
|
27
|
+
k0ntext init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Setup with Claude Desktop
|
|
31
|
+
|
|
32
|
+
### Step 1: Find Your Claude Config
|
|
33
|
+
|
|
34
|
+
The config location depends on your OS:
|
|
35
|
+
|
|
36
|
+
| Platform | Config Path |
|
|
37
|
+
|----------|-------------|
|
|
38
|
+
| macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
39
|
+
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
40
|
+
| Linux | `~/.config/Claude/claude_desktop_config.json` |
|
|
41
|
+
|
|
42
|
+
### Step 2: Add K0ntext MCP Server
|
|
43
|
+
|
|
44
|
+
Edit your `claude_desktop_config.json`:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"k0ntext": {
|
|
50
|
+
"command": "npx",
|
|
51
|
+
"args": [
|
|
52
|
+
"-y",
|
|
53
|
+
"k0ntext",
|
|
54
|
+
"mcp"
|
|
55
|
+
],
|
|
56
|
+
"cwd": "/path/to/your/project"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Important:** Replace `/path/to/your/project` with your actual project path.
|
|
63
|
+
|
|
64
|
+
#### Multiple Projects
|
|
65
|
+
|
|
66
|
+
For multiple projects, use different server names:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"k0ntext-project-a": {
|
|
72
|
+
"command": "npx",
|
|
73
|
+
"args": ["-y", "k0ntext", "mcp"],
|
|
74
|
+
"cwd": "/path/to/project-a"
|
|
75
|
+
},
|
|
76
|
+
"k0ntext-project-b": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["-y", "k0ntext", "mcp"],
|
|
79
|
+
"cwd": "/path/to/project-b"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Step 3: Restart Claude Desktop
|
|
86
|
+
|
|
87
|
+
Completely quit and restart Claude Desktop.
|
|
88
|
+
|
|
89
|
+
### Step 4: Verify Connection
|
|
90
|
+
|
|
91
|
+
In a new Claude conversation, you should see **k0ntext** listed in the available MCP tools.
|
|
92
|
+
|
|
93
|
+
## Available MCP Tools
|
|
94
|
+
|
|
95
|
+
The K0ntext MCP server provides these tools:
|
|
96
|
+
|
|
97
|
+
| Tool | Description |
|
|
98
|
+
|------|-------------|
|
|
99
|
+
| `search_context` | Semantic search across indexed content |
|
|
100
|
+
| `get_item` | Retrieve specific context items by ID |
|
|
101
|
+
| `add_knowledge` | Store insights and facts |
|
|
102
|
+
| `analyze` | Run intelligent codebase analysis |
|
|
103
|
+
| `get_tool_configs` | View AI tool configurations |
|
|
104
|
+
| `query_graph` | Traverse knowledge graph |
|
|
105
|
+
| `get_stats` | Database statistics |
|
|
106
|
+
| `add_relation` | Add relationships between items |
|
|
107
|
+
| `find_path` | Find paths between items |
|
|
108
|
+
| `run_drift_check` | Check documentation sync |
|
|
109
|
+
|
|
110
|
+
## Usage Examples
|
|
111
|
+
|
|
112
|
+
### Semantic Search
|
|
113
|
+
|
|
114
|
+
Ask Claude:
|
|
115
|
+
> "Search my codebase for how authentication is implemented"
|
|
116
|
+
|
|
117
|
+
Claude will use `search_context` to find relevant code.
|
|
118
|
+
|
|
119
|
+
### Get Specific Item
|
|
120
|
+
|
|
121
|
+
Ask Claude:
|
|
122
|
+
> "Get the item with ID abc123"
|
|
123
|
+
|
|
124
|
+
### Add Knowledge
|
|
125
|
+
|
|
126
|
+
Ask Claude:
|
|
127
|
+
> "Add to my knowledge base: The authentication system uses JWT tokens with a 1-hour expiration"
|
|
128
|
+
|
|
129
|
+
### Run Analysis
|
|
130
|
+
|
|
131
|
+
Ask Claude:
|
|
132
|
+
> "Run an intelligent analysis of my codebase"
|
|
133
|
+
|
|
134
|
+
## Troubleshooting
|
|
135
|
+
|
|
136
|
+
### MCP Server Not Appearing
|
|
137
|
+
|
|
138
|
+
1. **Check config path:** Ensure you're editing the correct config file
|
|
139
|
+
2. **Restart Claude:** Completely quit and restart Claude Desktop
|
|
140
|
+
3. **Check project path:** Verify `cwd` points to a valid project with `.k0ntext.db`
|
|
141
|
+
4. **Check logs:** Look for MCP errors in Claude's developer console
|
|
142
|
+
|
|
143
|
+
### Database Not Found
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
Error: Database file not found: .k0ntext.db
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Solution:** Run `k0ntext init` in your project directory first.
|
|
150
|
+
|
|
151
|
+
### OpenRouter API Key Missing
|
|
152
|
+
|
|
153
|
+
If using intelligent analysis:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
Error: OPENROUTER_API_KEY not set
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Solution:** Set your API key:
|
|
160
|
+
```bash
|
|
161
|
+
export OPENROUTER_API_KEY="your-key-here"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Or add to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.).
|
|
165
|
+
|
|
166
|
+
### Port Already in Use
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
Error: Port 3000 already in use
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Solution:** The MCP server uses stdio (not HTTP), so this shouldn't occur. If it does, ensure no other MCP servers are configured with the same name.
|
|
173
|
+
|
|
174
|
+
## Advanced Configuration
|
|
175
|
+
|
|
176
|
+
### Custom Server Port (Future)
|
|
177
|
+
|
|
178
|
+
The current MCP server uses stdio transport. HTTP/SSE transport may be added in the future.
|
|
179
|
+
|
|
180
|
+
### Environment Variables
|
|
181
|
+
|
|
182
|
+
Available environment variables for the MCP server:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Database location
|
|
186
|
+
export K0NTEXT_DB_PATH="/custom/path/.k0ntext.db"
|
|
187
|
+
|
|
188
|
+
# OpenRouter API key (for intelligent analysis)
|
|
189
|
+
export OPENROUTER_API_KEY="your-key-here"
|
|
190
|
+
|
|
191
|
+
# Log level
|
|
192
|
+
export K0NTEXT_LOG_LEVEL="debug" # debug, info, warn, error
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## MCP Prompts
|
|
196
|
+
|
|
197
|
+
K0ntext also provides **6 prompts** for Claude:
|
|
198
|
+
|
|
199
|
+
| Prompt | Description |
|
|
200
|
+
|--------|-------------|
|
|
201
|
+
| `analyze-codebase` | Analyze the entire codebase |
|
|
202
|
+
| `find-similar-code` | Find code similar to a pattern |
|
|
203
|
+
| `explain-architecture` | Explain system architecture |
|
|
204
|
+
| `review-changes` | Review recent code changes |
|
|
205
|
+
| `suggest-improvements` | Suggest code improvements |
|
|
206
|
+
| `check-drift` | Check documentation drift |
|
|
207
|
+
|
|
208
|
+
These prompts can be invoked directly from Claude Desktop.
|
|
209
|
+
|
|
210
|
+
## Next Steps
|
|
211
|
+
|
|
212
|
+
- **Full Documentation:** https://github.com/SireJeff/k0ntext
|
|
213
|
+
- **Troubleshooting:** [Troubleshooting Guide](TROUBLESHOOTING.md)
|
|
214
|
+
- **MCP Specification:** https://modelcontextprotocol.io
|
|
215
|
+
|
|
216
|
+
## Support
|
|
217
|
+
|
|
218
|
+
- **Issues:** https://github.com/SireJeff/k0ntext/issues
|
|
219
|
+
- **Discussions:** https://github.com/SireJeff/k0ntext/discussions
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# K0ntext - Quick Start Guide
|
|
2
|
+
|
|
3
|
+
Get up and running with K0ntext in 5 minutes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g k0ntext
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Requirements:** Node.js 18 or higher
|
|
12
|
+
|
|
13
|
+
## Initialize Your Project
|
|
14
|
+
|
|
15
|
+
Navigate to your project directory and run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd your-project
|
|
19
|
+
k0ntext init
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will:
|
|
23
|
+
1. Analyze your codebase (intelligent analysis powered by OpenRouter)
|
|
24
|
+
2. Create a SQLite database at `.k0ntext.db`
|
|
25
|
+
3. Index your source code with semantic embeddings
|
|
26
|
+
4. Generate optimized context files for your AI tools
|
|
27
|
+
|
|
28
|
+
### Skip Intelligent Analysis (Optional)
|
|
29
|
+
|
|
30
|
+
If you want to skip the OpenRouter-powered intelligent analysis:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
k0ntext init --no-intelligent
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This will use a faster static analysis instead.
|
|
37
|
+
|
|
38
|
+
## Generate Context Files
|
|
39
|
+
|
|
40
|
+
To regenerate context files for all AI tools:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
k0ntext generate
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Start MCP Server
|
|
47
|
+
|
|
48
|
+
The MCP (Model Context Protocol) server provides AI assistants with tools to query your codebase:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
k0ntext mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See [MCP Quick Start](MCP_QUICKSTART.md) for setup instructions.
|
|
55
|
+
|
|
56
|
+
## Other Commands
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
k0ntext index # Index codebase into database
|
|
60
|
+
k0ntext search <query> # Semantic search across code
|
|
61
|
+
k0ntext sync # Sync context across AI tools
|
|
62
|
+
k0ntext stats # Database statistics
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## What Gets Created
|
|
66
|
+
|
|
67
|
+
After initialization, you'll find:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
your-project/
|
|
71
|
+
├── .k0ntext.db # SQLite database (embeddings + metadata)
|
|
72
|
+
├── .k0ntext/ # Generated contexts
|
|
73
|
+
│ ├── AI_CONTEXT.md # For Claude/Cursor/etc
|
|
74
|
+
│ └── sync-state.json # Cross-tool sync state
|
|
75
|
+
├── .github/copilot-instructions.md # For GitHub Copilot
|
|
76
|
+
├── .clinerules # For Cline
|
|
77
|
+
├── .cursorrules # For Cursor
|
|
78
|
+
└── ...more tool configs
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Next Steps
|
|
82
|
+
|
|
83
|
+
1. **Configure Claude Desktop with MCP** → [MCP Quick Start](MCP_QUICKSTART.md)
|
|
84
|
+
2. **Learn about cross-tool sync** → [Migration Guide](MIGRATE_TO_UNIFIED.md)
|
|
85
|
+
3. **Troubleshoot issues** → [Troubleshooting](TROUBLESHOOTING.md)
|
|
86
|
+
|
|
87
|
+
## How It Works
|
|
88
|
+
|
|
89
|
+
K0ntext uses a three-phase process:
|
|
90
|
+
|
|
91
|
+
1. **Analysis Phase** (optional):
|
|
92
|
+
- OpenRouter API analyzes your entire codebase
|
|
93
|
+
- Identifies patterns, tech stack, and architecture
|
|
94
|
+
- Provides AI-powered insights for better context
|
|
95
|
+
|
|
96
|
+
2. **Indexing Phase**:
|
|
97
|
+
- Files are scanned and change-detected (SHA256)
|
|
98
|
+
- Content is embedded with OpenRouter embeddings
|
|
99
|
+
- Stored in SQLite with sqlite-vec for vector search
|
|
100
|
+
|
|
101
|
+
3. **Generation Phase**:
|
|
102
|
+
- Context files are generated for 9+ AI tools
|
|
103
|
+
- Cross-tool sync state is tracked
|
|
104
|
+
- Optimized prompts are created for each tool
|
|
105
|
+
|
|
106
|
+
## Environment Variables
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Optional: For intelligent analysis
|
|
110
|
+
export OPENROUTER_API_KEY="your-key-here"
|
|
111
|
+
|
|
112
|
+
# Optional: Specify which AI tools to generate for
|
|
113
|
+
export AI_CONTEXT_TOOLS="claude,copilot,cline"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Support
|
|
117
|
+
|
|
118
|
+
- **Issues:** https://github.com/SireJeff/k0ntext/issues
|
|
119
|
+
- **Docs:** https://github.com/SireJeff/k0ntext
|