Skip to main content
Build powerful CLI tools where Claude reasons in the cloud but executes commands on the user’s local machine using Possession Mode.

What You’ll Build

A CLI tool that:
  • Accepts natural language commands
  • Runs AI reasoning in Chucky’s cloud
  • Executes file operations and shell commands locally
  • Returns results to the user

Architecture

Quick Start

The simplest way is using the Chucky CLI directly:

How Possession Mode Works

When --allow-possession is enabled, Claude gets access to Host Tools that execute on the user’s machine: Claude reasons in the cloud (where your workspace context exists) but these tools execute locally.

Building a Custom CLI

Basic Implementation

With Host Tool Handlers

For tools to execute locally, you need to handle them in your CLI:

Use Cases

Code Refactoring

Bug Fixing

Code Review

Test Generation

Documentation

Security Considerations

Possession Mode gives Claude the ability to execute arbitrary commands on the user’s machine. Only use with trusted prompts and consider these safeguards:
  1. Explicit opt-in: Require --allow-possession flag
  2. Confirmation prompts: Ask before destructive operations
  3. Working directory isolation: Limit to project directory
  4. Command allowlist: Restrict which commands can run
  5. Dry-run mode: Show what would happen before executing

Example: Confirmation Flow

Applying Changes

When the AI makes file changes, they’re saved in a git bundle. Use the CLI to apply them:

Best Practices

1. Clear System Prompts

Tell Claude what it has access to:

2. Progress Feedback

Show users what’s happening:

3. Error Recovery

Handle failures gracefully:

Next Steps

Possession Mode

Deep dive into Possession Mode

Git Bundles

Managing code changes

Error Handling

Handling errors gracefully

Sessions

Multi-turn conversations