ClaudeMod
ModsSecurityWrites / Shell

Claude Work Mode

Session work modes for Claude Code: /work-mode auto | out | wrap, with optional gates

Install· Claude Code 2.1.330+
$claude plugin marketplace add danyuchn/claude-work-mode
$claude plugin install work-mode@claude-work-mode
Run claude plugin validate to auditGuide →
Access & PermissionsWrites / Shell

Writes files, executes local shell processes, or programmatically drives Claude.

Runs shell commandsWrites filesReads filesReads env varsReads settingsReads mod stateDraws UI

Statically scanned from hooks & source. Learn how to audit

Dustin Yuchen Teng179 starsAdded 20 days ago

claude-work-mode

繁體中文

Session work modes for Claude Code, switched with one slash command:

ModeWhat the model is told
autoDo not stop to ask about internal, reversible steps (local files, local commits, tests). Hard stops (outgoing messages, installs, secrets, unrecoverable deletes, payments, permission changes, production changes) go to a pending list reported once at the end. Calls that will raise a confirmation prompt are run last, back to back.
outDelegate batch work a checker or spot check can verify (extraction, classification, summaries, reviews) to a background subagent or an external CLI; the main thread verifies. A one-time nudge fires when the main thread has read a lot of raw output in one turn without delegating, and past that point further reads are refused until the model delegates or declares in one line why it reads on (the read gate, below).
wrapConverge: open no new branches, finish what is open, list only new or changed decisions, each with a label and a recommendation.
offBack to normal.

Modes are per session, combine freely (/work-mode auto wrap), and out wrap together delegates only the work already open: delegated jobs count as open until their results are verified, so wrap's close waits for them. A bare /work-mode opens a multi-select picker. The mode text reaches the model once (with the next tool result or prompt) and again only after a compaction or resume, so it does not bloat every turn; a one-line reminder rides with every eighth prompt (reminderEveryTurns) so a long session does not drift off the modes.

The read gate (out)

A reminder alone is easy to read past, so out also changes the default. Once the main thread has read nudgeThresholdChars of raw output in one turn with nothing delegated, the next Read, Grep or reader Bash call (cat, sed, jq, grep...) is refused with a how-to. The model then either delegates (any call matching commandPattern, or an Agent call when subagentsDelegate is on) or runs a no-op Bash declaring why it reads inline:

: # work-mode: inline the file is being edited next

Reads then pass for the rest of the turn, and the reason is appended to ~/.claude/state/tempo-inline/<session_id>.jsonl for the next review. WebFetch counts as reading too. With subagentsDelegate: false, an Agent call is refused the same way until the prompt opens with why-claude: <reason> (edits, MCP or credentials, judgement, context already read here); the reason is logged. Paths matching dispatch.corpusPattern (transcripts, dumps, logs) are refused on their first read, before any count. Subagents are never gated. dispatch.readGate: false turns the gate off and keeps the nudge.

Demo (60s Walkthrough)

Claude Work Mode Demo

[!TIP] Click the preview above to play the 60-second walkthrough video demonstrating behavioral changes across all three modes.

Install

/plugin install work-mode --marketplace danyuchn/claude-work-mode

Answer y to add the marketplace, then pick a scope. Optional gates:

/plugin install work-mode-gates --marketplace danyuchn/claude-work-mode

Requirements: Claude Code with function-hook plugins (2.1.314 or later). The gates need bash, jq, git and python3.

The optional gates (work-mode-gates)

The modes are written to ~/.claude/state/tempo/<session_id> so shell hooks can read them. hooks/lib/tempo-auto.sh gives a gate two helpers: tempo_auto_on "$INPUT" and tempo_deny "<reason>". Under auto, a gate that would ask denies instead, with a reason telling the model what to do, so work continues without a prompt. The plugin ships three gates:

GateEventNormallyUnder auto
scratch-doc-guard.shPreToolUse Writeasks before creating a new SUMMARY*/REPORT*/NOTES*/FINDINGS*/ANALYSIS*.mddenies: update the existing doc, use a scratch dir, or answer in the reply
git-safe-commit-gate.shPreToolUse Bashasks on git commit with paths (with or without --) and on git add <file>... when a file already had unstaged editsdenies: use git add -p, then a plain git commit
decision-label-guard.pyStopblocks a reply whose decisions section holds an unlabeled item, or a tradeoff item that does not state what each side gainsunder auto, also blocks a reply whose closing lines offer to do something and ask first ("Shall I go ahead and...?", "say the word and I'll..."): an internal step is done, a hard stop goes on the pending list as a labeled item. Under wrap, also blocks a decisions section whose every item was already shown unchanged in one of the last six replies (read from the transcript tail), except in a final report or when asked to relist

Use tempo-auto.sh in your own gates for anything you want converted. Keep real hard stops (secrets, force pushes, deploys) out of it: they should ask in every mode.

Configuration (optional)

Everything works with no config. Language follows, in order: WORK_MODE_LOCALE, the Claude Code language setting (anything mentioning Chinese picks Traditional Chinese), then LC_ALL / LANG; English otherwise.

To personalise, create ~/.config/work-mode/config.json (or point WORK_MODE_CONFIG at a file). See examples/config.example.json. Every field is optional:

FieldDefaultMeaning
localedetecteden or zh-TW
userName / pronounsthe user / theyhow the mode texts refer to you (they, he, she)
autonomous.extraRules[]extra lines for the auto text
dispatch.pickerHintsubagents / external CLIshown in the picker and the switch reply
dispatch.instructionsbuilt inreplaces the whole out text, one line per entry
dispatch.commandPatterncodex exec, gemini, claude -pa Bash command matching this regex counts as delegating
dispatch.nudgeThresholdChars20000raw output read before the nudge fires (env DISPATCH_NUDGE_CHARS overrides)
dispatch.nudgeTemplatebuilt innudge text; {chars} is filled in
dispatch.readGatetruepast the nudge threshold, reads are refused until the model delegates or declares why it reads on
dispatch.corpusPatternnoneregex of paths that are batch material: their first read is refused under out
dispatch.gateTemplatebuilt inthe gate's refusal text; {chars} and {hint} are filled in
reminderEveryTurns8every N prompts while a mode is on, a one-line reminder of the modes; 0 turns it off
dispatch.subagentsDelegatetruefalse when Claude subagents spend the same quota you want to save: spawning one no longer counts as delegating, and what they read counts toward the nudge (shown to the main thread)
dispatch.quotaFile / poolRoutingnoneoptional quota table (see below)
converge.sectionHeadingDecisions Needed / 待你決定heading for decision items
converge.enforcementblocknext-turn lets a reply with label or repost slips through and hands the note to the model with the next prompt, so format fixes cost no extra turn (the auto-mode offer check always blocks)
converge.decisionLabels / tradeoffLabeloutbound payment delete permission tradeofflabels each decision must start with
converge.autoCloseCommandnulla command the model runs on its own when nothing is open, e.g. a session-closing skill

The decision-label gate reads the same file for its heading and labels; without one it accepts both the English and the Chinese label sets.

Quota-aware routing

If you track usage of external model pools, point dispatch.quotaFile at a JSON array like [{"pool":"agy","gemini_5h_used":40,"gemini_7d_used":12,"route":"open"},{"pool":"codex","5h_used":97,"7d_used":15,"route":"floor_5h","route_used":97,"route_reset_ts":1767225600,"route_reset_in":"0h45m"}]. With out on, the model then gets one line saying which pool is past its floor, worded by poolRouting, and it is repeated only when the table changes (reset times are shown in whole hours or days, so it changes at most hourly).

The line also says which pool to spend first: among the open pools with a current weekly reading (7d_reset_ts, gemini_7d_reset_ts or period_reset_ts) and under 90% used, the one furthest behind its own clock, i.e. the lowest percent used minus percent of the week already gone (the usual over-pace rule), because its quota is the likeliest to expire unused (poolRouting.prefer, with {pool}, {used}, {reset} and {pace}). A row named claude-sub is the main model's own quota and ranks with the rest; when it comes first the line uses poolRouting.claudeSoon instead, meant for sending the batch to a built-in subagent, and it stays the last fallback when the other pools fail.

Embedding in another mod

tempo.ts exports setTempoStatusSink(label => line). A mod that joins several parts into one status line can register these hooks itself and pass a function that takes the work-mode label and returns the whole line to show.

Development

./check.sh

type-checks the plugin, validates the marketplace and both plugins, and runs the plugin tests, the decision-label self-test and the gate tests. It needs tsc and the Claude Code API types (written when the plugin-authoring skill loads; or set CLAUDE_CODE_TYPES to a claude-code.d.ts).

License

MIT

Details

Author
@danyuchn
GitHub Stars
179
Sub-category
Security
License
MIT
Surfaces
terminal
Added
20 days ago
Last synced
today
Events hooked
session.startclassic.SessionStartsession.compactclassic.UserPromptSubmitcommand.runtool.callclassic.PostToolUse

Weekly Mods Digest

Top new Claude Code mods and install commands, once a week. No fluff, unsubscribe anytime.

More Mods

Claude Flightdeck
ModsSecurity

Claude Flightdeck

Live agent dashboard pane with context consumption, advisor timeline, permission verdicts, and subagent swimlanes.

Reads Files
by Sam Casella
GitHub
ModsInterface

Terminal Browser

Browse documentation, GitHub pull requests, and web pages in a split terminal pane directly beside your Claude Code conversation.

Network
by Zenbu Labs
GitHub
Agent Flow
ModsAutomation

Agent Flow

Interactive visual tree of the active session's subagents, background tasks, and teammates beside the transcript via /flow.

UI Only
by Charlie
GitHub

Command Palette

Search for a command to run...