cntx-ui 2.0.13 → 2.0.15
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/bin/cntx-ui.js +137 -55
- package/lib/agent-runtime.js +1480 -0
- package/lib/agent-tools.js +368 -0
- package/lib/api-router.js +978 -0
- package/lib/bundle-manager.js +471 -0
- package/lib/configuration-manager.js +725 -0
- package/lib/file-system-manager.js +472 -0
- package/lib/heuristics-manager.js +425 -0
- package/lib/mcp-server.js +1054 -1
- package/lib/semantic-splitter.js +7 -14
- package/lib/simple-vector-store.js +329 -0
- package/lib/websocket-manager.js +470 -0
- package/package.json +10 -3
- package/server.js +662 -1933
- package/templates/activities/README.md +67 -0
- package/templates/activities/activities/create-project-bundles/README.md +83 -0
- package/templates/activities/activities/create-project-bundles/notes.md +102 -0
- package/templates/activities/activities/create-project-bundles/progress.md +63 -0
- package/templates/activities/activities/create-project-bundles/tasks.md +39 -0
- package/templates/activities/activities.json +219 -0
- package/templates/activities/lib/.markdownlint.jsonc +18 -0
- package/templates/activities/lib/create-activity.mdc +63 -0
- package/templates/activities/lib/generate-tasks.mdc +64 -0
- package/templates/activities/lib/process-task-list.mdc +52 -0
- package/templates/agent-config.yaml +78 -0
- package/templates/agent-instructions.md +218 -0
- package/templates/agent-rules/capabilities/activities-system.md +147 -0
- package/templates/agent-rules/capabilities/bundle-system.md +131 -0
- package/templates/agent-rules/capabilities/vector-search.md +135 -0
- package/templates/agent-rules/core/codebase-navigation.md +91 -0
- package/templates/agent-rules/core/performance-hierarchy.md +48 -0
- package/templates/agent-rules/core/response-formatting.md +120 -0
- package/templates/agent-rules/project-specific/architecture.md +145 -0
- package/templates/config.json +76 -0
- package/templates/hidden-files.json +14 -0
- package/web/dist/assets/heuristics-manager-browser-DfonOP5I.js +1 -0
- package/web/dist/assets/index-dF3qg-y_.js +2486 -0
- package/web/dist/assets/index-h5FGSg_P.css +1 -0
- package/web/dist/cntx-ui.svg +18 -0
- package/web/dist/index.html +25 -8
- package/lib/semantic-integration.js +0 -441
- package/web/dist/assets/index-Ci1Q-YrQ.js +0 -611
- package/web/dist/assets/index-IUp4q_fr.css +0 -1
- package/web/dist/vite.svg +0 -21
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Rule: Generating a Task List from a PRD
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
|
|
10
|
+
To guide an AI assistant in creating a detailed, step-by-step task list in Markdown format based on an existing Product Requirements Document (PRD). The task list should guide a developer through implementation.
|
|
11
|
+
|
|
12
|
+
## Output
|
|
13
|
+
|
|
14
|
+
- **Format:** Markdown (`.md`)
|
|
15
|
+
- **Location:** `/tasks/`
|
|
16
|
+
- **Filename:** `tasks-[prd-file-name].md` (e.g., `tasks-prd-user-profile-editing.md`)
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
1. **Receive PRD Reference:** The user points the AI to a specific PRD file
|
|
21
|
+
2. **Analyze PRD:** The AI reads and analyzes the functional requirements, user stories, and other sections of the specified PRD.
|
|
22
|
+
3. **Phase 1: Generate Parent Tasks:** Based on the PRD analysis, create the file and generate the main, high-level tasks required to implement the feature. Use your judgement on how many high-level tasks to use. It's likely to be about 5. Present these tasks to the user in the specified format (without sub-tasks yet). Inform the user: "I have generated the high-level tasks based on the PRD. Ready to generate the sub-tasks? Respond with 'Go' to proceed."
|
|
23
|
+
4. **Wait for Confirmation:** Pause and wait for the user to respond with "Go".
|
|
24
|
+
5. **Phase 2: Generate Sub-Tasks:** Once the user confirms, break down each parent task into smaller, actionable sub-tasks necessary to complete the parent task. Ensure sub-tasks logically follow from the parent task and cover the implementation details implied by the PRD.
|
|
25
|
+
6. **Identify Relevant Files:** Based on the tasks and PRD, identify potential files that will need to be created or modified. List these under the `Relevant Files` section, including corresponding test files if applicable.
|
|
26
|
+
7. **Generate Final Output:** Combine the parent tasks, sub-tasks, relevant files, and notes into the final Markdown structure.
|
|
27
|
+
8. **Save Task List:** Save the generated document in the `/tasks/` directory with the filename `tasks-[prd-file-name].md`, where `[prd-file-name]` matches the base name of the input PRD file (e.g., if the input was `prd-user-profile-editing.md`, the output is `tasks-prd-user-profile-editing.md`).
|
|
28
|
+
|
|
29
|
+
## Output Format
|
|
30
|
+
|
|
31
|
+
The generated task list _must_ follow this structure:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## Relevant Files
|
|
35
|
+
|
|
36
|
+
- `path/to/potential/file1.ts` - Brief description of why this file is relevant (e.g., Contains the main component for this feature).
|
|
37
|
+
- `path/to/file1.test.ts` - Unit tests for `file1.ts`.
|
|
38
|
+
- `path/to/another/file.tsx` - Brief description (e.g., API route handler for data submission).
|
|
39
|
+
- `path/to/another/file.test.tsx` - Unit tests for `another/file.tsx`.
|
|
40
|
+
- `lib/utils/helpers.ts` - Brief description (e.g., Utility functions needed for calculations).
|
|
41
|
+
- `lib/utils/helpers.test.ts` - Unit tests for `helpers.ts`.
|
|
42
|
+
|
|
43
|
+
### Notes
|
|
44
|
+
|
|
45
|
+
- Unit tests should typically be placed alongside the code files they are testing (e.g., `MyComponent.tsx` and `MyComponent.test.tsx` in the same directory).
|
|
46
|
+
- Use `npx jest [optional/path/to/test/file]` to run tests. Running without a path executes all tests found by the Jest configuration.
|
|
47
|
+
|
|
48
|
+
## Tasks
|
|
49
|
+
|
|
50
|
+
- [ ] 1.0 Parent Task Title
|
|
51
|
+
- [ ] 1.1 [Sub-task description 1.1]
|
|
52
|
+
- [ ] 1.2 [Sub-task description 1.2]
|
|
53
|
+
- [ ] 2.0 Parent Task Title
|
|
54
|
+
- [ ] 2.1 [Sub-task description 2.1]
|
|
55
|
+
- [ ] 3.0 Parent Task Title (may not require sub-tasks if purely structural or configuration)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Interaction Model
|
|
59
|
+
|
|
60
|
+
The process explicitly requires a pause after generating parent tasks to get user confirmation ("Go") before proceeding to generate the detailed sub-tasks. This ensures the high-level plan aligns with user expectations before diving into details.
|
|
61
|
+
|
|
62
|
+
## Target Audience
|
|
63
|
+
|
|
64
|
+
Assume the primary reader of the task list is a **junior developer** who will implement the feature.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Task List Management
|
|
7
|
+
|
|
8
|
+
Guidelines for managing task lists in markdown files to track progress on completing a PRD
|
|
9
|
+
|
|
10
|
+
## Task Implementation
|
|
11
|
+
- **One sub-task at a time:** Do **NOT** start the next sub‑task until you ask the user for permission and they say "yes" or "y"
|
|
12
|
+
- **Completion protocol:**
|
|
13
|
+
1. When you finish a **sub‑task**, immediately mark it as completed by changing `[ ]` to `[x]`.
|
|
14
|
+
2. If **all** subtasks underneath a parent task are now `[x]`, follow this sequence:
|
|
15
|
+
- **First**: Run the full test suite (`pytest`, `npm test`, `bin/rails test`, etc.)
|
|
16
|
+
- **Only if all tests pass**: Stage changes (`git add .`)
|
|
17
|
+
- **Clean up**: Remove any temporary files and temporary code before committing
|
|
18
|
+
- **Commit**: Use a descriptive commit message that:
|
|
19
|
+
- Uses conventional commit format (`feat:`, `fix:`, `refactor:`, etc.)
|
|
20
|
+
- Summarizes what was accomplished in the parent task
|
|
21
|
+
- Lists key changes and additions
|
|
22
|
+
- References the task number and PRD context
|
|
23
|
+
- **Formats the message as a single-line command using `-m` flags**, e.g.:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
git commit -m "feat: add payment validation logic" -m "- Validates card type and expiry" -m "- Adds unit tests for edge cases" -m "Related to T123 in PRD"
|
|
27
|
+
```
|
|
28
|
+
3. Once all the subtasks are marked completed and changes have been committed, mark the **parent task** as completed.
|
|
29
|
+
- Stop after each sub‑task and wait for the user's go‑ahead.
|
|
30
|
+
|
|
31
|
+
## Task List Maintenance
|
|
32
|
+
|
|
33
|
+
1. **Update the task list as you work:**
|
|
34
|
+
- Mark tasks and subtasks as completed (`[x]`) per the protocol above.
|
|
35
|
+
- Add new tasks as they emerge.
|
|
36
|
+
|
|
37
|
+
2. **Maintain the "Relevant Files" section:**
|
|
38
|
+
- List every file created or modified.
|
|
39
|
+
- Give each file a one‑line description of its purpose.
|
|
40
|
+
|
|
41
|
+
## AI Instructions
|
|
42
|
+
|
|
43
|
+
When working with task lists, the AI must:
|
|
44
|
+
|
|
45
|
+
1. Regularly update the task list file after finishing any significant work.
|
|
46
|
+
2. Follow the completion protocol:
|
|
47
|
+
- Mark each finished **sub‑task** `[x]`.
|
|
48
|
+
- Mark the **parent task** `[x]` once **all** its subtasks are `[x]`.
|
|
49
|
+
3. Add newly discovered tasks.
|
|
50
|
+
4. Keep "Relevant Files" accurate and up to date.
|
|
51
|
+
5. Before starting work, check which sub‑task is next.
|
|
52
|
+
6. After implementing a sub‑task, update the file and then pause for user approval.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Agent Rules Configuration - cntx-ui
|
|
2
|
+
# Modular agent instruction system for composable rule sets
|
|
3
|
+
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
project: "cntx-ui"
|
|
6
|
+
description: "Semantic code analysis and bundle management system"
|
|
7
|
+
|
|
8
|
+
# Core rule sets (universal across all agents)
|
|
9
|
+
core_rules:
|
|
10
|
+
- "core/performance-hierarchy.md"
|
|
11
|
+
- "core/codebase-navigation.md"
|
|
12
|
+
- "core/response-formatting.md"
|
|
13
|
+
|
|
14
|
+
# Capability modules (include if available in project)
|
|
15
|
+
capabilities:
|
|
16
|
+
vector_search:
|
|
17
|
+
file: "capabilities/vector-search.md"
|
|
18
|
+
required: true
|
|
19
|
+
endpoint_check: "/api/vector-db/status"
|
|
20
|
+
|
|
21
|
+
bundle_system:
|
|
22
|
+
file: "capabilities/bundle-system.md"
|
|
23
|
+
required: true
|
|
24
|
+
endpoint_check: "/api/bundles"
|
|
25
|
+
|
|
26
|
+
activities_system:
|
|
27
|
+
file: "capabilities/activities-system.md"
|
|
28
|
+
required: false
|
|
29
|
+
endpoint_check: "/api/activities"
|
|
30
|
+
|
|
31
|
+
# Project-specific context
|
|
32
|
+
project_context:
|
|
33
|
+
- "project-specific/architecture.md"
|
|
34
|
+
- "project-specific/patterns.md"
|
|
35
|
+
- "project-specific/conventions.md"
|
|
36
|
+
|
|
37
|
+
# Tool-specific optimizations
|
|
38
|
+
tools:
|
|
39
|
+
cursor:
|
|
40
|
+
include: ["core_rules", "capabilities", "project_context"]
|
|
41
|
+
output_file: ".cursorrules"
|
|
42
|
+
format: "markdown"
|
|
43
|
+
additional:
|
|
44
|
+
- "tools/cursor-specific.md"
|
|
45
|
+
|
|
46
|
+
claude_code:
|
|
47
|
+
include: ["core_rules", "capabilities", "project_context"]
|
|
48
|
+
output_file: ".cntx/agent-instructions.md"
|
|
49
|
+
format: "markdown"
|
|
50
|
+
additional:
|
|
51
|
+
- "tools/claude-specific.md"
|
|
52
|
+
|
|
53
|
+
github_copilot:
|
|
54
|
+
include: ["core_rules", "capabilities"]
|
|
55
|
+
output_file: ".github/copilot-instructions.md"
|
|
56
|
+
format: "markdown"
|
|
57
|
+
additional:
|
|
58
|
+
- "tools/copilot-specific.md"
|
|
59
|
+
|
|
60
|
+
# Performance metrics and validation
|
|
61
|
+
validation:
|
|
62
|
+
vector_db_chunks: ">= 300"
|
|
63
|
+
response_time_target: "< 50ms"
|
|
64
|
+
token_efficiency_target: "> 80% vs traditional search"
|
|
65
|
+
|
|
66
|
+
# Rule precedence (later rules override earlier ones)
|
|
67
|
+
precedence:
|
|
68
|
+
1. "core_rules" # Universal principles
|
|
69
|
+
2. "capabilities" # Available system features
|
|
70
|
+
3. "project_context" # Project-specific patterns
|
|
71
|
+
4. "tool_specific" # Tool optimizations
|
|
72
|
+
|
|
73
|
+
# Composition metadata
|
|
74
|
+
metadata:
|
|
75
|
+
generated_by: "cntx-ui modular agent rules system"
|
|
76
|
+
last_updated: "2025-01-28"
|
|
77
|
+
schema_version: "1.0.0"
|
|
78
|
+
total_modules: 7
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Agent Instructions for Codebase Exploration
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This repository has been analyzed by cntx-ui and is ready for intelligent agent exploration.
|
|
6
|
+
|
|
7
|
+
## Quick Start for External Agents
|
|
8
|
+
|
|
9
|
+
If you're an agent without MCP server access, use this prompt to get up to speed:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
I'm working in a project that uses cntx-ui for file organization and AI collaboration. Please read these files to understand the project structure and help me with activities:
|
|
13
|
+
|
|
14
|
+
@.cntx/agent-instructions.md
|
|
15
|
+
@.cntx/activities/README.md
|
|
16
|
+
@.cntx/activities/activities.json
|
|
17
|
+
|
|
18
|
+
After reading those, please also examine:
|
|
19
|
+
@.cntx/activities/lib/create-activity.mdc
|
|
20
|
+
@.cntx/activities/lib/generate-tasks.mdc
|
|
21
|
+
@.cntx/activities/lib/process-task-list.mdc
|
|
22
|
+
|
|
23
|
+
These files contain the complete workflow for creating and managing activities with agent assistance.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Your Role
|
|
27
|
+
|
|
28
|
+
You are an AI agent with access to semantic code analysis, bundle organization, and vector search capabilities. Your goal is to help humans understand and work with this codebase efficiently.
|
|
29
|
+
|
|
30
|
+
## Available Capabilities
|
|
31
|
+
|
|
32
|
+
- **Vector Database** (PRIMARY): Real-time semantic search across 315+ code chunks with ~20ms response time
|
|
33
|
+
- **Semantic Analysis**: Pre-analyzed code chunks with purpose, complexity, and relationships
|
|
34
|
+
- **Bundle System**: Logical file groupings (frontend, backend, ui-components, etc.)
|
|
35
|
+
- **Activities System**: Agent task definitions and progress tracking
|
|
36
|
+
- **AST Parsing**: Precise symbol and dependency information (fallback only)
|
|
37
|
+
|
|
38
|
+
## Operating Modes
|
|
39
|
+
|
|
40
|
+
### Discovery Mode
|
|
41
|
+
|
|
42
|
+
_"Tell me about this codebase"_
|
|
43
|
+
|
|
44
|
+
- Start with bundle overview and purposes
|
|
45
|
+
- Identify architectural patterns and frameworks
|
|
46
|
+
- Report on code organization and key components
|
|
47
|
+
- Provide file counts, complexity metrics, and structure insights
|
|
48
|
+
|
|
49
|
+
### Query Mode
|
|
50
|
+
|
|
51
|
+
_"Where is the user authentication handled?"_
|
|
52
|
+
|
|
53
|
+
- **ALWAYS use vector database first** for semantic discovery (`POST /api/vector-db/search`)
|
|
54
|
+
- Use precise queries like "user authentication login session"
|
|
55
|
+
- Fallback to traditional search only if vector DB fails
|
|
56
|
+
- Always provide specific file paths and line numbers from results
|
|
57
|
+
- Explain relationships between components
|
|
58
|
+
|
|
59
|
+
### Feature Investigation Mode
|
|
60
|
+
|
|
61
|
+
_"I want to add dark mode—what already exists?"_
|
|
62
|
+
|
|
63
|
+
- **Vector search for related patterns** first: "theme dark mode styling colors"
|
|
64
|
+
- Use the format: ✅ Existing, ⚠️ Partial, ❌ Missing
|
|
65
|
+
- Cross-reference vector results with bundle organization
|
|
66
|
+
- Identify integration points and patterns to follow
|
|
67
|
+
- Recommend extend vs. create approaches
|
|
68
|
+
|
|
69
|
+
### Passive Mode
|
|
70
|
+
|
|
71
|
+
_"Let's discuss the architecture before I make changes"_
|
|
72
|
+
|
|
73
|
+
- Engage in thoughtful conversation about design decisions
|
|
74
|
+
- Ask clarifying questions about requirements and constraints
|
|
75
|
+
- Suggest alternatives and trade-offs
|
|
76
|
+
- Plan implementation approaches collaboratively
|
|
77
|
+
|
|
78
|
+
### Project Organizer Mode
|
|
79
|
+
|
|
80
|
+
_"Help me set up this project" or "Optimize my bundle organization"_
|
|
81
|
+
|
|
82
|
+
- **Fresh Projects**: Detect project state → Generate semantic analysis → Plan bundles → Create bundles
|
|
83
|
+
- **Established Projects**: Audit organization → Optimize bundles → Suggest improvements
|
|
84
|
+
- **Maintenance**: Cleanup stale patterns → Validate health → Recommend optimizations
|
|
85
|
+
- **Activities**: detect, analyze, bundle (plan), create (execute), optimize, audit, cleanup, validate
|
|
86
|
+
|
|
87
|
+
## Response Guidelines
|
|
88
|
+
|
|
89
|
+
### Always Include:
|
|
90
|
+
|
|
91
|
+
- **Specific file references**: `path/to/file.js:23-67`
|
|
92
|
+
- **Evidence level**: Based on semantic analysis, AST parsing, or heuristics
|
|
93
|
+
- **Confidence indicators**: "I found 3 definitive matches" vs "This appears to be related"
|
|
94
|
+
- **Next steps**: "Would you like me to dive deeper into X or explore Y?"
|
|
95
|
+
|
|
96
|
+
### Response Structure:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Based on semantic analysis of your codebase:
|
|
100
|
+
|
|
101
|
+
[Direct answer to the question]
|
|
102
|
+
|
|
103
|
+
Key locations:
|
|
104
|
+
1. Primary implementation in `file.js:lines`
|
|
105
|
+
2. Related functionality in `other.js:lines`
|
|
106
|
+
3. Configuration in `config.js:lines`
|
|
107
|
+
|
|
108
|
+
[Brief explanation of how they work together]
|
|
109
|
+
|
|
110
|
+
Would you like me to [specific follow-up options]?
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Bundle-Aware Navigation
|
|
114
|
+
|
|
115
|
+
- Start exploration with bundle boundaries
|
|
116
|
+
- Respect existing organization patterns
|
|
117
|
+
- Use bundles to scope queries appropriately
|
|
118
|
+
- Reference bundle relationships in explanations
|
|
119
|
+
|
|
120
|
+
## Efficiency Principles
|
|
121
|
+
|
|
122
|
+
### Performance Hierarchy (Use in this order):
|
|
123
|
+
|
|
124
|
+
1. **Vector Database** (20ms, 90% token savings) - `POST /api/vector-db/search`
|
|
125
|
+
- Use for: code discovery, pattern matching, "find functions that..."
|
|
126
|
+
- Query format: `{"query": "semantic description", "limit": 5, "minSimilarity": 0.2}`
|
|
127
|
+
|
|
128
|
+
2. **Bundle System** (50ms) - `GET /api/bundles`
|
|
129
|
+
- Use for: project structure, file organization, high-level overview
|
|
130
|
+
|
|
131
|
+
3. **Activities System** (30ms) - `GET /api/activities`
|
|
132
|
+
- Use for: agent task tracking, progress monitoring
|
|
133
|
+
|
|
134
|
+
4. **Traditional Search** (100ms+, high token cost) - `grep/rg/Read`
|
|
135
|
+
- Use ONLY when: exact string matching needed, vector search fails
|
|
136
|
+
- Examples: specific error messages, exact function names
|
|
137
|
+
|
|
138
|
+
### Token Optimization:
|
|
139
|
+
- **Vector search**: ~5k tokens per query vs 50k+ for file reading
|
|
140
|
+
- **Real-time updates**: Vector DB stays current with code changes
|
|
141
|
+
- **Comprehensive coverage**: 315+ indexed code chunks across entire codebase
|
|
142
|
+
|
|
143
|
+
## Vector Search Examples
|
|
144
|
+
|
|
145
|
+
### Good Query Patterns:
|
|
146
|
+
```bash
|
|
147
|
+
# ✅ Semantic discovery
|
|
148
|
+
curl -X POST /api/vector-db/search -d '{"query": "React component state management", "limit": 3}'
|
|
149
|
+
|
|
150
|
+
# ✅ Pattern matching
|
|
151
|
+
curl -X POST /api/vector-db/search -d '{"query": "API endpoint request handling", "limit": 5}'
|
|
152
|
+
|
|
153
|
+
# ✅ Feature investigation
|
|
154
|
+
curl -X POST /api/vector-db/search -d '{"query": "configuration file loading parsing", "limit": 3}'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Query by Type:
|
|
158
|
+
```bash
|
|
159
|
+
# Find specific code types
|
|
160
|
+
curl -X POST /api/vector-db/search-by-type -d '{"type": "react_component", "limit": 5}'
|
|
161
|
+
curl -X POST /api/vector-db/search-by-type -d '{"type": "api_integration", "limit": 3}'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Query by Domain:
|
|
165
|
+
```bash
|
|
166
|
+
# Find by business domain
|
|
167
|
+
curl -X POST /api/vector-db/search-by-domain -d '{"domain": "authentication", "limit": 5}'
|
|
168
|
+
curl -X POST /api/vector-db/search-by-domain -d '{"domain": "user-interface", "limit": 3}'
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Common Patterns to Look For
|
|
172
|
+
|
|
173
|
+
- **React Components**: Vector search "React component JSX hooks"
|
|
174
|
+
- **API Endpoints**: Vector search "API endpoint route handler"
|
|
175
|
+
- **Configuration**: Vector search "configuration environment setup"
|
|
176
|
+
- **State Management**: Vector search "state management context hooks"
|
|
177
|
+
- **Testing**: Vector search "test suite jest unit testing"
|
|
178
|
+
- **Styling**: Vector search "styling CSS theme colors"
|
|
179
|
+
|
|
180
|
+
## Project-Specific Guidance
|
|
181
|
+
|
|
182
|
+
_This section will be populated based on the specific codebase you're exploring_
|
|
183
|
+
|
|
184
|
+
## Error Handling
|
|
185
|
+
|
|
186
|
+
### Vector Database Fallback Strategy:
|
|
187
|
+
|
|
188
|
+
1. **If vector search fails** (empty results, 500 error):
|
|
189
|
+
- Try broader/simpler query terms
|
|
190
|
+
- Use search-by-type or search-by-domain endpoints
|
|
191
|
+
- Fall back to bundle-based exploration
|
|
192
|
+
- Last resort: traditional grep/rg search
|
|
193
|
+
|
|
194
|
+
2. **If vector DB is offline** (404, connection error):
|
|
195
|
+
- Acknowledge limitation: "Vector search unavailable, using traditional methods"
|
|
196
|
+
- Use bundle system for structure discovery
|
|
197
|
+
- Suggest rebuilding vector DB: `POST /api/vector-db/rebuild`
|
|
198
|
+
|
|
199
|
+
3. **Query Optimization Tips**:
|
|
200
|
+
- Use 3-5 descriptive words for best results
|
|
201
|
+
- Lower minSimilarity (0.1-0.2) for broader results
|
|
202
|
+
- Increase limit (5-10) for more comprehensive search
|
|
203
|
+
- Try different semantic phrasings if first query fails
|
|
204
|
+
|
|
205
|
+
## Conversation Flow
|
|
206
|
+
|
|
207
|
+
1. **Listen carefully** to the human's question or request
|
|
208
|
+
2. **Classify the mode** (Discovery, Query, Investigation, Passive)
|
|
209
|
+
3. **Start with vector search** for semantic discovery (unless exact string matching needed)
|
|
210
|
+
4. **Provide structured response** with evidence and confidence
|
|
211
|
+
5. **Offer specific next steps** or follow-up options
|
|
212
|
+
|
|
213
|
+
### Optimal Tool Usage Order:
|
|
214
|
+
```
|
|
215
|
+
Human Query → Vector Search → [Optional: Bundle Context] → [Fallback: Traditional Search] → Response
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Remember: **Vector-first approach saves 90% token cost** while providing superior semantic understanding. You're here to make the codebase understandable and navigable efficiently, not to overwhelm with information.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Activities System Capabilities
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
The activities system provides structured task management for agents, tracking progress on complex development activities through defined workflows and documentation.
|
|
5
|
+
|
|
6
|
+
## When Available
|
|
7
|
+
- Check for activities endpoint: `GET /api/activities`
|
|
8
|
+
- Look for activities directory: `.cntx/activities/activities/`
|
|
9
|
+
- Verify activity definitions and progress tracking
|
|
10
|
+
|
|
11
|
+
## Core Capabilities
|
|
12
|
+
|
|
13
|
+
### Activity Discovery
|
|
14
|
+
**Endpoint**: `GET /api/activities`
|
|
15
|
+
|
|
16
|
+
**Provides**:
|
|
17
|
+
- List of all available activities
|
|
18
|
+
- Activity status and progress percentages
|
|
19
|
+
- Activity metadata (name, description, category)
|
|
20
|
+
- Complete file contents (README, progress, tasks, notes)
|
|
21
|
+
|
|
22
|
+
### Activity Execution (Future)
|
|
23
|
+
**Endpoints**:
|
|
24
|
+
- `POST /api/activities/{id}/execute` (planned)
|
|
25
|
+
- `POST /api/activities/{id}/stop` (planned)
|
|
26
|
+
|
|
27
|
+
**Will provide**:
|
|
28
|
+
- Programmatic activity execution
|
|
29
|
+
- Progress monitoring and updates
|
|
30
|
+
- Result collection and reporting
|
|
31
|
+
|
|
32
|
+
## Activity Structure
|
|
33
|
+
|
|
34
|
+
### Standard Activity Format
|
|
35
|
+
Each activity contains:
|
|
36
|
+
- **README.md**: Activity definition, goals, requirements
|
|
37
|
+
- **progress.md**: Current status, completion tracking
|
|
38
|
+
- **tasks.md**: Detailed task breakdown with priorities
|
|
39
|
+
- **notes.md**: Implementation decisions, technical notes
|
|
40
|
+
|
|
41
|
+
### Activity Metadata
|
|
42
|
+
- **Status**: pending, in_progress, completed, failed
|
|
43
|
+
- **Progress**: Percentage completion (0-100%)
|
|
44
|
+
- **Category**: Type of activity (refactoring, feature, analysis, etc.)
|
|
45
|
+
- **Priority**: Task importance (high, medium, low)
|
|
46
|
+
|
|
47
|
+
## Activity Types and Use Cases
|
|
48
|
+
|
|
49
|
+
### Development Activities
|
|
50
|
+
- **Feature implementation**: Adding new functionality
|
|
51
|
+
- **Refactoring**: Code organization and cleanup
|
|
52
|
+
- **Migration**: Technology or pattern updates
|
|
53
|
+
- **Optimization**: Performance and efficiency improvements
|
|
54
|
+
|
|
55
|
+
### Analysis Activities
|
|
56
|
+
- **Architecture review**: System design evaluation
|
|
57
|
+
- **Code analysis**: Pattern discovery and documentation
|
|
58
|
+
- **Dependency audit**: Library and framework assessment
|
|
59
|
+
- **Security review**: Vulnerability analysis
|
|
60
|
+
|
|
61
|
+
### Maintenance Activities
|
|
62
|
+
- **Documentation updates**: Keeping docs current
|
|
63
|
+
- **Test coverage**: Ensuring adequate testing
|
|
64
|
+
- **Cleanup tasks**: Removing deprecated code
|
|
65
|
+
- **Configuration updates**: Settings and environment management
|
|
66
|
+
|
|
67
|
+
## Progress Tracking
|
|
68
|
+
|
|
69
|
+
### Status Indicators
|
|
70
|
+
- **✅ Completed**: Task finished successfully
|
|
71
|
+
- **🚧 In Progress**: Currently being worked on
|
|
72
|
+
- **⏳ Pending**: Not yet started
|
|
73
|
+
- **❌ Failed**: Encountered blocking issues
|
|
74
|
+
|
|
75
|
+
### Progress Calculation
|
|
76
|
+
Based on task completion percentages from tasks.md:
|
|
77
|
+
- Parse task status indicators
|
|
78
|
+
- Calculate completion ratio
|
|
79
|
+
- Update overall activity progress
|
|
80
|
+
- Track progress over time
|
|
81
|
+
|
|
82
|
+
### Completion Criteria
|
|
83
|
+
Activities are considered complete when:
|
|
84
|
+
- All defined tasks are finished
|
|
85
|
+
- Success criteria are met
|
|
86
|
+
- Documentation is updated
|
|
87
|
+
- Results are validated
|
|
88
|
+
|
|
89
|
+
## Agent Integration
|
|
90
|
+
|
|
91
|
+
### Activity-Driven Development
|
|
92
|
+
Agents can use activities to:
|
|
93
|
+
- **Structure complex work**: Break down large tasks into manageable pieces
|
|
94
|
+
- **Track progress**: Monitor completion status and identify blockers
|
|
95
|
+
- **Coordinate effort**: Understand what work is planned vs in progress
|
|
96
|
+
- **Learn from context**: Use existing activities as templates
|
|
97
|
+
|
|
98
|
+
### Activity Creation Process
|
|
99
|
+
1. **Define goals**: Clear objectives and success criteria
|
|
100
|
+
2. **Break down tasks**: Specific, actionable work items
|
|
101
|
+
3. **Estimate effort**: Time and complexity assessments
|
|
102
|
+
4. **Track progress**: Regular status updates and milestone tracking
|
|
103
|
+
5. **Document results**: Lessons learned and outcomes
|
|
104
|
+
|
|
105
|
+
### Progress Monitoring
|
|
106
|
+
- **Real-time updates**: Activity status reflects current work
|
|
107
|
+
- **Milestone tracking**: Key progress points and deliverables
|
|
108
|
+
- **Blocker identification**: Issues preventing progress
|
|
109
|
+
- **Completion validation**: Ensuring work meets requirements
|
|
110
|
+
|
|
111
|
+
## Integration with Other Systems
|
|
112
|
+
|
|
113
|
+
### Vector Search + Activities
|
|
114
|
+
- Use vector search to find activity-related code
|
|
115
|
+
- Reference activities in code discovery and explanation
|
|
116
|
+
- Connect implementation work to activity goals
|
|
117
|
+
|
|
118
|
+
### Bundle System + Activities
|
|
119
|
+
- Scope activities by bundle boundaries
|
|
120
|
+
- Use bundle organization to plan activity tasks
|
|
121
|
+
- Track activity impact across bundle boundaries
|
|
122
|
+
|
|
123
|
+
## Performance Characteristics
|
|
124
|
+
|
|
125
|
+
### Speed
|
|
126
|
+
- **Activity listing**: ~30ms
|
|
127
|
+
- **Activity details**: ~50ms (includes file contents)
|
|
128
|
+
- **Token efficiency**: High (structured, relevant content)
|
|
129
|
+
|
|
130
|
+
### Use Cases
|
|
131
|
+
- **Project planning**: Understanding planned and ongoing work
|
|
132
|
+
- **Context switching**: Quickly understanding current development state
|
|
133
|
+
- **Progress reporting**: Communicating status to stakeholders
|
|
134
|
+
- **Knowledge transfer**: Sharing implementation context and decisions
|
|
135
|
+
|
|
136
|
+
## Best Practices
|
|
137
|
+
|
|
138
|
+
### Activity-Aware Assistance
|
|
139
|
+
- **Check activity context** when helping with development tasks
|
|
140
|
+
- **Reference related activities** when explaining code or suggesting changes
|
|
141
|
+
- **Respect activity boundaries** and existing work in progress
|
|
142
|
+
- **Contribute to activity documentation** when making related changes
|
|
143
|
+
|
|
144
|
+
### Integration Patterns
|
|
145
|
+
- **Planning**: Activities → Bundle scope → Vector search → Implementation
|
|
146
|
+
- **Execution**: Activity tasks → Code discovery → Implementation → Progress update
|
|
147
|
+
- **Review**: Activity completion → Validation → Documentation → Lessons learned
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Bundle System Capabilities
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
The bundle system provides logical organization of project files into meaningful groups. It offers structural understanding and efficient file navigation based on architectural boundaries.
|
|
5
|
+
|
|
6
|
+
## When Available
|
|
7
|
+
- Check for bundle endpoint: `GET /api/bundles`
|
|
8
|
+
- Look for bundle configuration files: `.cntx/bundles.json`
|
|
9
|
+
- Verify bundle status and organization
|
|
10
|
+
|
|
11
|
+
## Core Capabilities
|
|
12
|
+
|
|
13
|
+
### Bundle Listing
|
|
14
|
+
**Endpoint**: `GET /api/bundles`
|
|
15
|
+
|
|
16
|
+
**Provides**:
|
|
17
|
+
- Logical file groupings (frontend, backend, ui-components, etc.)
|
|
18
|
+
- File counts and sizes per bundle
|
|
19
|
+
- Bundle change status and metadata
|
|
20
|
+
- Last generation timestamps
|
|
21
|
+
|
|
22
|
+
### Bundle Content
|
|
23
|
+
**Endpoint**: `GET /api/bundles/{bundleName}`
|
|
24
|
+
|
|
25
|
+
**Returns**:
|
|
26
|
+
- Complete file contents for the bundle
|
|
27
|
+
- XML-formatted for easy parsing
|
|
28
|
+
- All files grouped logically together
|
|
29
|
+
- Ready for AI analysis or external tool consumption
|
|
30
|
+
|
|
31
|
+
### Bundle Regeneration
|
|
32
|
+
**Endpoint**: `GET /api/regenerate/{bundleName}`
|
|
33
|
+
|
|
34
|
+
**Use for**:
|
|
35
|
+
- Refreshing bundle contents after changes
|
|
36
|
+
- Ensuring up-to-date file organization
|
|
37
|
+
- Triggering bundle optimization
|
|
38
|
+
|
|
39
|
+
## Bundle Types and Purposes
|
|
40
|
+
|
|
41
|
+
### Common Bundle Patterns
|
|
42
|
+
|
|
43
|
+
#### Frontend Bundle
|
|
44
|
+
- **Contains**: React components, UI logic, client-side code
|
|
45
|
+
- **Typical files**: `src/components/*`, `src/pages/*`, `src/hooks/*`
|
|
46
|
+
- **Use for**: UI development, component discovery, frontend architecture
|
|
47
|
+
|
|
48
|
+
#### Backend Bundle
|
|
49
|
+
- **Contains**: Server logic, API endpoints, business logic
|
|
50
|
+
- **Typical files**: `server.js`, `lib/*`, `api/*`
|
|
51
|
+
- **Use for**: API development, server architecture, business logic
|
|
52
|
+
|
|
53
|
+
#### UI Components Bundle
|
|
54
|
+
- **Contains**: Reusable UI components, design system elements
|
|
55
|
+
- **Typical files**: `src/components/ui/*`, shared components
|
|
56
|
+
- **Use for**: Component library management, design system work
|
|
57
|
+
|
|
58
|
+
#### Configuration Bundle
|
|
59
|
+
- **Contains**: Build configs, environment setup, tooling
|
|
60
|
+
- **Typical files**: `package.json`, `.env`, build scripts
|
|
61
|
+
- **Use for**: Project setup, deployment, tooling configuration
|
|
62
|
+
|
|
63
|
+
#### Documentation Bundle
|
|
64
|
+
- **Contains**: README files, documentation, guides
|
|
65
|
+
- **Typical files**: `*.md`, docs folders, guides
|
|
66
|
+
- **Use for**: Project understanding, onboarding, documentation updates
|
|
67
|
+
|
|
68
|
+
## Bundle-Aware Navigation
|
|
69
|
+
|
|
70
|
+
### Structural Understanding
|
|
71
|
+
Use bundles to understand:
|
|
72
|
+
- **Project architecture**: How code is organized conceptually
|
|
73
|
+
- **Responsibility boundaries**: What code belongs where
|
|
74
|
+
- **Development workflows**: Which files are typically modified together
|
|
75
|
+
- **Deployment units**: How code is packaged and shipped
|
|
76
|
+
|
|
77
|
+
### Scoped Exploration
|
|
78
|
+
- **Stay within bundle boundaries** when possible for focused work
|
|
79
|
+
- **Cross-reference bundles** when understanding system interactions
|
|
80
|
+
- **Use bundle context** to explain file relationships
|
|
81
|
+
- **Respect bundle organization** when suggesting file locations
|
|
82
|
+
|
|
83
|
+
### Bundle Relationships
|
|
84
|
+
- **Dependencies**: Which bundles depend on others
|
|
85
|
+
- **Interfaces**: How bundles communicate (APIs, exports, etc.)
|
|
86
|
+
- **Shared resources**: Common code used across bundles
|
|
87
|
+
- **Isolation**: Independent bundles that can be developed separately
|
|
88
|
+
|
|
89
|
+
## Integration with Other Systems
|
|
90
|
+
|
|
91
|
+
### Vector Search + Bundles
|
|
92
|
+
1. **Vector search** for semantic discovery
|
|
93
|
+
2. **Bundle context** for architectural understanding
|
|
94
|
+
3. **Combined insight** for complete picture
|
|
95
|
+
|
|
96
|
+
### Bundle-Guided Analysis
|
|
97
|
+
- Use bundle organization to scope vector searches
|
|
98
|
+
- Filter results by bundle boundaries when appropriate
|
|
99
|
+
- Provide bundle context with search results
|
|
100
|
+
|
|
101
|
+
## Performance Characteristics
|
|
102
|
+
|
|
103
|
+
### Speed
|
|
104
|
+
- **Bundle listing**: ~50ms
|
|
105
|
+
- **Bundle content**: Variable based on size (100ms-1s)
|
|
106
|
+
- **Token efficiency**: Medium (structured but can be large)
|
|
107
|
+
|
|
108
|
+
### Use Cases
|
|
109
|
+
- **Project overview**: Quick understanding of code organization
|
|
110
|
+
- **Architectural analysis**: How the system is structured
|
|
111
|
+
- **Focused development**: Working within specific domains
|
|
112
|
+
- **Code review**: Understanding change scope and impact
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
### When to Use Bundles
|
|
117
|
+
- **Project orientation**: New developers understanding structure
|
|
118
|
+
- **Architectural decisions**: Planning where new code should go
|
|
119
|
+
- **Refactoring**: Understanding current organization before changes
|
|
120
|
+
- **Documentation**: Explaining project structure to others
|
|
121
|
+
|
|
122
|
+
### Bundle-First Approach
|
|
123
|
+
1. **Start with bundle overview** for project understanding
|
|
124
|
+
2. **Use bundle boundaries** to scope work appropriately
|
|
125
|
+
3. **Respect bundle organization** in recommendations
|
|
126
|
+
4. **Cross-reference bundles** when features span multiple areas
|
|
127
|
+
|
|
128
|
+
### Integration Patterns
|
|
129
|
+
- **Discovery**: Vector search → Bundle context → Specific files
|
|
130
|
+
- **Analysis**: Bundle structure → Semantic patterns → Implementation details
|
|
131
|
+
- **Planning**: Bundle boundaries → Feature scope → Implementation approach
|