---
description: Enhanced task creation with knowledge base integration
agent: orchestrator
---

# Create Task with Knowledge Base Integration

**Task:** $ARGUMENTS
**Project:** $(basename $(pwd))
**Timestamp:** $(date '+%Y-%m-%d %H:%M:%S')

## Task Creation with Auto-Spec

### Creating Backlog Task

!`backlog task create "$ARGUMENTS" --status "To Do" --priority medium`

### Creating Corresponding Spec

!`SPEC_FILE=".opencode/memory/$(echo "$ARGUMENTS" | tr ' ' '-' | tr '[:upper:]' '[:lower:]').md"
cp .opencode/memory/\_templates/spec.md "$SPEC_FILE"

# Then customize the template with task details`

# Spec: $ARGUMENTS

**Project:** $(basename $(pwd))
**Created:** $(date '+%Y-%m-%d')
**Status:** Draft
**Backlog Task:** @backlog/tasks#ID

## Problem

[To be defined]

## Solution

[To be defined during implementation]

## Implementation Steps

1. [Research phase]
2. [Planning phase]
3. [Implementation phase]
4. [Testing phase]

## Acceptance Criteria

- [ ] Requirement 1
- [ ] Requirement 2
- [ ] Requirement 3

## AI Drift Log

[Document when AI strays from spec]

---

_Auto-generated spec for task: $ARGUMENTS_
EOF`

## Research Preparation

### Initial Research Cache

!`mkdir -p .opencode/memory/research/ && echo "Research cache for $(echo "$ARGUMENTS" | tr ' ' '-')" > .opencode/memory/research/cache-$(echo "$ARGUMENTS" | tr ' ' '-' | tr '[:upper:]' '[:lower:]').md`

### Check Existing Patterns

!`gkg search_codebase_definitions --project_absolute_path $(pwd) --search_terms ["$(echo "$ARGUMENTS" | tr ' ' '-' | cut -d'-' -f1)"] --page 1`

## Next Steps

### Immediate Actions

1. **Review Task:** Check created task in backlog
2. **Refine Spec:** Edit spec with specific requirements
3. **Research:** Review cached research file
4. **Plan:** Use /analyze-project for context

### Implementation Workflow

When ready to implement:

```bash
/research-and-implement $ARGUMENTS
@build Implement using research findings
```

### Validation

- [ ] Task created in backlog
- [ ] Spec created in knowledge base
- [ ] Research cache initialized
- [ ] Existing patterns identified

---

_This command creates both a backlog task and corresponding spec automatically_
