Host: Codex CLI — This skill was designed for Claude Code and adapted for Codex.
Cross-reference commands use installed skill names in Codex rather than /octo:* slash commands.
Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it.
For host tool equivalents, see skills/blocks/codex-host-adapter.md.
Context Detection - Internal Skill
Purpose
This skill provides automatic context detection to determine whether the user is working in a Development context (code-focused) or Knowledge context (research/strategy-focused). This replaces the manual /octo:km toggle with intelligent auto-detection.
Detection Algorithm
When a workflow skill activates, detect context using these signals:
Step 1: Check for Explicit Override
If user has explicitly set mode via /octo:km on or /octo:km off, respect that setting.
# Check if knowledge mode is explicitly set
if [[ -f ~/.claude-octopus/config/knowledge-mode ]]; then
EXPLICIT_MODE=$(cat ~/.claude-octopus/config/knowledge-mode)
if [[ "$EXPLICIT_MODE" == "on" ]]; then
echo "knowledge"
exit 0
elif [[ "$EXPLICIT_MODE" == "off" ]]; then
echo "dev"
exit 0
fi
fi
# If "auto" or not set, proceed with auto-detection
Step 2: Analyze Prompt Content (Strongest Signal)
Knowledge Context Indicators (check prompt for these terms):
- Business/strategy: "market", "ROI", "stakeholders", "strategy", "business case", "competitive"
- Research: "literature", "synthesis", "academic", "papers", "research question"
- UX: "personas", "user research", "journey map", "pain points", "interviews"
- Deliverables: "presentation", "report", "PRD", "proposal", "executive summary"
Dev Context Indicators (check prompt for these terms):
- Technical: "API", "endpoint", "database", "function", "class", "module"
- Actions: "implement", "debug", "refactor", "test", "deploy", "build"
- Artifacts: "code", "tests", "migration", "schema", "controller"
Scoring:
- Count knowledge indicators in prompt
- Count dev indicators in prompt
- Higher count wins
- If tied, check project context (Step 3)
Step 3: Analyze Project Context (Secondary Signal)
Dev Project Indicators:
- Has
package.json, Cargo.toml, go.mod, pyproject.toml, pom.xml
- Has
src/, lib/, app/ directories with code files
- Recent files are
.ts, .js, .py, .go, .rs, .java
Knowledge Project Indicators:
- Has
docs/, research/, strategy/, reports/ directories
- Majority of files are
.md, .docx, .pdf, .pptx
- No code package managers detected
Step 4: Default Fallback
If signals are ambiguous or equal:
- In a git repo with code files → Default to Dev Context
- No code files detected → Default to Knowledge Context
Context Output Format
Return detected context as a structured object for use by workflow skills:
{
"context": "dev" | "knowledge",
"confidence": "high" | "medium" | "low",
"signals": {
"prompt_indicators": ["API", "endpoint", "database"],
"project_type": "node_typescript",
"explicit_override": false
}
}
How Workflow Skills Use Context
flow-discover (Research)
| Aspect |
Dev Context |
Knowledge Context |
| Research Focus |
Technical implementation, library comparison, code patterns |
Market analysis, academic synthesis, competitive research |
| Primary Agents |
Codex (implementation), Gemini (ecosystem) |
Gemini (analysis), research-synthesizer |
| Output Format |
Code examples, API comparisons, tech recommendations |
Reports, frameworks, strategic recommendations |
| Visual Banner |
🔍 [Dev] Discover Phase: Technical research |
🔍 [Knowledge] Discover Phase: Strategic research |
flow-develop (Build)
| Aspect |
Dev Context |
Knowledge Context |
| Build Focus |
Code generation, implementation, architecture |
PRDs, strategy docs, presentations |
| Primary Agents |
Codex (code), backend-architect, tdd-orchestrator |
product-writer, strategy-analyst, exec-communicator |
| Output Format |
Source files, tests, migrations |
Documents, frameworks, action plans |
| Visual Banner |
🛠️ [Dev] Develop Phase: Building code |
🛠️ [Knowledge] Develop Phase: Building deliverables |
flow-deliver (Review)
| Aspect |
Dev Context |
Knowledge Context |
| Review Focus |
Code quality, security, performance |
Document quality, argument strength, completeness |
| Primary Agents |
code-reviewer, security-auditor |
exec-communicator, strategy-analyst |
| Quality Gates |
OWASP, test coverage, maintainability |
Evidence quality, clarity, actionability |
| Visual Banner |
✅ [Dev] Deliver Phase: Code review |
✅ [Knowledge] Deliver Phase: Document review |
Visual Indicator Update
When context is detected, update the visual banner to show context:
Dev Context:
🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-provider research mode
🔍 [Dev] Discover Phase: Researching OAuth implementation patterns
Providers:
🔴 Codex CLI - Technical implementation analysis
🟡 Gemini CLI - Ecosystem and library comparison
🔵 Claude - Strategic synthesis
Knowledge Context:
🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-provider research mode
🔍 [Knowledge] Discover Phase: Researching market entry strategies
Providers:
🔴 Codex CLI - Data analysis and modeling
🟡 Gemini CLI - Market and competitive research
🔵 Claude - Strategic synthesis
Implementation in Workflow Skills
Each flow skill should:
- Before executing workflow, run context detection
- Show detected context in visual banner
- Adjust behavior based on context:
- Agent selection
- Prompt framing for external CLIs
- Output format expectations
- Quality gate criteria
Example Integration (Pseudocode)
When this skill activates:
1. **Detect context**
- Analyze user's prompt for knowledge vs dev indicators
- Check project type (code repo vs doc-heavy)
- Check for explicit override (~/.claude-octopus/config/knowledge-mode)
- Determine: "dev" or "knowledge" with confidence level
2. **Show context-aware banner**
🐙 CLAUDE OCTOPUS ACTIVATED - Multi-provider [research|implementation|validation] mode
[Phase Emoji] [Context] [Phase Name]: [Description]
Detected Context: [Dev|Knowledge] (confidence: [high|medium|low])
3. **Execute workflow with context-appropriate behavior**
- Frame prompts for external providers based on context
- Select appropriate synthesis approach
- Apply context-specific quality gates
Override Mechanism
Users can still explicitly set context when auto-detection is wrong:
# Force knowledge mode
/octo:km on
# Force dev mode
/octo:km off
# Return to auto-detection
/octo:km auto
When explicit override is set, context detection respects it until user resets to "auto".
Confidence Levels
- High: Strong signals in prompt AND project context agree
- Medium: Signals in prompt OR project context (not both)
- Low: Ambiguous signals, using fallback default
When confidence is "low", consider briefly mentioning the detected context to user:
"I detected this as a [dev/knowledge] task. If that's wrong, you can use /octo:km to override."
Testing Context Detection
To verify context detection is working:
- In a code repository, ask "octo research caching patterns" → Should detect Dev Context
- In same repo, ask "octo research market opportunities" → Should detect Knowledge Context
- With
/octo:km on set, ask "octo research API patterns" → Should use Knowledge Context (explicit override)
Proactive Skill Suggestions
When detecting the user's work stage, surface relevant command suggestions:
| Detected Context |
Suggestion |
| Brainstorming / exploring ideas |
Consider /octo:brainstorm for structured ideation |
| Reviewing a plan or strategy |
Consider /octo:plan for strategic planning |
| Debugging errors or failures |
Consider /octo:debug for systematic investigation |
| Writing or running tests |
Consider /octo:tdd for test-driven development |
| Code review before merge |
Use Claude-native /review for ordinary review; suggest /octo:review for multi-AI escalation |
| Ready to deploy or ship |
Consider /octo:deliver for quality-gated delivery |
| Researching a topic |
Consider /octo:research for multi-source synthesis |
| Working on security |
Use Claude-native /security-review for ordinary security review; suggest /octo:security for escalated OWASP or adversarial audit |
Suggestion Format
Suggestions should be non-intrusive, appended as a brief note:
💡 Tip: You appear to be debugging — `/octo:debug` provides systematic investigation with multi-AI support.
Persistent Opt-Out
- If user says "stop suggesting" or "no more tips": set
OCTO_PROACTIVE_SUGGESTIONS=off in .claude-octopus/preferences.json
- If user says "be proactive" or "turn on tips": set
OCTO_PROACTIVE_SUGGESTIONS=on
- Check preference at suggestion time — never suggest when opted out
- Respect current mode: dev mode suggestions differ from knowledge work suggestions
Re-Enable Suggestions
Users who previously opted out can re-enable suggestions at any time:
- Say "be proactive", "turn on tips", or "enable suggestions"
- Manually edit
~/.claude-octopus/preferences.json and set OCTO_PROACTIVE_SUGGESTIONS to on
- Default state (no preference set) is suggestions enabled
Detection Signals
Detect work stage from:
- Recent tool usage (many Bash calls = likely implementing/debugging)
- File types being edited (.test.ts = testing, .md = documentation)
- Error patterns in recent output (stack traces = debugging)
- Git state (uncommitted changes = implementing, clean tree = ready to review/ship)
Source: hashgraph-online/awesome-codex-plugins → plugins/nyldn/claude-octopus/skills/skill-context-detection/SKILL.md
1---2name: skill-context-detection3description: Auto-detect work context (Dev vs Knowledge) — use to tailor workflows based on current task type4---567> **Host: Codex CLI** — This skill was designed for Claude Code and adapted for Codex.8> Cross-reference commands use installed skill names in Codex rather than `/octo:*` slash commands.9> Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it.10> For host tool equivalents, see `skills/blocks/codex-host-adapter.md`.111213# Context Detection - Internal Skill1415## Purpose1617This skill provides **automatic context detection** to determine whether the user is working in a **Development context** (code-focused) or **Knowledge context** (research/strategy-focused). This replaces the manual `/octo:km` toggle with intelligent auto-detection.1819## Detection Algorithm2021When a workflow skill activates, detect context using these signals:2223### Step 1: Check for Explicit Override2425If user has explicitly set mode via `/octo:km on` or `/octo:km off`, respect that setting.2627```bash28# Check if knowledge mode is explicitly set29if [[ -f ~/.claude-octopus/config/knowledge-mode ]]; then30 EXPLICIT_MODE=$(cat ~/.claude-octopus/config/knowledge-mode)31 if [[ "$EXPLICIT_MODE" == "on" ]]; then32 echo "knowledge"33 exit 034 elif [[ "$EXPLICIT_MODE" == "off" ]]; then35 echo "dev"36 exit 037 fi38fi39# If "auto" or not set, proceed with auto-detection40```4142### Step 2: Analyze Prompt Content (Strongest Signal)4344**Knowledge Context Indicators** (check prompt for these terms):45- Business/strategy: "market", "ROI", "stakeholders", "strategy", "business case", "competitive"46- Research: "literature", "synthesis", "academic", "papers", "research question"47- UX: "personas", "user research", "journey map", "pain points", "interviews"48- Deliverables: "presentation", "report", "PRD", "proposal", "executive summary"4950**Dev Context Indicators** (check prompt for these terms):51- Technical: "API", "endpoint", "database", "function", "class", "module"52- Actions: "implement", "debug", "refactor", "test", "deploy", "build"53- Artifacts: "code", "tests", "migration", "schema", "controller"5455**Scoring:**56- Count knowledge indicators in prompt57- Count dev indicators in prompt58- Higher count wins59- If tied, check project context (Step 3)6061### Step 3: Analyze Project Context (Secondary Signal)6263**Dev Project Indicators:**64- Has `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `pom.xml`65- Has `src/`, `lib/`, `app/` directories with code files66- Recent files are `.ts`, `.js`, `.py`, `.go`, `.rs`, `.java`6768**Knowledge Project Indicators:**69- Has `docs/`, `research/`, `strategy/`, `reports/` directories70- Majority of files are `.md`, `.docx`, `.pdf`, `.pptx`71- No code package managers detected7273### Step 4: Default Fallback7475If signals are ambiguous or equal:76- In a git repo with code files → Default to **Dev Context**77- No code files detected → Default to **Knowledge Context**787980## Context Output Format8182Return detected context as a structured object for use by workflow skills:8384```json85{86 "context": "dev" | "knowledge",87 "confidence": "high" | "medium" | "low",88 "signals": {89 "prompt_indicators": ["API", "endpoint", "database"],90 "project_type": "node_typescript",91 "explicit_override": false92 }93}94```959697## How Workflow Skills Use Context9899### flow-discover (Research)100101| Aspect | Dev Context | Knowledge Context |102|--------|-------------|-------------------|103| **Research Focus** | Technical implementation, library comparison, code patterns | Market analysis, academic synthesis, competitive research |104| **Primary Agents** | Codex (implementation), Gemini (ecosystem) | Gemini (analysis), research-synthesizer |105| **Output Format** | Code examples, API comparisons, tech recommendations | Reports, frameworks, strategic recommendations |106| **Visual Banner** | `🔍 [Dev] Discover Phase: Technical research` | `🔍 [Knowledge] Discover Phase: Strategic research` |107108### flow-develop (Build)109110| Aspect | Dev Context | Knowledge Context |111|--------|-------------|-------------------|112| **Build Focus** | Code generation, implementation, architecture | PRDs, strategy docs, presentations |113| **Primary Agents** | Codex (code), backend-architect, tdd-orchestrator | product-writer, strategy-analyst, exec-communicator |114| **Output Format** | Source files, tests, migrations | Documents, frameworks, action plans |115| **Visual Banner** | `🛠️ [Dev] Develop Phase: Building code` | `🛠️ [Knowledge] Develop Phase: Building deliverables` |116117### flow-deliver (Review)118119| Aspect | Dev Context | Knowledge Context |120|--------|-------------|-------------------|121| **Review Focus** | Code quality, security, performance | Document quality, argument strength, completeness |122| **Primary Agents** | code-reviewer, security-auditor | exec-communicator, strategy-analyst |123| **Quality Gates** | OWASP, test coverage, maintainability | Evidence quality, clarity, actionability |124| **Visual Banner** | `✅ [Dev] Deliver Phase: Code review` | `✅ [Knowledge] Deliver Phase: Document review` |125126127## Visual Indicator Update128129When context is detected, update the visual banner to show context:130131**Dev Context:**132```133🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-provider research mode134🔍 [Dev] Discover Phase: Researching OAuth implementation patterns135136Providers:137🔴 Codex CLI - Technical implementation analysis138🟡 Gemini CLI - Ecosystem and library comparison139🔵 Claude - Strategic synthesis140```141142**Knowledge Context:**143```144🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-provider research mode145🔍 [Knowledge] Discover Phase: Researching market entry strategies146147Providers:148🔴 Codex CLI - Data analysis and modeling149🟡 Gemini CLI - Market and competitive research150🔵 Claude - Strategic synthesis151```152153154## Implementation in Workflow Skills155156Each flow skill should:1571581. **Before executing workflow**, run context detection1592. **Show detected context** in visual banner1603. **Adjust behavior** based on context:161 - Agent selection162 - Prompt framing for external CLIs163 - Output format expectations164 - Quality gate criteria165166### Example Integration (Pseudocode)167168```markdown169When this skill activates:1701711. **Detect context**172 - Analyze user's prompt for knowledge vs dev indicators173 - Check project type (code repo vs doc-heavy)174 - Check for explicit override (~/.claude-octopus/config/knowledge-mode)175 - Determine: "dev" or "knowledge" with confidence level1761772. **Show context-aware banner**178 ```179 🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-provider [research|implementation|validation] mode180 [Phase Emoji] [Context] [Phase Name]: [Description]181 182 Detected Context: [Dev|Knowledge] (confidence: [high|medium|low])183 ```1841853. **Execute workflow with context-appropriate behavior**186 - Frame prompts for external providers based on context187 - Select appropriate synthesis approach188 - Apply context-specific quality gates189```190191192## Override Mechanism193194Users can still explicitly set context when auto-detection is wrong:195196```bash197# Force knowledge mode198/octo:km on199200# Force dev mode 201/octo:km off202203# Return to auto-detection204/octo:km auto205```206207When explicit override is set, context detection respects it until user resets to "auto".208209210## Confidence Levels211212- **High**: Strong signals in prompt AND project context agree213- **Medium**: Signals in prompt OR project context (not both)214- **Low**: Ambiguous signals, using fallback default215216When confidence is "low", consider briefly mentioning the detected context to user:217> "I detected this as a [dev/knowledge] task. If that's wrong, you can use `/octo:km` to override."218219220## Testing Context Detection221222To verify context detection is working:2232241. In a code repository, ask "octo research caching patterns" → Should detect **Dev Context**2252. In same repo, ask "octo research market opportunities" → Should detect **Knowledge Context**2263. With `/octo:km on` set, ask "octo research API patterns" → Should use **Knowledge Context** (explicit override)227228229## Proactive Skill Suggestions230231When detecting the user's work stage, surface relevant command suggestions:232233| Detected Context | Suggestion |234|-----------------|------------|235| Brainstorming / exploring ideas | Consider `/octo:brainstorm` for structured ideation |236| Reviewing a plan or strategy | Consider `/octo:plan` for strategic planning |237| Debugging errors or failures | Consider `/octo:debug` for systematic investigation |238| Writing or running tests | Consider `/octo:tdd` for test-driven development |239| Code review before merge | Use Claude-native `/review` for ordinary review; suggest `/octo:review` for multi-AI escalation |240| Ready to deploy or ship | Consider `/octo:deliver` for quality-gated delivery |241| Researching a topic | Consider `/octo:research` for multi-source synthesis |242| Working on security | Use Claude-native `/security-review` for ordinary security review; suggest `/octo:security` for escalated OWASP or adversarial audit |243244### Suggestion Format245246Suggestions should be non-intrusive, appended as a brief note:247248```249💡 Tip: You appear to be debugging — `/octo:debug` provides systematic investigation with multi-AI support.250```251252### Persistent Opt-Out253254- If user says "stop suggesting" or "no more tips": set `OCTO_PROACTIVE_SUGGESTIONS=off` in `.claude-octopus/preferences.json`255- If user says "be proactive" or "turn on tips": set `OCTO_PROACTIVE_SUGGESTIONS=on`256- Check preference at suggestion time — never suggest when opted out257- Respect current mode: dev mode suggestions differ from knowledge work suggestions258259### Re-Enable Suggestions260261Users who previously opted out can re-enable suggestions at any time:262- Say "be proactive", "turn on tips", or "enable suggestions"263- Manually edit `~/.claude-octopus/preferences.json` and set `OCTO_PROACTIVE_SUGGESTIONS` to `on`264- Default state (no preference set) is suggestions enabled265266### Detection Signals267268Detect work stage from:269- Recent tool usage (many Bash calls = likely implementing/debugging)270- File types being edited (.test.ts = testing, .md = documentation)271- Error patterns in recent output (stack traces = debugging)272- Git state (uncommitted changes = implementing, clean tree = ready to review/ship)273274---275276**Source:** [`hashgraph-online/awesome-codex-plugins`](https://github.com/hashgraph-online/awesome-codex-plugins) → `plugins/nyldn/claude-octopus/skills/skill-context-detection/SKILL.md`