lock

A command that limits a session to a chosen workspace, meaning a project directory or group of directories. It can also load that workspace’s CLAUDE.md file, which contains local working rules.

In plain words
What is it for?
Use it before working in a specific project or directory when you need file-scope restrictions and, where available, the project’s local instructions.
Why use it?
It reduces the risk of changing files outside the intended project area. Separate sessions can use separate workspace locks.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/baek-labs/hames/lock
Clone the repo
git clone --depth 1 https://github.com/baek-labs/hames

Made for: Claude Code.

Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 761 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.00761
Opus 5 $0.00005 $0.00380
Sonnet 5 $0.00002 $0.00152
Haiku 4.5 $0.00001 $0.00076

Measured 2d ago against content hash 73b1bb290e92, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

lock scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/lock.md · 75 lines

What it actually says

/lock

사용법: /lock <workspace>

사용자는 workspace만 고른다. 세션 키는 Hames launcher/app runtime이 자동 주입한다 (HAMES_SESSION_ID, CODEX_THREAD_ID 등). 같은 모델을 여러 창/세션으로 띄워도 각 세션의 lock은 독립적으로 적용된다.

유효한 워크스페이스 (사용자 정의):

  • Tier 1 (CLAUDE.md 보유): workspaces/<NAME>/ 아래 자체 CLAUDE.md를 둔 정식 워크스페이스. 본 표면에서는 사용자 본인의 워크스페이스 이름을 직접 사용한다.
  • Tier 2 (lock-only, CLAUDE.md 없음): 단순 편집 범위 제한만 필요한 디렉토리. CLAUDE.md 없이도 lock 가능.

범위 선택 패턴:

  • 컨테이너 전체 lock: 상위 디렉토리 이름으로 lock — 하위 자유 이동
  • 개별 프로젝트만 lock: 정확한 디렉토리 이름으로 lock — 형제 디렉토리 차단

실행 순서

Step 1 — Lock 파일 갱신

PowerShell로 lock helper를 실행합니다.

powershell -ExecutionPolicy Bypass -File arsenal/set_workspace_lock.ps1 -Workspace <입력값>

예: /lock MyDomain → 현재 HAMES_SESSION_ID에만 MyDomain lock 적용

.claude/.workspace_lock은 세션별 map을 사용한다. 기존 전역 lock 형식도 하위 호환으로 유지된다.

Step 2 — 워크스페이스 컨텍스트 로드

해당 워크스페이스의 CLAUDE.md를 읽어 로컬 규칙 적용. CLAUDE.md가 없는 Tier 2 워크스페이스는 이 단계를 스킵하고 lock-only 모드로 진행.

워크스페이스 종류 CLAUDE.md 경로
일반 워크스페이스 workspaces/<NAME>/CLAUDE.md
격리 도메인 (advanced) <DomainRoot>/CLAUDE.md (선택)
Lock-only 디렉토리 (없음 — Step 2 스킵)

Step 3 — 격리 도메인 전용 준비 (해당 시)

격리 도메인은 자체 에이전트 팀과 hook을 가진다. Lock 시 해당 도메인의 <Root>/.claude/agents/ 디렉토리를 확인. 패턴은 docs/04_workspace_model.md 참조.

Step 4 — 상태 보고

[WORKSPACE LOCK] Active: <workspace> | Lock: ON
쓰기 차단 범위: 현재 세션에서 <workspace> 외부 모든 경로
읽기: 전체 허용 (Read/Glob/Grep 무조건 통과)
SYSTEM_ADMIN 경로 (arsenal, .claude): 항상 허용
해제: "고정 해제" 입력

고정 해제

사용자가 "고정 해제", "lock 해제", "unlock" 중 하나를 입력하면:

에이전트는 아래 helper를 실행합니다.

powershell -ExecutionPolicy Bypass -File arsenal/set_workspace_lock.ps1 -Unlock

이후 현재 세션만 루트 모드로 복귀하고 상태를 보고합니다.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 75 lines · 10 tokens per session scan A 73b1bb290e92

Subscribe to this mod's changes

lock is a command published in the GitHub repository baek-labs/hames (5 stars, last pushed 1mo ago), licensed MIT. It adds 10 tokens to every session and 761 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.