agentleFS
kimgoetzkekimgoetzke/coding-agent-configs/skills/research-mode/SKILL.md

research-mode

Skill2 starsChanged 7 months agoMITView on GitHub

Toggle persistent research mode on/off. When on, hook support can remind the agent to keep the research document updated throughout the conversation, with manual fallback if unavailable. Use with a research topic to start, with "continue" to resume an existing research doc, or with "off" to stop.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. 0 are common, 10 are distinctive, and 14 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 14

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you cannot determine which tool you are, ask the user.

    line 26
  2. Very specific:

    No output: use local-ai-folder-markdown, the default for this skill group

    line 36
  3. Very specific:

    Read ../persist/persistence/{implementation}.md and follow it whenever this skill lists, opens or updates a research document.

    line 39
  4. Distinctive:

    If the argument is "off", skip this step and go directly to Step 2.

    line 45
  5. Very specific:

    If running in Claude Code, run bash {skill-dir}/scripts/check-hooks.sh and parse the structured output.

    line 49
  6. Very specific:

    If running in Copilot, run bash {skill-dir}/scripts/check-hooks.sh copilot and parse the structured output.

    line 50
  7. Very specific:

    When the user provides a topic, update the flag file's topic: line, then continue to Step 3b.

    line 77
  8. Very specific:

    If the flag file doesn't exist yet, create {repo root}/.ai/.active-mode with:

    line 81
  9. Very specific:

    If it already exists (from Step 3a), update the topic: line.

    line 88
  10. Very specific:

    After the persist skill creates the research document, update the flag file's document: line with the document's location.

    line 90
  11. Very specific:

    If running in Copilot, also include in the confirmation: "You can run /rename {task-name} to rename this conversation." where {task-name} …

    line 92
  12. Very specific:

    If running in Claude Code or Pi, instead include: "You can run /name {task-name} to name this conversation." where {task-name} is the …

    line 93
  13. Very specific:

    If there are none, stop and tell the user: "No existing research docs found.

    line 98
  14. Distinctive:

    If the input is a number, resolve it against the numbered list.

    line 107
  15. Distinctive:

    If the input is text, try exact document-name match first.

    line 108
  16. Distinctive:

    If no exact match, allow a single unambiguous case-insensitive partial match.

    line 109
  17. Distinctive:

    If the input is invalid, ambiguous, or out of range, stop and tell the user the selection was invalid.

    line 110
  18. Very specific:

    If running in Copilot, also include in the confirmation: "You can run /rename {task-name} to rename this conversation." where {task-name} …

    line 121
  19. Very specific:

    If running in Claude Code or Pi, instead include: "You can run /name {task-name} to name this conversation." where {task-name} is {topic}.

    line 122
  20. Distinctive:

    If you've learned something new since the last update, update the research document

    line 128
  21. Distinctive:

    If you haven't learned anything new, carry on — don't update for the sake of it

    line 129
  22. Distinctive:

    Keep the document well-structured: add new sections, refine conclusions, note contradictions

    line 130
  23. Distinctive:

    If that extension is installed, planning mode gets equivalent reminder and stale-flag cleanup behaviour automatically.

    line 213
  24. Very specific:

    If you need to persist research mode across sessions, re-enable it with /research-mode at the start of the new session.

    line 225

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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

Usage

  • /research-mode — Enable research mode, then prompt for a topic
  • /research-mode <topic> — Enable research mode and start researching the topic
  • /research-mode continue — List existing research docs and resume one
  • /research-mode off — Disable research mode

Configuration

Hook configuration by tool

ToolHook config location / equivalentScript format argument
Claude Code~/.claude/settings.json(none — default)
Copilot~/.copilot/hooks.jsoncopilot
PiBundled active-mode extension in .pi/agent/extensions/active-mode/(extension-driven)

Claude Code and Copilot support the bundled PostToolUse and SessionStart hook scripts directly. Pi does not use the same standalone hook configuration files in this repository's starter config. Instead, this starter config now ships a Pi-native active-mode extension that reads .ai/.active-mode, clears stale flags on fresh session start, injects reminder context before LLM calls, and shows mode status in the UI. If that extension is not installed, fall back to manual document updates.

If you cannot determine which tool you are, ask the user.

Persistence

This skill belongs to the research skill group. A persistence implementation decides where and how research documents are stored. The persist skill creates them; this skill lists, opens and updates them. Before Step 3c or Step 4, find the setting:

R="$(git rev-parse --show-toplevel 2>/dev/null)/.ai/config.properties"; { cat "$R" ~/.ai/config.properties | grep '^persistence\.research[[:space:]]*=[[:space:]]*[^[:space:]]'; cat "$R" ~/.ai/config.properties | grep '^persistence[[:space:]]*=[[:space:]]*[^[:space:]]'; } 2>/dev/null | head -1 | tr -d ' \t\r'
  • No output: use local-ai-folder-markdown, the default for this skill group
  • persistence.research={value} or persistence={value}: use {value}. If ../persist/persistence/{value}.md does not exist, tell the user the research skill group has no {value} implementation and use local-ai-folder-markdown

Read ../persist/persistence/{implementation}.md and follow it whenever this skill lists, opens or updates a research document. The .ai/.active-mode flag file is not part of this and always stays in the repository.

Workflow

Step 1: Check hook configuration

If the argument is "off", skip this step and go directly to Step 2.

Otherwise:

  • If running in Claude Code, run bash {skill-dir}/scripts/check-hooks.sh and parse the structured output.
  • If running in Copilot, run bash {skill-dir}/scripts/check-hooks.sh copilot and parse the structured output.
  • If running in Pi, skip the standalone hook check. Explain that this repository's Pi starter config uses the bundled active-mode extension instead of standalone hook files. If that extension is installed, research mode gets equivalent reminder/cleanup behaviour automatically. Otherwise research mode will rely on manual update discipline only. Then continue to Step 2.

For Claude Code and Copilot:

  • If STATUS: YES: continue to Step 2.
  • If STATUS: NO or STATUS: PARTIAL: offer to install the missing hooks now (see Hook Setup below) before proceeding. If the user declines, note that research mode will rely on manual update discipline only — no PostToolUse reminders and no SessionStart cleanup — then continue.

Step 2: Determine action

Parse the arguments:

  • No arguments → go to Step 3a
  • "off" → go to Step 5
  • "continue" → go to Step 3c
  • Any other text → treat as the research topic, go to Step 3b

Step 3a: Enable without topic

  1. Create {repo root}/.ai/.active-mode with:
    mode: research
    topic: (awaiting input)
    document: (pending)
    started: {yyyy-mm-dd HH:mm}
  2. Tell the user: "Research mode is on. What would you like to research?"
  3. When the user provides a topic, update the flag file's topic: line, then continue to Step 3b.

Step 3b: Enable with topic

  1. If the flag file doesn't exist yet, create {repo root}/.ai/.active-mode with:
    mode: research
    topic: {the research topic}
    document: (pending)
    started: {yyyy-mm-dd HH:mm}
    If it already exists (from Step 3a), update the topic: line.
  2. Invoke the persist skill to begin researching the topic.
  3. After the persist skill creates the research document, update the flag file's document: line with the document's location.
  4. Confirm to the user: "Research mode is on. I'll keep updating {document location} as we go. Use /research-mode off when done. Research mode will be auto-disabled by starting a new session when supported by your harness configuration."
  5. If running in Copilot, also include in the confirmation: "You can run /rename {task-name} to rename this conversation." where {task-name} is the document's {topic}.
  6. If running in Claude Code or Pi, instead include: "You can run /name {task-name} to name this conversation." where {task-name} is the document's {topic}.

Step 3c: Continue an existing research doc

  1. List research documents.
    • If there are none, stop and tell the user: "No existing research docs found. Use /research-mode <topic> to start a new one."
  2. Sort newest first.
  3. Show the document names exactly as stored in a numbered list. Example:
    1. 2026-04-10 auth-middleware-analysis
    2. 2026-04-08 retry-strategies
  4. Prompt the user to reply with either the list number or the document name.
  5. Resolve the selection:
    • If the input is a number, resolve it against the numbered list.
    • If the input is text, try exact document-name match first.
    • If no exact match, allow a single unambiguous case-insensitive partial match.
    • If the input is invalid, ambiguous, or out of range, stop and tell the user the selection was invalid. Do not re-prompt.
  6. Open the selected document so its contents are in context.
  7. Derive {topic} from the document name by removing the {yyyy-mm-dd} prefix.
  8. Create {repo root}/.ai/.active-mode with:
    mode: research
    topic: {topic}
    document: {location of the selected doc}
    started: {yyyy-mm-dd HH:mm}
  9. Confirm to the user: "Research mode is on. Continuing {document location}. Use /research-mode off when done. Research mode will be auto-disabled by starting a new session when supported by your harness configuration."
  10. If running in Copilot, also include in the confirmation: "You can run /rename {task-name} to rename this conversation." where {task-name} is {topic}.
  11. If running in Claude Code or Pi, instead include: "You can run /name {task-name} to name this conversation." where {task-name} is {topic}.

Step 4: Keep the research document updated

While research mode is active, if your harness has PostToolUse hook support configured, the hook outputs reminders after each tool use. When you see these reminders:

  • If you've learned something new since the last update, update the research document
  • If you haven't learned anything new, carry on — don't update for the sake of it
  • Keep the document well-structured: add new sections, refine conclusions, note contradictions

Step 5: Disable

  1. Delete {repo root}/.ai/.active-mode
  2. Confirm: "Research mode is off."

Step 6: Session startup cleanup

For harnesses with SessionStart hook support configured, stale flag files from previous sessions are cleared automatically. In Pi, the bundled active-mode extension clears stale flags on fresh session start when installed. Without that extension, delete a stale .ai/.active-mode file before re-enabling research mode if one is left behind.

Hook Setup

Research mode relies on two hooks to function fully. Without the PostToolUse hook, only the persist skill's built-in continuous update behaviour and Step 4 above apply.

Step 1 runs scripts/check-hooks.sh to verify configuration automatically for Claude Code and Copilot. If that reports STATUS: NO or STATUS: PARTIAL, offer to add the missing hooks using the appropriate format below.

Claude Code

Merge into ~/.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "bash ~/.claude/skills/research-mode/scripts/research-mode-hook.sh"
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "bash ~/.claude/skills/research-mode/scripts/clear-mode.sh"
          }
        ]
      }
    ]
  }
}

Copilot

Merge into ~/.copilot/hooks.json:

{
  "hooks": {
    "postToolUse": [
      {
        "type": "command",
        "bash": "~/.copilot/skills/research-mode/scripts/research-mode-hook.sh copilot"
      }
    ],
    "sessionStart": [
      {
        "type": "command",
        "bash": "~/.copilot/skills/research-mode/scripts/clear-mode.sh copilot"
      }
    ]
  }
}

Note: The copilot argument tells the scripts to output JSON with additionalContext for Copilot's context injection format.

Pi

This repository's Pi starter config includes the active-mode extension under .pi/agent/extensions/active-mode/. That extension uses Pi lifecycle events:

  • fresh-session cleanup via session_start
  • per-turn / post-tool-style reminders via before_agent_start and context
  • visible mode state via ctx.ui.setStatus()

If that extension is installed, planning mode gets equivalent reminder and stale-flag cleanup behaviour automatically. If it is not installed, use manual document updates.

Bundled scripts

  • scripts/research-mode-hook.sh — PostToolUse reminder
  • scripts/clear-mode.sh — SessionStart cleanup
  • scripts/check-hooks.sh — verifies the two hooks above are configured in the relevant settings file

Notes

  • For harnesses with SessionStart hook support configured, the flag file is automatically cleared at session startup.
  • In Pi, the bundled active-mode extension provides the equivalent behaviour without standalone hook files.
  • If you need to persist research mode across sessions, re-enable it with /research-mode at the start of the new session.
  • Both hook scripts are silent when the flag file doesn't exist — no impact on normal conversations.

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.