chore: install openagent opencode
Signed-off-by: Dmytro Stanchiev <git@dmytros.dev>
This commit is contained in:
192
.opencode/context/core/system/context-guide.md
Normal file
192
.opencode/context/core/system/context-guide.md
Normal file
@@ -0,0 +1,192 @@
|
||||
<!-- Context: core/context-guide | Priority: low | Version: 1.0 | Updated: 2026-02-15 -->
|
||||
|
||||
# Context System Guide
|
||||
|
||||
## Quick Reference
|
||||
|
||||
**Golden Rule**: Fetch context when needed, not before (lazy loading)
|
||||
|
||||
**Key Principle**: Use context index for discovery, load specific files as needed
|
||||
|
||||
**Index Location**: `.opencode/context/navigation.md` - Quick map of all contexts
|
||||
|
||||
**Structure**: standards/ (quality + analysis), workflows/ (process + review), system/ (internals)
|
||||
|
||||
**Session Location**: `.tmp/sessions/{timestamp}-{task-slug}/context.md`
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Context files provide guidelines and templates for specific tasks. Use the index system for efficient discovery and lazy loading to keep prompts lean.
|
||||
|
||||
## Context Index System
|
||||
|
||||
**Central Index**: `.opencode/context/navigation.md` - Ultra-compact map of all contexts
|
||||
|
||||
The index provides:
|
||||
- Quick map for common tasks (code, docs, tests, review, delegation)
|
||||
- Triggers/keywords for each context
|
||||
- Dependencies between contexts
|
||||
- Priority levels (critical, high, medium)
|
||||
|
||||
### Available Context Files
|
||||
|
||||
All files are in `.opencode/context/core/` with organized subfolders:
|
||||
|
||||
### Standards (Quality Guidelines + Analysis)
|
||||
- `standards/code-quality.md` - Modular, functional code principles [critical]
|
||||
- `standards/documentation.md` - Documentation standards [critical]
|
||||
- `standards/test-coverage.md` - Testing standards [critical]
|
||||
- `standards/security-patterns.md` - Core patterns (error handling, security) [high]
|
||||
- `standards/code-analysis.md` - Analysis framework [high]
|
||||
|
||||
### Workflows (Process Templates + Review)
|
||||
- `workflows/task-delegation-basics.md` - Delegation template [high]
|
||||
- `workflows/feature-breakdown.md` - Complex task breakdown [high]
|
||||
- `workflows/session-management.md` - Session lifecycle [medium]
|
||||
- `workflows/code-review.md` - Code review guidelines [high]
|
||||
|
||||
## How to Use the Index
|
||||
|
||||
**Step 1: Check Quick Map** (for common tasks)
|
||||
- Code task? → Load `standards/code-quality.md`
|
||||
- Docs task? → Load `standards/documentation.md`
|
||||
- Review task? → Load `workflows/code-review.md`
|
||||
|
||||
**Step 2: Load Index** (for keyword matching)
|
||||
- Load `.opencode/context/navigation.md`
|
||||
- Scan triggers to find relevant contexts
|
||||
- Load specific context files as needed
|
||||
|
||||
**Step 3: Load Dependencies**
|
||||
- Check `deps:` in index
|
||||
- Load dependent contexts for complete guidelines
|
||||
|
||||
**Benefits:**
|
||||
- No prompt bloat (index is only ~120 tokens)
|
||||
- Fetch only what's relevant
|
||||
- Faster for simple tasks
|
||||
- Clear dependency tracking
|
||||
|
||||
## When to Use Each File
|
||||
|
||||
### .opencode/context/core/standards/code-quality.md
|
||||
- Writing new code
|
||||
- Modifying existing code
|
||||
- Following modular/functional patterns
|
||||
- Making architectural decisions
|
||||
|
||||
### .opencode/context/core/standards/documentation.md
|
||||
- Writing README files
|
||||
- Creating API documentation
|
||||
- Adding code comments
|
||||
|
||||
### .opencode/context/core/standards/test-coverage.md
|
||||
- Writing new tests
|
||||
- Running test suites
|
||||
- Debugging test failures
|
||||
|
||||
### .opencode/context/core/standards/security-patterns.md
|
||||
- Error handling
|
||||
- Security patterns
|
||||
- Common code patterns
|
||||
|
||||
### .opencode/context/core/standards/code-analysis.md
|
||||
- Analyzing codebase patterns
|
||||
- Investigating bugs
|
||||
- Evaluating architecture
|
||||
|
||||
### .opencode/context/core/workflows/task-delegation-basics.md
|
||||
- Delegating to general agent
|
||||
- Creating task context
|
||||
- Multi-file coordination
|
||||
|
||||
### .opencode/context/core/workflows/feature-breakdown.md
|
||||
- Tasks with 4+ files
|
||||
- Estimated effort >60 minutes
|
||||
- Complex dependencies
|
||||
|
||||
### .opencode/context/core/workflows/session-management.md
|
||||
- Session lifecycle
|
||||
- Cleanup procedures
|
||||
- Session isolation
|
||||
|
||||
### .opencode/context/core/workflows/code-review.md
|
||||
- Reviewing code
|
||||
- Conducting code audits
|
||||
- Providing PR feedback
|
||||
|
||||
## Temporary Context (Session-Specific)
|
||||
|
||||
When delegating, create focused task context:
|
||||
|
||||
**Location**: `.tmp/sessions/{timestamp}-{task-slug}/context.md`
|
||||
|
||||
**Structure**:
|
||||
```markdown
|
||||
# Task Context: {Task Name}
|
||||
|
||||
Session ID: {id}
|
||||
Created: {timestamp}
|
||||
Status: in_progress
|
||||
|
||||
## Current Request
|
||||
{What user asked for}
|
||||
|
||||
## Requirements
|
||||
- {requirement 1}
|
||||
- {requirement 2}
|
||||
|
||||
## Decisions Made
|
||||
- {decision 1}
|
||||
|
||||
## Files to Modify/Create
|
||||
- {file 1} - {purpose}
|
||||
|
||||
## Static Context Available
|
||||
- .opencode/context/core/standards/code-quality.md
|
||||
- .opencode/context/core/standards/test-coverage.md
|
||||
|
||||
## Constraints/Notes
|
||||
{Important context}
|
||||
|
||||
## Progress
|
||||
- [ ] {task 1}
|
||||
- [ ] {task 2}
|
||||
|
||||
---
|
||||
**Instructions for Subagent:**
|
||||
{Specific instructions}
|
||||
```
|
||||
|
||||
## Session Management
|
||||
|
||||
### Session Structure
|
||||
```
|
||||
.tmp/sessions/{session-id}/
|
||||
├── context.md # Task context
|
||||
├── notes.md # Working notes
|
||||
└── artifacts/ # Generated files
|
||||
```
|
||||
|
||||
### Session ID Format
|
||||
`{timestamp}-{random-4-chars}`
|
||||
Example: `20250119-143022-a4f2`
|
||||
|
||||
### Cleanup
|
||||
- Ask user before deleting session files
|
||||
- Remove after task completion
|
||||
- Keep if user wants to review
|
||||
|
||||
## Best Practices
|
||||
|
||||
✅ Use index for context discovery
|
||||
✅ Load only relevant context files
|
||||
✅ Check dependencies in index
|
||||
✅ Create temp context when delegating
|
||||
✅ Clean up sessions after completion
|
||||
✅ Reference specific sections when possible
|
||||
✅ Keep temp context focused and concise
|
||||
|
||||
**Golden Rule**: Fetch context when needed, not before.
|
||||
85
.opencode/context/core/system/context-paths.md
Normal file
85
.opencode/context/core/system/context-paths.md
Normal file
@@ -0,0 +1,85 @@
|
||||
<!-- Context: core/context-paths | Priority: low | Version: 1.0 | Updated: 2026-02-15 -->
|
||||
|
||||
---
|
||||
id: context-paths
|
||||
name: Context File Path Resolution
|
||||
---
|
||||
|
||||
# Context File Path Resolution
|
||||
|
||||
## Resolution Order
|
||||
|
||||
Context files are resolved in this order (later sources override earlier ones for conflicting keys):
|
||||
|
||||
1. **Global context** (`~/.config/opencode/context/`) — user-wide defaults
|
||||
2. **Local context** (`.opencode/context/` in project root) — project-specific, highest priority
|
||||
|
||||
This mirrors OpenCode's own config merging behavior (see [OpenCode Config Docs](https://opencode.ai/docs/config/)).
|
||||
|
||||
## What Goes Where
|
||||
|
||||
| Content Type | Recommended Location | Why |
|
||||
|---|---|---|
|
||||
| **Project Intelligence** (tech stack, patterns, naming) | Local `.opencode/context/project-intelligence/` | Project-specific, committed to git, shared with team |
|
||||
| **Core Standards** (code-quality, docs, tests) | Wherever OAC was installed | Universal standards, same across projects |
|
||||
| **Personal Defaults** (your preferred patterns) | Global `~/.config/opencode/context/project-intelligence/` | Personal coding style across all projects |
|
||||
|
||||
## How Merging Works
|
||||
|
||||
- If a file exists in **both** local and global, the **local version wins**
|
||||
- If a file exists **only** in global, it's still loaded (acts as a fallback)
|
||||
- If a file exists **only** in local, it's loaded normally
|
||||
|
||||
**Example**: User installs OAC globally (core standards at `~/.config/opencode/context/core/`), then runs `/add-context` in a project (creates `.opencode/context/project-intelligence/` locally). The agent loads both: core standards from global, project intelligence from local.
|
||||
|
||||
## Path Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"paths": {
|
||||
"local": ".opencode/context",
|
||||
"global": "~/.config/opencode/context"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Set `"global": false` to disable global context loading.
|
||||
|
||||
## Environment Variable Override
|
||||
|
||||
The installer supports `OPENCODE_INSTALL_DIR` to override the install location:
|
||||
|
||||
```bash
|
||||
export OPENCODE_INSTALL_DIR=~/custom/path
|
||||
bash install.sh developer
|
||||
```
|
||||
|
||||
OpenCode itself supports `OPENCODE_CONFIG_DIR` for a custom config directory (see [OpenCode docs](https://opencode.ai/docs/config/)). If set, context files in that directory are loaded alongside global and local configs.
|
||||
|
||||
## Migrating Global to Local
|
||||
|
||||
If you installed globally but want project-specific context:
|
||||
|
||||
```bash
|
||||
/context migrate
|
||||
```
|
||||
|
||||
This copies `project-intelligence/` from global (`~/.config/opencode/context/`) to local (`.opencode/context/`), so your project patterns are committed to git and shared with your team. See `/context migrate` for details.
|
||||
|
||||
## Common Scenarios
|
||||
|
||||
### Scenario 1: Everything Local (Development / Repo Maintainer)
|
||||
- OAC installed locally via `bash install.sh developer`
|
||||
- All context in `.opencode/context/`
|
||||
- Committed to git, team shares everything
|
||||
|
||||
### Scenario 2: Global Install + Local Project Intelligence
|
||||
- OAC installed globally via `bash install.sh developer --install-dir ~/.config/opencode`
|
||||
- Core standards at `~/.config/opencode/context/core/`
|
||||
- Run `/add-context` in project → creates `.opencode/context/project-intelligence/` locally
|
||||
- Project intelligence committed to git, core standards come from global
|
||||
|
||||
### Scenario 3: Global Personal Defaults
|
||||
- Run `/add-context --global` to save personal coding patterns
|
||||
- These apply to ALL projects as fallback
|
||||
- Any project can override with local `/add-context`
|
||||
40
.opencode/context/core/system/navigation.md
Normal file
40
.opencode/context/core/system/navigation.md
Normal file
@@ -0,0 +1,40 @@
|
||||
<!-- Context: core/navigation | Priority: critical | Version: 1.0 | Updated: 2026-02-15 -->
|
||||
|
||||
# Core System
|
||||
|
||||
**Purpose**: System guides and paths for core operations
|
||||
|
||||
---
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
core/system/
|
||||
├── navigation.md (this file)
|
||||
└── [system guides and paths]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Quick Routes
|
||||
|
||||
| Task | Path |
|
||||
|------|------|
|
||||
| **System guides** | `./` |
|
||||
| **Core standards** | `../standards/navigation.md` |
|
||||
| **Context system** | `../context-system/navigation.md` |
|
||||
|
||||
---
|
||||
|
||||
## By Type
|
||||
|
||||
**System Guides** → Operational guides for core systems
|
||||
**Paths** → System paths and directory structures
|
||||
|
||||
---
|
||||
|
||||
## Related Context
|
||||
|
||||
- **Core Navigation** → `../navigation.md`
|
||||
- **Context System** → `../context-system/navigation.md`
|
||||
- **Core Standards** → `../standards/navigation.md`
|
||||
Reference in New Issue
Block a user