agentleFS
nyldnnyldn/claude-octopus/.claude/skills/skill-context-detection/SKILL.md

skill-context-detection

Skill4.2k starsChanged 4 months agoMITView on GitHub

Auto-detect work context (Dev vs Knowledge) — use to tailor workflows based on current task type

1 other project uses a version of this, 1 of them edited.

Trending

Quiet since October.about the whole repository

Jan 2026: 2 mentionsFeb 2026: 0 mentionsMar 2026: 4 mentionsApr 2026: 3 mentionsMay 2026: 1 mentionJun 2026: 8 mentionsJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 11 mentionsOct 2026: 5 mentionsNov 2026: 0 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the nyldn/claude-octopus repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about nyldn/claude-octopus

The biggest 5 of 36 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 36

Talked about on GitHub, Bluesky and Hacker News (36 times).

On GitHub · 33

28 more on GitHub

On Bluesky · 2

On Hacker News · 1

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 11 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a workflow skill activates, detect context using these signals:

    line 16
  2. Very specific:

    If user has explicitly set mode via /octo:km on or /octo:km off, respect that setting.

    line 20
  3. Distinctive:

    If tied, check project context (Step 3)

    line 54
  4. Distinctive:

    No code package managers detected

    line 66
  5. Distinctive:

    If signals are ambiguous or equal:

    line 70
  6. Distinctive:

    No code files detected → Default to Knowledge Context

    line 72
  7. Distinctive:

    When context is detected, update the visual banner to show context:

    line 127
  8. Distinctive:

    When explicit override is set, context detection respects it until user resets to "auto".

    line 207
  9. Distinctive:

    When confidence is "low", consider briefly mentioning the detected context to user:

    line 217
  10. Distinctive:

    When detecting the user's work stage, surface relevant command suggestions:

    line 234
  11. Very specific:

    If user says "stop suggesting" or "no more tips": set OCTO_PROACTIVE_SUGGESTIONS=off in .claude-octopus/preferences.json

    line 257
  12. Very specific:

    If user says "be proactive" or "turn on tips": set OCTO_PROACTIVE_SUGGESTIONS=on

    line 258
  13. Distinctive:

    Check preference at suggestion time — never suggest when opted out

    line 259
  14. Distinctive:

    Default state (no preference set) is suggestions enabled

    line 267

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.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)

AspectDev ContextKnowledge Context
Research FocusTechnical implementation, library comparison, code patternsMarket analysis, academic synthesis, competitive research
Primary AgentsCodex (implementation), Antigravity (ecosystem)Antigravity (analysis), research-synthesizer
Output FormatCode examples, API comparisons, tech recommendationsReports, frameworks, strategic recommendations
Visual Banner🔍 [Dev] Discover Phase: Technical research🔍 [Knowledge] Discover Phase: Strategic research

flow-develop (Build)

AspectDev ContextKnowledge Context
Build FocusCode generation, implementation, architecturePRDs, strategy docs, presentations
Primary AgentsCodex (code), backend-architect, tdd-orchestratorproduct-writer, strategy-analyst, exec-communicator
Output FormatSource files, tests, migrationsDocuments, frameworks, action plans
Visual Banner🛠️ [Dev] Develop Phase: Building code🛠️ [Knowledge] Develop Phase: Building deliverables

flow-deliver (Review)

AspectDev ContextKnowledge Context
Review FocusCode quality, security, performanceDocument quality, argument strength, completeness
Primary Agentscode-reviewer, security-auditorexec-communicator, strategy-analyst
Quality GatesOWASP, test coverage, maintainabilityEvidence 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
🟡 Antigravity 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
🟡 Antigravity CLI - Market and competitive research
🔵 Claude - Strategic synthesis

Implementation in Workflow Skills

Each flow skill should:

  1. Before executing workflow, run context detection
  2. Show detected context in visual banner
  3. 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:

  1. In a code repository, ask "octo research caching patterns" → Should detect Dev Context
  2. In same repo, ask "octo research market opportunities" → Should detect Knowledge Context
  3. 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 ContextSuggestion
Brainstorming / exploring ideasConsider /octo:brainstorm for structured ideation
Reviewing a plan or strategyConsider /octo:plan for strategic planning
Debugging errors or failuresConsider /octo:debug for systematic investigation
Writing or running testsConsider /octo:tdd for test-driven development
Code review before mergeUse Claude-native /review for ordinary review; suggest /octo:review for multi-AI escalation
Ready to deploy or shipConsider /octo:deliver for quality-gated delivery
Researching a topicConsider /octo:research for multi-source synthesis
Working on securityUse 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)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.