一键导入
developing-internal-hooks
Create, configure, and develop custom automation hooks, slash commands, event hooks, and dynamic skills under internal-hooks/
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create, configure, and develop custom automation hooks, slash commands, event hooks, and dynamic skills under internal-hooks/
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Designed to assist users with ADHD (Attention Deficit Hyperactivity Disorder) by mitigating task paralysis, managing distractions, providing dopamine-driven progress tracking, and using executive-friendly visual formatting. Triggered by keywords or topics: - Focus/Distraction: "adhd", "fokus", "distracted", "gampang bosan", "pecah fokus", "distraksi", "sulit konsentrasi". - Task Initiation/Paralysis: "bingung mulai", "task paralysis", "mager", "banyak tugas", "tumpuk", "stuck", "overwhelmed". - Motivation/Rewards: "dopamine", "reward", "game", "poin", "xp", "checkpoint". - Formats: "bionic reading", "visual salience", "micro-step", "body double".
Execute detailed plans in batches with review checkpoints
Prevent task duplication, file conflicts, and coordination failures when multiple subagents work in parallel on the same Superagent project. Covers both Superagent→Subagent coordination and Master Agent→Superagent worktree coordination. Uses manage_plan and manage_tasks as the coordination hub.
Execute implementation plan by dispatching fresh subagent for each task, with code review between tasks
Create isolated git worktrees with smart directory selection and safety verification
Triggered when the agent needs to audit, discover, and resolve missing features, architectural or functional gaps, performance/process bottlenecks, and structural complexity liabilities across a codebase, delivering lean and pragmatic improvement blueprints.
| name | Developing Internal Hooks |
| description | Create, configure, and develop custom automation hooks, slash commands, event hooks, and dynamic skills under internal-hooks/ |
| when_to_use | when creating, debugging, testing, or updating custom tools, slash commands, or event-driven lifecycles in Superagent |
| version | 1.1.0 |
| languages | ["typescript","javascript","python","shell"] |
Internal Hooks are custom user-defined scripts placed in subdirectories under internal-hooks/ at the root of the project. They are loaded dynamically at startup and allow extending Superagent's functionality in four powerful ways:
/my-command).skills/<skill_name>/SKILL.md) packaged directly inside your hook folder.Every hook must be placed in a subdirectory: internal-hooks/<hook_name>/. The structure MUST contain the following:
internal-hooks/<hook_name>/
├── hook.json # Root schema mapping tools, slash commands, and event hooks
├── package.json # Dependency and script management
├── index.js # Entrypoint script executing logic
├── test-payload.json # Stdin mock argument payload for local dev loop testing
├── README.md # [Mandatory] Hook documentation
├── CHANGELOG.md # [Mandatory] Hook release notes
└── skills/ # [Optional] Dynamic agent skills directory
└── <my-custom-skill>/
└── SKILL.md # Skill markdown documentation for agent instruction
All internal hooks are strictly required to have:
git init). This is done automatically by /ih init <hook_name>, which scaffolds the mandatory files and configures git.hook.json ConfigurationDefines the dynamic tools, custom slash commands, and event hooks.
{
"name": "my_hook_tool",
"description": "Expose this custom tool to the AI agent. Describe what it does.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query."
}
},
"required": ["query"]
},
"command": "node index.js --tool",
"slash_commands": [
{
"name": "my-cmd",
"aliases": ["mc"],
"description": "Trigger my custom command manually in the terminal.",
"command": "node index.js --cmd"
}
],
"event_hooks": [
{
"event": "pre_tool",
"command": "node index.js --event pre_tool"
},
{
"event": "post_tool",
"command": "node index.js --event post_tool"
},
{
"event": "pre_command",
"command": "node index.js --event pre_command"
},
{
"event": "post_command",
"command": "node index.js --event post_command"
}
]
}
index.js)Scripts can handle inputs depending on whether they are triggered as a tool, command, or event.
/my-cmd hello calls node index.js --cmd hello).pre_tool / post_tool: { "toolName": string, "args": object, "result"?: any, "cwd": string }pre_command / post_command: { "command": string, "name": string, "args": string }import fs from "fs";
// Read piped stdin if present
const stdinContent = fs.readFileSync(0, "utf-8").trim();
let stdinData = {};
if (stdinContent) {
try {
stdinData = JSON.parse(stdinContent);
} catch (e) {
stdinData = { raw: stdinContent };
}
}
const args = process.argv.slice(2);
console.log("Hook executed successfully!");
console.log("Arguments passed:", args);
console.log("Stdin JSON read:", JSON.stringify(stdinData));
If an active hook contains a skills/ subdirectory, any skill bundles nested inside it (e.g. skills/my-skill/SKILL.md) will automatically be loaded on startup.
/skills list./skill-my-skill or /skill my-skill).Hooks are loaded and activated on a per-project basis. There are three ways hooks can be activated:
/ih init <hook_name>, it is automatically added to the active list for the current project./ih active in the terminal to open an interactive multi-select checkbox list. Checked hooks are activated, and unchecked hooks are deactivated.~/.superagent-r/model-config.json under the activeHooks object, keyed by the project's absolute folder path. To activate a hook programmatically, add its directory name to the array mapping for your project path./ih init <hook_name>/ih dev <hook_name> (Runs the dev script in package.json with test-payload.json piped as stdin)/ih active (Opens an interactive checklist to toggle which hooks are active)stdout to return values to the agent or terminal.stderr and terminate with a non-zero exit code (process.exit(1)) to indicate failures.process.env.SUPERAGENT_HOOK_DIR, the active workspace directory using process.env.SUPERAGENT_CWD, and the lifecycle event type via process.env.SUPERAGENT_EVENT (for event hooks).README.md and a CHANGELOG.md to track usage instructions and history.