You are doing a GitHub ingest task for the second-brain wiki at `/workspace/extra/second-brain/`.

## Your job

Fetch READMEs from the following Anthropic repos and create/update wiki pages for the most relevant ones. Then update wiki/index.md and wiki/log.md.

## Repos to fetch (prioritized)

Use `curl -sL https://raw.githubusercontent.com/<repo>/main/README.md` (or `HEAD` branch) to get READMEs. If that fails try `master`.

**High priority — definitely create wiki pages:**
1. `anthropics/claude-agent-sdk-python` — Agent SDK Python
2. `anthropics/claude-agent-sdk-typescript` — Agent SDK TypeScript
3. `anthropics/claude-agent-sdk-demos` — Agent SDK demos
4. `anthropics/launch-your-agent` — Skills to take founder from idea to Claude Managed Agent
5. `anthropics/cwc-long-running-agents` — Long-running agents workshop
6. `anthropics/defending-code-reference-harness` — Security threat modeling/scanning skills
7. `anthropics/knowledge-work-plugins` — Plugins for knowledge workers
8. `anthropics/ClaudeForFoundationModels` — Claude support for Apple Foundation Models
9. `anthropics/financial-services` — Financial services toolkit

**Medium priority — create pages if content is interesting:**
10. `anthropics/claude-plugins-community` — Community plugin marketplace
11. `anthropics/claude-plugins-official` — Official Anthropic-managed plugins
12. `anthropics/claude-code-security-review` — CI/CD security review action
13. `anthropics/code-migration-kit-with-claude-code` — Migration prompts/templates

## Wiki page format

Write files to `/workspace/extra/second-brain/wiki/tools/` (for tools/SDKs) or `wiki/repos/` (for reference repos).

Each page should follow this structure:
```markdown
# [Tool/Repo Name]

- **Source**: https://github.com/anthropics/<repo>
- **Type**: [SDK / Plugin / Skill / Workshop / Tool]
- **Last updated**: 2026-07-20

## What it is
One paragraph summary.

## Key features
- bullet points

## Relevance
Why this matters to an AI-first solo developer using Claude Code, nanoclaw agents, and local LLM workflows.
```

## wiki/log.md update

Append one entry per page created:
```
- 2026-07-20 — [Page Title](path/to/page.md) ingested from anthropics/repo-name
```

Read `/workspace/extra/second-brain/wiki/log.md` and `/workspace/extra/second-brain/wiki/index.md` before writing so you can append rather than overwrite.

## Output

When done, print a summary listing:
- Pages created (filename + one-line description)
- Pages skipped (repo name + reason)
- Any fetch errors

Keep wiki pages concise — 200–400 words each. Focus on actionable "what can I use this for" content, not marketing copy.


I'll fetch the READMEs and create wiki pages. Let me start by reading the existing wiki files and fetching all READMEs in parallel.


Error: File does not exist. Note: your current working directory is /workspace/agent.


Bash

curl -sL https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/README.md 2>/dev/null | head -200

Fetch claude-agent-sdk-python README


# Claude Agent SDK for Python

Python SDK for Claude Agent. See the [Claude Agent SDK documentation](https://platform.claude.com/docs/en/agent-sdk/python) for more information.

## Installation

```bash
pip install claude-agent-sdk
```

**Prerequisites:**

- Python 3.10+

**Note:** The Claude Code CLI is automatically bundled with the package - no separate installation required! The SDK will use the bundled CLI by default. If you prefer to use a system-wide installation or a specific version, you can:

- Install Claude Code separately: `curl -fsSL https://claude.ai/install.sh | bash`
- Specify a custom path: `ClaudeAgentOptions(cli_path="/path/to/claude")`

## Quick Start

```python
import anyio
from claude_agent_sdk import query

async def main():
    async for message in query(prompt="What is 2 + 2?"):
        print(message)

anyio.run(main)
```

## Basic Usage: query()

`query()` is an async function for querying Claude Code. It returns an `AsyncIterator` of response messages. See [src/claude_agent_sdk/query.py](src/claude_agent_sdk/query.py).

```python
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock

# Simple query
async for message in query(prompt="Hello Claude"):
    if isinstance(message, AssistantMessage):
        for block in message.content:
            if isinstance(block, TextBlock):
                print(block.text)

# With options
options = ClaudeAgentOptions(
    system_prompt="You are a helpful assistant",
    max_turns=1
)

async for message in query(prompt="Tell me a joke", options=options):
    print(message)
```

### Using Tools

By default, Claude has access to the full [Claude Code toolset](https://code.claude.com/docs/en/settings#tools-available-to-claude) (Read, Write, Edit, Bash, and others). `allowed_tools` is a permission allowlist: listed tools are auto-approved, and unlisted tools fall through to `permission_mode` and `can_use_tool` for a decision. It does not remove tools from Claude's toolset. To block specific tools, use `disallowed_tools`. See the [permissions guide](https://platform.claude.com/docs/en/agent-sdk/permissions) for the full evaluation order.

```python
options = ClaudeAgentOptions(
    allowed_tools=["Read", "Write", "Bash"],  # auto-approve these tools
    permission_mode='acceptEdits'  # auto-accept file edits
)

async for message in query(
    prompt="Create a hello.py file",
    options=options
):
    # Process tool use and results
    pass
```

### Working Directory

```python
from pathlib import Path

options = ClaudeAgentOptions(
    cwd="/path/to/project"  # or Path("/path/to/project")
)
```

## ClaudeSDKClient

`ClaudeSDKClient` supports bidirectional, interactive conversations with Claude
Code. See [src/claude_agent_sdk/client.py](src/claude_agent_sdk/client.py).

Unlike `query()`, `ClaudeSDKClient` additionally enables **custom tools** and **hooks**, both of which can be defined as Python functions.

### Custom Tools (as In-Process SDK MCP Servers)

A **custom tool** is a Python function that you can offer to Claude, for Claude to invoke as needed.

Custom tools are implemented in-process MCP servers that run directly within your Python application, eliminating the need for separate processes that regular MCP servers require.

For an end-to-end example, see [MCP Calculator](examples/mcp_calculator.py).

#### Creating a Simple Tool

```python
from claude_agent_sdk import tool, create_sdk_mcp_server, ClaudeAgentOptions, ClaudeSDKClient

# Define a tool using the @tool decorator
@tool("greet", "Greet a user", {"name": str})
async def greet_user(args):
    return {
        "content": [
            {"type": "text", "text": f"Hello, {args['name']}!"}
        ]
    }

# Create an SDK MCP server
server = create_sdk_mcp_server(
    name="my-tools",
    version="1.0.0",
    tools=[greet_user]
)

# Use it with Claude. allowed_tools pre-approves the tool so it runs
# without a permission prompt; it does not control tool availability.
options = ClaudeAgentOptions(
    mcp_servers={"tools": server},
    allowed_tools=["mcp__tools__greet"]
)

async with ClaudeSDKClient(options=options) as client:
    await client.query("Greet Alice")

    # Extract and print response
    async for msg in client.receive_response():
        print(msg)
```

#### Benefits Over External MCP Servers

- **No subprocess management** - Runs in the same process as your application
- **Better performance** - No IPC overhead for tool calls
- **Simpler deployment** - Single Python process instead of multiple
- **Easier debugging** - All code runs in the same process
- **Type safety** - Direct Python function calls with type hints

#### Migration from External Servers

```python
# BEFORE: External MCP server (separate process)
options = ClaudeAgentOptions(
    mcp_servers={
        "calculator": {
            "type": "stdio",
            "command": "python",
            "args": ["-m", "calculator_server"]
        }
    }
)

# AFTER: SDK MCP server (in-process)
from my_tools import add, subtract  # Your tool functions

calculator = create_sdk_mcp_server(
    name="calculator",
    tools=[add, subtract]
)

options = ClaudeAgentOptions(
    mcp_servers={"calculator": calculator}
)
```

#### Mixed Server Support

You can use both SDK and external MCP servers together:

```python
options = ClaudeAgentOptions(
    mcp_servers={
        "internal": sdk_server,      # In-process SDK server
        "external": {                # External subprocess server
            "type": "stdio",
            "command": "external-server"
        }
    }
)
```

### Hooks

A **hook** is a Python function that the Claude Code _application_ (_not_ Claude) invokes at specific points of the Claude agent loop. Hooks can provide deterministic processing and automated feedback for Claude. Read more in [Intercept and control agent behavior with hooks](https://platform.claude.com/docs/en/agent-sdk/hooks).

For more examples, see examples/hooks.py.

#### Example

```python
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient, HookMatcher

async def check_bash_command(input_data, tool_use_id, context):
    tool_name = input_data["tool_name"]
    tool_input = input_data["tool_input"]


curl -sL https://raw.githubusercontent.com/anthropics/claude-agent-sdk-typescript/main/README.md 2>/dev/null | head -200

Fetch claude-agent-sdk-typescript README


# Claude Agent SDK

![](https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat-square) [![npm]](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk)

[npm]: https://img.shields.io/npm/v/@anthropic-ai/claude-agent-sdk.svg?style=flat-square

The Claude Agent SDK enables you to programmatically build AI agents with Claude Code's capabilities. Create autonomous agents that can understand codebases, edit files, run commands, and execute complex workflows.

**Learn more in the [official documentation](https://docs.claude.com/en/api/agent-sdk/overview)**.

## Get started

Install the Claude Agent SDK:

```sh
npm install @anthropic-ai/claude-agent-sdk
```

## Migrating from the Claude Code SDK

The Claude Code SDK is now the Claude Agent SDK. Please check out the [migration guide](https://docs.claude.com/en/docs/claude-code/sdk/migration-guide) for details on breaking changes.

## Reporting Bugs

We welcome your feedback. File a [GitHub issue](https://github.com/anthropics/claude-agent-sdk-typescript/issues) to report bugs or request features.

## Connect on Discord

Join the [Claude Developers Discord](https://anthropic.com/discord) to connect with other developers building with the Claude Agent SDK. Get help, share feedback, and discuss your projects with the community.

## Data collection, usage, and retention

When you use the Claude Agent SDK, we collect feedback, which includes usage data (such as code acceptance or rejections), associated conversation data, and user feedback submitted via the /bug command.

### How we use your data

See our [data usage policies](https://docs.anthropic.com/en/docs/claude-code/data-usage).

### Privacy safeguards

We have implemented several safeguards to protect your data, including limited retention periods for sensitive information, restricted access to user session data, and clear policies against using feedback for model training.

For full details, please review our [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms) and [Privacy Policy](https://www.anthropic.com/legal/privacy).

## License and terms

Use of this SDK is governed by Anthropic's [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), including when you use it to power products and services that you make available to your own customers and end users, except to the extent a specific component or dependency is covered by a different license as indicated in that component's LICENSE file.


curl -sL https://raw.githubusercontent.com/anthropics/claude-agent-sdk-demos/main/README.md 2>/dev/null | head -200

Fetch claude-agent-sdk-demos README


# Claude Agent SDK Demos

> ⚠ **IMPORTANT**: These are demo applications by Anthropic. They are intended for local development only and should NOT be deployed to production or used at scale.

This repository contains multiple demonstrations of the [Claude Agent SDK](https://platform.claude.com/docs/en/agent-sdk/overview), showcasing different ways to build AI-powered applications with Claude.

## Available Demos

### 📧 [Email Agent](./email-agent)
An in-development IMAP email assistant that can:
- Display your inbox
- Perform agentic search to find emails
- Provide AI-powered email assistance

### 📊 [Excel Demo](./excel-demo)
Demonstrations of working with spreadsheets and Excel files using Claude.

### 👋 [Hello World](./hello-world)
A simple getting-started example to help you understand the basics of the Claude Agent SDK.

### 🔄 [Hello World V2](./hello-world-v2)
Examples for the V2 Session API (`unstable_v2_*`): separate `send()`/`stream()` instead of a single `query()` generator, with multi-turn conversation and session persistence patterns.

### 🔬 [Research Agent](./research-agent)
A multi-agent research system that coordinates specialized subagents to research topics and generate comprehensive reports:
- Breaks research requests into subtopics
- Spawns parallel researcher agents to search the web
- Synthesizes findings into detailed reports
- Demonstrates detailed subagent activity tracking

### 🎨 [AskUserQuestion Previews](./ask-user-question-previews)
A branding assistant that renders AskUserQuestion options as visual HTML preview cards instead of plain text labels:
- Opts in to `previewFormat: "html"` so each option includes a styled HTML mockup
- Round-trips questions from the SDK's `canUseTool` callback to a browser over WebSocket
- Demonstrates plan mode steering Claude toward clarifying questions before acting

### 💬 [Simple Chat App](./simple-chatapp)
A React + Express chat UI backed by the SDK, showing a full conversation loop over WebSocket with streaming responses.

### 📄 [Resume Generator](./resume-generator)
Generates a one-page `.docx` resume by web-searching a person's name (LinkedIn, GitHub, news) and assembling the findings.

## Quick Start

Each demo has its own directory with dedicated setup instructions. Navigate to the specific demo folder and follow its README for setup and usage details.

## Prerequisites

- [Bun](https://bun.sh) runtime (or Node.js 18+)
- An Anthropic API key ([get one here](https://console.anthropic.com))

## Getting Started

1. **Clone the repository**
```bash
git clone https://github.com/anthropics/claude-agent-sdk-demos.git
cd claude-agent-sdk-demos
```

2. **Choose a demo and navigate to its directory**
```bash
cd email-agent  # or excel-demo, or hello-world
```

3. **Follow the demo-specific README** for setup and usage instructions

## Resources

- [Claude Agent SDK Documentation](https://platform.claude.com/docs/en/agent-sdk)
- [API Reference](https://platform.claude.com/docs/en/agent-sdk/api-reference)
- [GitHub Issues](https://github.com/anthropics/claude-agent-sdk-demos/issues)

## Support

These are demo applications provided as-is. For issues related to:
- **Claude Agent SDK**: [SDK Documentation](https://platform.claude.com/docs/en/agent-sdk)
- **Demo Issues**: [GitHub Issues](https://github.com/anthropics/sdk-demos/issues)
- **API Questions**: [Anthropic Support](https://support.anthropic.com)

## License

MIT - This is sample code for demonstration purposes.


curl -sL https://raw.githubusercontent.com/anthropics/launch-your-agent/main/README.md 2>/dev/null | head -200

Fetch launch-your-agent README


<!-- Copyright 2026 Anthropic PBC -->
<!-- SPDX-License-Identifier: Apache-2.0 -->

# launch-your-agent

A [Claude Code](https://code.claude.com) skill that helps a technical founder build whatever they want on **Claude Managed Agents (CMA)** — an internal worker, a piece of their product, a customer-facing agent. It interviews you about what you want to build, scopes a v0, launches it in your own account, grades it against your own definition of done, iterates, and (if it should run on a clock) puts it on a scheduled deployment — with everything bigger laid out as an explicit v1/v2 plan.

> Reference implementation. Not maintained and not accepting contributions. Licensed under [Apache 2.0](./LICENSE).
>
> This is an educational skill that walks you through composing managed-agent primitives to solve your problem. Because it explains each step, it's more token-intensive than a purpose-built agent would be.

## Quickstart

```bash
git clone https://github.com/anthropics/launch-your-agent.git
cd launch-your-agent
claude
```

Then type:

```
/launch-your-agent
```

The skills in `.claude/skills/` are picked up automatically when you run Claude Code inside this folder — nothing to install.

When you're done (or any time later), `/wrap-up` refreshes the overview page, recaps every primitive you now own, and suggests the next 1–2 upgrades.

## What you need

- Claude Code installed and signed in.
- An Anthropic API key for **your own** account (you'll create it during the flow at platform.claude.com → API keys; it goes into a local `.env` file, never into the chat). Runs cost cents.

## What you walk away with

- A live managed agent in your Console (agent + environment + graded run, plus a scheduled deployment if your task recurs).
- A `my-agent/` folder: the build sheet, the exact API payloads, a resumable launch script, an eval scaffold, an overview page, and a NEXT-DIRECTIONS.md laying out v1/v2.

## Repo layout

| Path | What it is |
|---|---|
| `.claude/skills/launch-your-agent/` | The main skill: 4 phases (interview → stage & launch → grade & iterate → run without you) + references (interview mapping, verified API call shapes, examples bank, overview template) |
| `.claude/skills/wrap-up/` | Companion skill: explicit close-out / status check for a built agent |
| `cma-primitives.md` | Inventory of CMA primitives and limits, from the public docs |
| `interview-to-config.md` | Background: how interview answers map to CMA primitives |
| `examples-bank.md` | Sourced example agents and production proof points |
| `ui/` | Example overview page + build sheet |

The CMA documentation is the source of truth for the API: https://platform.claude.com/docs/en/managed-agents/overview


curl -sL https://raw.githubusercontent.com/anthropics/cwc-long-running-agents/main/README.md 2>/dev/null | head -200

Fetch cwc-long-running-agents README


# Harness Primitives for Long-Running Claude Agents

Claude Code's built-in [`/goal`](https://code.claude.com/docs/en/goal) command gives you a generator/evaluator loop out of the box: set a completion condition and a separate fast model checks it after every turn until it's met. This repo ships the same underlying primitives as short, readable [hooks](https://code.claude.com/docs/en/hooks) and a [subagent](https://code.claude.com/docs/en/sub-agents), so you can see how each mechanism works and assemble a harness tuned to your project. The patterns come from [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) (Nov 2025) and [Harness Design for Long-Running Application Development](https://www.anthropic.com/engineering/harness-design-long-running-apps) (Mar 2026). We recommend trying both the in-product features and a custom harness to see which fits your workflow.

| | In-product | Custom harness (this repo) |
|---|---|---|
| **What runs the loop** | [`/goal`](https://code.claude.com/docs/en/goal) | the [primitives below](#the-quality-loop) + a [loop you write](#running-the-loop) |
| **Who judges "done"** | a separate fast model checking your condition | your [`agents/evaluator.md`](./claude-code-config/.claude/agents/evaluator.md) with your prompt |
| **Where it works** | Claude Code interactive, [`-p`](https://code.claude.com/docs/en/headless), Remote Control | Claude Code, headless, or [Agent SDK](https://docs.claude.com/en/docs/claude-code/sdk) |

Three primitives form the quality loop:

- **Default-FAIL contract.** Every criterion starts `false`; the agent can't mark it passing without opening evidence first.
- **Fresh-context evaluator.** A separate agent with no Write/Edit tools grades the work from a context window that never saw the build.
- **Agent-maintained handoff.** The agent writes its own progress notes and commits to git so the next session picks up cleanly.

Two more operator-control hooks are included for when you want to watch or intervene. The same patterns translate directly to `PreToolUse`/`Stop` callbacks in the [Agent SDK](https://docs.claude.com/en/docs/claude-code/sdk).

> Built as the take-home for the Long-Running Agents station at Code with Claude 2026. **These are example ingredients, not a turnkey harness.** Event demo; not maintained and not accepting contributions.

## How to use this repo

**Read and cherry-pick.** Each primitive is one standalone file with no dependency on the others. The [quality-loop table](#the-quality-loop) below maps every one to its example here and its Agent SDK equivalent. Open the file, see how the mechanism works, copy what fits.

**Or copy all of them as a starting point.** In your project, run `claude` and paste:

> Clone github.com/anthropics/cwc-long-running-agents into /tmp, copy its `claude-code-config/.claude/` directory into this project's root, make the hook scripts executable, then walk me through what each hook and the evaluator subagent does and what I'll need to adapt for this project.

or do it yourself:

```bash
cp -r claude-code-config/.claude /path/to/your/project/
chmod +x /path/to/your/project/.claude/hooks/*.sh
```

Either way, this gives you all the examples wired into `.claude/` at once. Before relying on them: point `RESULTS_FILE` at your project's actual results file, adjust the evidence-file pattern in `track-read.sh`, and run `claude` from the directory that contains `.claude/` (hooks are not loaded when launching from a subdirectory).

**If you're on the Agent SDK,** this repo is a pattern reference. The shell hooks here translate one-to-one to `PreToolUse`/`Stop` callbacks. To scaffold an SDK agent from inside Claude Code, install the [`agent-sdk-dev` plugin](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/agent-sdk-dev) and ask Claude to build an agent that implements whichever of these primitives you want. For a hand-written starting point, see the [autonomous-coding quickstart](https://github.com/anthropics/claude-quickstarts/tree/main/autonomous-coding) or the [agent-sdk-workshop](https://github.com/anthropics/agent-sdk-workshop) curriculum.

## The quality loop

| Primitive | Claude Code example | Agent SDK equivalent | Enforcement |
|---|---|---|---|
| **Default-FAIL contract** | [`hooks/track-read.sh`](./claude-code-config/.claude/hooks/track-read.sh) + [`hooks/verify-gate.sh`](./claude-code-config/.claude/hooks/verify-gate.sh) | `PreToolUse` callback | hook |
| **Fresh-context evaluator** | [`agents/evaluator.md`](./claude-code-config/.claude/agents/evaluator.md) subagent (no Write/Edit) | [`evaluator_optimizer.ipynb`](https://github.com/anthropics/claude-cookbooks/blob/main/patterns/agents/evaluator_optimizer.ipynb) | you invoke it |
| **Agent-maintained handoff** | [`CLAUDE.md`](./claude-code-config/.claude/CLAUDE.md) + [`hooks/commit-on-stop.sh`](./claude-code-config/.claude/hooks/commit-on-stop.sh) | system prompt + `Stop` callback | convention + hook backstop |

### Default-FAIL contract

Agents will mark a feature "passing" after a unit test or a curl when the UI is visibly broken. Asking nicely in the prompt doesn't reliably stop this. The harness makes "done" structural. Every feature is a row in a `test-results.json` file you create in your project:

```json
{ "feature-1": { "passes": false }, "feature-2": { "passes": false } }
```

The only evidence that counts is a file matching the patterns in `track-read.sh` (screenshots, console logs, result files), and a `PreToolUse` hook denies any write to the results file unless the agent has first opened one with the Read tool. The agent can't claim success it hasn't observed. (The shipped hook is intentionally simple; see the comments in `verify-gate.sh` for the gaps a production version would close.)

### Fresh-context evaluator

The builder shouldn't grade its own work. After each feature, you (or your wrapper script) invoke a separate subagent (`agents/evaluator.md`) with no Write/Edit tools that reviews the diff and the screenshots from a context window that never saw the build, then returns `PASS` or `NEEDS_WORK` with specific findings. On `NEEDS_WORK` the findings become the next builder session's starting prompt, closing the build/evaluate/rebuild loop. Invoke it from your wrapper with `claude --agent evaluator -p "<review prompt>"`; what your loop does with the verdict is up to you.

### Agent-maintained handoff

A fresh session has no memory of what the previous one did, and when a long session fills its context window Claude Code summarizes the history, which loses detail. So the agent maintains the handoff itself: it scopes each session to one feature, writes to a structured `PROGRESS.md` as it works and re-reads it first thing on every restart, and `git add`s and commits at meaningful checkpoints so `git log` is a second record. `commit-on-stop.sh` is the backstop that catches whatever's still uncommitted at session end. This is the layer most sensitive to model capability; newer models drift less and self-scope better, so re-evaluate how much of `CLAUDE.md` you still need after each model release (see [Re-simplify on model upgrades](#going-further)).

A fourth core piece, a **rubric for subjective work**, isn't shipped here because it's project-specific; see [Going further](#going-further) for how to add one to the evaluator.

## Running the loop

Two ways to keep the build → evaluate → rebuild cycle going. `/goal` is built into Claude Code and works with or without this repo's primitives; the second path wires the contract file and your own `evaluator.md` directly into the loop.

### `/goal`: built-in completion checker

```
/goal every feature in PROGRESS.md is implemented, committed, and its tests pass
```

After every turn a separate fast model checks the condition and keeps the session going until it's met. One line, no contract file or hooks. Works the same in interactive Claude Code, [`claude -p`](https://code.claude.com/docs/en/headless), and Remote Control. See the docs for [writing an effective condition](https://code.claude.com/docs/en/goal#write-an-effective-condition) and how `/goal` [compares to `/loop` and Stop hooks](https://code.claude.com/docs/en/goal#compare-to-other-autonomous-workflows).

### Your `evaluator.md` as the gate

When you want the default-FAIL contract (`test-results.json` + `verify-gate`) enforcing evidence and your own evaluator prompt deciding `PASS`/`NEEDS_WORK`, the loop lives in your code. How depends on where you're running:

| Surface | How |
|---|---|
| **Claude Code** | custom [Stop hook](https://code.claude.com/docs/en/hooks#stop) runs the evaluator as a fresh `claude` process after each turn and blocks on anything but `PASS` |
| **Headless** ([`claude -p`](https://code.claude.com/docs/en/headless)) | wrapper script calls `claude --agent evaluator -p` between builds (example below) |
| [**Agent SDK**](https://docs.claude.com/en/docs/claude-code/sdk) | separate generator and evaluator `query()` calls; see [`evaluator_optimizer`](https://github.com/anthropics/claude-cookbooks/blob/main/patterns/agents/evaluator_optimizer.ipynb) |

```bash
while grep -q '"passes": false' test-results.json; do
  claude -p "Read PROGRESS.md and build the next unfinished feature per CLAUDE.md."
  VERDICT=$(claude --agent evaluator -p "Review the most recent commit against its spec.")
  [ "$(echo "$VERDICT" | head -1)" = "PASS" ] || echo "$VERDICT" > NEXT_FINDINGS.md
done
```

Each pass is a fresh context. Exit when the contract file has nothing left failing, a cycle makes no changes, or a budget is hit; `touch AGENT_STOP` to stop early. The builder writes `test-results.json` (verify-gate enforces evidence-read first) and the evaluator returns a separate verdict; have your wrapper write the contract on `PASS` instead if you want "all true" to mean "independently confirmed."

## Operator controls

Two more hooks for when you want to watch the loop run or intervene mid-stream:

| Hook | What it does |
|---|---|
| [`hooks/kill-switch.sh`](./claude-code-config/.claude/hooks/kill-switch.sh) | Halts every tool call while an `AGENT_STOP` file exists at the project root. |
| [`hooks/steer.sh`](./claude-code-config/.claude/hooks/steer.sh) | Surfaces the contents of `STEER.md` (project root) to the agent once and clears it, so you can redirect mid-run without restarting. |

## Watching it work

Everything the agent does lands on disk, so you can observe a long run from a terminal without any dashboard code:

```bash
watch -n 2 'tail -20 PROGRESS.md'                          # its own notes
watch -n 5 'git log --oneline -8'                          # work saved
watch -n 5 'find screenshots -name "*.png" | tail -5'      # what it sees
watch -n 2 'wc -l < .claude/.evidence-reads 2>/dev/null'   # evidence reads (resets to 0 after each gated write)
```

Run them in a `tmux` grid and you have a live view of every primitive.

## Going further

The next layer of patterns, each covered in depth in [Harness Design for Long-Running Application Development](https://www.anthropic.com/engineering/harness-design-long-running-apps):

| Pattern | What it adds | Reference |
|---|---|---|
| **Unattended loop** | Cap session length and have an outer script start the next one (pick next feature, build, evaluate, reset) | [Why naive implementations fall short](https://www.anthropic.com/engineering/harness-design-long-running-apps#why-naive-implementations-fall-short); [`ralph-loop`](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/ralph-loop) plugin |
| **Planner agent** | A first session that expands a one-line ask into a `BUILD_PLAN.md` the loop then runs against | [The architecture](https://www.anthropic.com/engineering/harness-design-long-running-apps#the-architecture) |
| **Sprint contracts** | Builder and evaluator agree per-feature on what "done" means and write it to a file the hook enforces | [The architecture](https://www.anthropic.com/engineering/harness-design-long-running-apps#the-architecture) and [Removing the sprint construct](https://www.anthropic.com/engineering/harness-design-long-running-apps#removing-the-sprint-construct) |
| **Grading rubrics** | Give the evaluator scoring principles (functionality, design, craft, originality) with few-shot examples instead of binary pass/fail | [Frontend design: making subjective quality gradable](https://www.anthropic.com/engineering/harness-design-long-running-apps#frontend-design-making-subjective-quality-gradable); [`frontend-design`](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/frontend-design) plugin |
| **Browser-verified evaluator** | Let the evaluator open the running app itself instead of trusting the builder's screenshots | [Frontend design](https://www.anthropic.com/engineering/harness-design-long-running-apps#frontend-design-making-subjective-quality-gradable) (Playwright MCP usage); add [`@playwright/mcp`](https://github.com/microsoft/playwright-mcp) or Claude in Chrome to `tools:` in `agents/evaluator.md` |
| **Re-simplify on model upgrades** | After each model release, comment out harness pieces one at a time and see what's still load-bearing | [What comes next](https://www.anthropic.com/engineering/harness-design-long-running-apps#what-comes-next); [Harnessing Claude's Intelligence](https://claude.com/blog/harnessing-claudes-intelligence) |
| **Hosted runtime** | Anthropic hosts the loop, sandbox, and scheduling so you don't run any of this yourself | [Claude Managed Agents](https://docs.claude.com/en/docs/managed-agents) |

---


curl -sL https://raw.githubusercontent.com/anthropics/defending-code-reference-harness/main/README.md 2>/dev/null | head -200

Fetch defending-code-reference-harness README


# Defending Code Reference Harness

A reference implementation for autonomous vulnerability discovery and
remediation with Claude, based on our learnings from [partnering with security
teams at several organizations](https://www.anthropic.com/glasswing)
since launching Claude Mythos Preview. For a write up of these learnings along with
best practices, see the [accompanying blog post](https://claude.com/blog/using-llms-to-secure-source-code)
(also available in [`blog-post.md`](docs/blog-post.md)). For a lightweight SDK-only
walkthrough of the same recon → find → triage → report → patch loop, see the
[companion cookbook](https://platform.claude.com/cookbook/claude-agent-sdk-06-the-vulnerability-detection-agent).

This repo is not maintained and is not accepting contributions.

> 🔒 **Want a managed option?** Anthropic offers
> [Claude Security](https://claude.com/product/claude-security), a hosted product
> that finds and fixes vulnerabilities in your source code across multiple
> projects. Claude Security scans your repository for vulnerabilities,
> applies a multi-stage verification pipeline to reduce false positives, and
> lets you manage findings through their lifecycle: triage, fix validation,
> and rapid fix generation.
>
> This repository is an open-source reference implementation based on general
> best practices for finding vulnerabilities using Claude. You can use it to
> build your own vulnerability finding pipeline, customize the logic, and it
> can be used with whatever access you have to Claude APIs (including
> Bedrock, Vertex, or Azure).

## Contents

- **Claude Code skills**: `/quickstart`, `/threat-model`, `/vuln-scan`,
  `/triage`, `/patch`, `/customize`: interactive scoping, scanning, triage,
  and patching. Open this repo in Claude Code and run `/quickstart` to get
  oriented.
- **`harness/`**: the autonomous reference pipeline (recon → find → verify
  → report → patch), configured for finding C/C++ memory vulnerabilities
  using Docker and ASAN. This harness is a **reference, not a product**.
  The general shape, prompts, and sandboxing are reusable, but the harness
  will not work on every codebase out of the box. Run `/customize` to port it
  to your language, detector, or vuln class.
- **Detection & response**: the `/dnr-hunt` and `/dnr-respond` skills plus
  `dnr_harness/`, their autonomous mirror (`dnr-pipeline`). Everything else
  in this repo is preventive; this track assumes an attacker is already in
  the logs — hunt the corpus, scope the damage, and propose a response.
  Demo target: `targets/dnrcanary/`. See
  [docs/detection-response.md](docs/detection-response.md).

> ⚠ **Security:** `/quickstart`, `/threat-model`, `/vuln-scan`, and `/triage`
> only read and write files. Running `/patch` on static findings (`TRIAGE.json`
> or `VULN-FINDINGS.json`) is likewise read- and write-only. `/customize` edits
> the harness code and runs validation commands. Any of these skills are safe to
> run unsandboxed, as long as you review and approve each tool use in Claude Code.
> The autonomous pipelines (`vuln-pipeline`, `dnr-pipeline`, and `/patch` on
> pipeline results) **execute target code**, so they refuse to run outside of
> a gVisor sandbox
> unless explicitly overridden. To get set up, run `scripts/setup_sandbox.sh` once,
> then invoke the pipeline via `bin/vp-sandboxed`. The detection & response
> skills (`/dnr-hunt`, `/dnr-respond`) additionally run the demo app on
> `127.0.0.1` to verify PoCs. See [docs/security.md](docs/security.md)
> and [docs/agent-sandbox.md](docs/agent-sandbox.md) for more details.

## Getting Started

```bash
git clone https://github.com/anthropics/defending-code-reference-harness
cd defending-code-reference-harness
claude

# 30-sec intro + guided first run on the canary target
> /quickstart

> /quickstart how do I port the pipeline to Java?
> /quickstart how do I triage all these bugs?
```

## Further Reading

- [**Blog Post**](docs/blog-post.md) · The accompanying blog post with learnings + best practices
- [**Pipeline**](docs/pipeline.md) · How it works: diagram, stages, CLI flags
- [**Security**](docs/security.md) · Sandboxing, what not to mount
- [**Agent sandbox**](docs/agent-sandbox.md) · gVisor isolation + egress allowlist for every agent
- [**Best practices**](docs/best-practices.md) · Field-tested principles: verification, severity, iteration, large codebases
- [**Prompting**](docs/prompting.md) · Prompting the model for defensive security tasks
- [**Threat model**](docs/threat-model.md) · Why a threat model cuts false positives, and the `/threat-model` skill
- [**Detection & response**](docs/detection-response.md) · Hunting an attacker already in the logs; the D&R skills and pipeline
- [**Customize**](docs/customizing.md) · Port to my stack; which files change and why
- [**Patching**](docs/patching.md) · Generate and verify fixes for verified crashes
- [**Other use cases**](docs/other-use-cases.md) · Binary analysis, embedded, bug chains, threat intel
- [**Troubleshooting**](docs/troubleshooting.md) · Duplicates, rate limits, subagent model pinning
- [**Safeguards**](https://support.claude.com/en/articles/14604842-real-time-cyber-safeguards-on-claude) · Block for dangerous cyber work

---

## Ramp Up

The most successful security teams we've partnered with are those
that have gotten hands-on the fastest. Though it's tempting to
spend months designing the perfect pipeline, we recommend starting
small on Day 1 and building from there as learnings come. The
steps below follow that pattern and set an ambitious (but reasonable)
pace based on what we've seen.

|                                                                                |              |                                                              |
|-------------------------------------------------------------------------------------|--------------|--------------------------------------------------------------|
| [Step 1](#step-1-day-1-build-a-threat-model-and-run-your-first-static-scan--triage) | **Day 1**    | Build a threat model and run your first static scan + triage |
| [Step 2](#step-2-day-2-run-the-reference-pipeline-on-a-cc-library)                  | **Day 2**    | Run the reference pipeline on a C/C++ library                |
| [Step 3](#step-3-days-3-5-customize-the-pipeline-for-your-target)                   | **Days 3-5** | Customize the pipeline for your target                       |
| [Step 4](#step-4-week-2-start-autonomous-scanning-triage-and-patching)              | **Week 2**   | Start autonomous scanning, triage, and patching              |
| [Step 5](#step-5-optional-detection--response)                                      | **Optional** | Hunt a planted campaign in logs (detection & response)       |

### Step 1 (Day 1): Build a threat model and run your first static scan + triage

Day 1 is focused on seeing the whole loop end-to-end. Using only the
interactive skills, you'll build a threat model, run a static scan scoped
by it, triage what comes back, and draft candidate fixes. You'll finish
the day with a threat model, a ranked list of static findings, and candidate
patches.

The relevant skills **only read and write files** in your repo. As long as you
run Claude Code interactively and approve each tool use, no sandbox is needed.

```bash
# Pin every subagent to the model you want
export CLAUDE_CODE_SUBAGENT_MODEL=<model-id>
claude

# 0. intro + guided first run
> /quickstart

# 1. Build a threat model (aim before you shoot)
> /threat-model bootstrap targets/canary

# 2. Run a static scan, scoped by that threat model
> /vuln-scan targets/canary

# 3. Verify, dedupe, and rank what came back
> /triage targets/canary/VULN-FINDINGS.json

# 4. Generate candidate fixes for the verified findings
> /patch ./TRIAGE.json --repo targets/canary
```

This flow produces `THREAT_MODEL.md`, `VULN-FINDINGS.{json,md}`,
`TRIAGE.{json,md}`, and `PATCHES/`.

The vulnerability candidates produced in Step 1 come from Claude's static
review of the source (nothing is built or run), so expect more false positives on
any non-canary targets. In Step 2, you'll produce *execution-verified* findings.

> **Note:** on the canary target, `/triage` may dismiss the scan's findings
> as false positives. `entry.c` announces itself as deliberately vulnerable
> demo code, and `/triage` correctly excludes bugs in test / fixture code.
> To see the full confirm / dedupe / false positive flow, run it on the
> curated fixture instead (`/triage .claude/skills/triage/fixtures/canary-findings.json
> --repo targets/canary`) or point the Step 1 skills at your own code.

### Step 2 (Day 2): Run the reference pipeline on a C/C++ library

On Day 2, you'll move from interactive skills to your first autonomous
run using the reference pipeline. You'll run the full recon → find →
verify → report loop in your environment on a known-vulnerable open-source
library, then generate a candidate patch for what it finds. You'll finish
with a set of reproducible crashes, exploitability reports, and candidate patches,
along with a feel for how the pipeline works.

Running the pipeline is simple:

```bash
# One-time setup
python3 -m venv .venv && .venv/bin/pip install -e .
./scripts/setup_sandbox.sh   # installs gVisor, builds the agent images, and verifies isolation; note: requires Docker
export ANTHROPIC_API_KEY=sk-ant-...   # or CLAUDE_CODE_OAUTH_TOKEN, or Bedrock — see docs/agent-sandbox.md

# Run the recon → find → verify → report loop
bin/vp-sandboxed run drlibs --model <model-id> --runs 3 --parallel --stream --auto-focus
# Generate a candidate patch for each finding
bin/vp-sandboxed patch results/drlibs/<timestamp>/ --model <model-id>

# Or, ask Claude Code to launch the pipeline and watch the run for you
claude
> run the pipeline on drlibs and explain findings as they come
```

Results from the loop land in a `results/drlibs/<timestamp>/` directory. With
the `--stream` flag, the first report will appear in minutes under `reports/bug_NN/`.

> ⚠ **`run` spawns autonomous agents.** The pipeline runs each agent
> inside a gVisor container with egress restricted to the Claude API.
> Agent-spawning subcommands refuse to start outside it unless explicitly
> overridden. For more information, see [docs/security.md](docs/security.md)
> and [docs/agent-sandbox.md](docs/agent-sandbox.md).

Under the hood, the pipeline walks through seven stages:

1. **Build**: Compiles the target into a Docker image with ASAN (the memory
error detector for C and C++). The pipeline builds this image automatically
on first run using the target's `Dockerfile`.
2. **Recon**: A lightweight agent reads the source inside a network-isolated
container and proposes a partition, i.e., *"here are N distinct input-parsing
subsystems worth attacking separately"*, so that parallel find agents explore
different areas instead of converging on the same bug. Without the `--auto-focus`


curl -sL https://raw.githubusercontent.com/anthropics/knowledge-work-plugins/main/README.md 2>/dev/null | head -200

Fetch knowledge-work-plugins README


# Knowledge Work Plugins

Plugins that turn Claude into a specialist for your role, team, and company. Built for [Claude Cowork](https://claude.com/product/cowork), also compatible with [Claude Code](https://claude.com/product/claude-code).

## Why Plugins

Cowork lets you set the goal and Claude delivers finished, professional work. Plugins let you go further: tell Claude how you like work done, which tools and data to pull from, how to handle critical workflows, and what slash commands to expose — so your team gets better and more consistent outcomes.

Each plugin bundles the skills, connectors, slash commands, and sub-agents for a specific job function. Out of the box, they give Claude a strong starting point for helping anyone in that role. The real power comes when you customize them for your company — your tools, your terminology, your processes — so Claude works like it was built for your team.

## Plugin Marketplace

We're open-sourcing 11 plugins built and inspired by our own work:

| Plugin | How it helps | Connectors |
|--------|-------------|------------|
| **[productivity](./productivity)** | Manage tasks, calendars, daily workflows, and personal context so you spend less time repeating yourself. | Slack, Notion, Asana, Linear, Jira, Monday, ClickUp, Microsoft 365 |
| **[sales](./sales)** | Research prospects, prep for calls, review your pipeline, draft outreach, and build competitive battlecards. | Slack, HubSpot, Close, Clay, ZoomInfo, Notion, Jira, Fireflies, Microsoft 365 |
| **[customer-support](./customer-support)** | Triage tickets, draft responses, package escalations, research customer context, and turn resolved issues into knowledge base articles. | Slack, Intercom, HubSpot, Guru, Jira, Notion, Microsoft 365 |
| **[product-management](./product-management)** | Write specs, plan roadmaps, synthesize user research, keep stakeholders updated, and track the competitive landscape. | Slack, Linear, Asana, Monday, ClickUp, Jira, Notion, Figma, Amplitude, Pendo, Intercom, Fireflies |
| **[marketing](./marketing)** | Draft content, plan campaigns, enforce brand voice, brief on competitors, and report on performance across channels. | Slack, Canva, Figma, HubSpot, Amplitude, Notion, Ahrefs, SimilarWeb, Klaviyo |
| **[legal](./legal)** | Review contracts, triage NDAs, navigate compliance, assess risk, prep for meetings, and draft templated responses. | Slack, Box, Egnyte, Jira, Microsoft 365 |
| **[finance](./finance)** | Prep journal entries, reconcile accounts, generate financial statements, analyze variances, manage close, and support audits. | Snowflake, Databricks, BigQuery, Slack, Microsoft 365 |
| **[data](./data)** | Query, visualize, and interpret datasets — write SQL, run statistical analysis, build dashboards, and validate your work before sharing. | Snowflake, Databricks, BigQuery, Definite, Hex, Amplitude, Jira |
| **[enterprise-search](./enterprise-search)** | Find anything across email, chat, docs, and wikis — one query across all your company's tools. | Slack, Notion, Guru, Jira, Asana, Microsoft 365 |
| **[bio-research](./bio-research)** | Connect to preclinical research tools and databases (literature search, genomics analysis, target prioritization) to accelerate early-stage life sciences R&D. | PubMed, BioRender, bioRxiv, ClinicalTrials.gov, ChEMBL, Synapse, Wiley, Owkin, Open Targets, Benchling |
| **[cowork-plugin-management](./cowork-plugin-management)** | Create new plugins or customize existing ones for your organization's specific tools and workflows. | — |

Install these directly from Cowork, browse the full collection here on GitHub, or build your own.

## Getting Started

### Cowork

Install plugins from [claude.com/plugins](https://claude.com/plugins/).

### Claude Code

```bash
# Add the marketplace first
claude plugin marketplace add anthropics/knowledge-work-plugins

# Then install a specific plugin
claude plugin install sales@knowledge-work-plugins
```

Once installed, plugins activate automatically. Skills fire when relevant, and slash commands are available in your session (e.g., `/sales:call-prep`, `/data:write-query`).

## How Plugins Work

Every plugin follows the same structure:

```
plugin-name/
├── .claude-plugin/plugin.json   # Manifest
├── .mcp.json                    # Tool connections
├── commands/                    # Slash commands you invoke explicitly
└── skills/                      # Domain knowledge Claude draws on automatically
```

- **Skills** encode the domain expertise, best practices, and step-by-step workflows Claude needs to give you useful help. Claude draws on them automatically when relevant.
- **Commands** are explicit actions you trigger (e.g., `/finance:reconciliation`, `/product-management:write-spec`).
- **Connectors** wire Claude to the external tools your role depends on — CRMs, project trackers, data warehouses, design tools, and more — via [MCP servers](https://modelcontextprotocol.io/).

Every component is file-based — markdown and JSON, no code, no infrastructure, no build steps.

## Making Them Yours

These plugins are generic starting points. They become much more useful when you customize them for how your company actually works:

- **Swap connectors** — Edit `.mcp.json` to point at your specific tool stack.
- **Add company context** — Drop your terminology, org structure, and processes into skill files so Claude understands your world.
- **Adjust workflows** — Modify skill instructions to match how your team actually does things, not how a textbook says to.
- **Build new plugins** — Use the `cowork-plugin-management` plugin or follow the structure above to create plugins for roles and workflows we haven't covered yet.

As your team builds and shares plugins, Claude becomes a cross-functional expert. The context you define gets baked into every relevant interaction, so leaders and admins can spend less time enforcing processes and more time improving them.

## Contributing

Plugins are just markdown files. Fork the repo, make your changes, and submit a PR.


curl -sL https://raw.githubusercontent.com/anthropics/ClaudeForFoundationModels/main/README.md 2>/dev/null | head -200

Fetch ClaudeForFoundationModels README


curl -sL https://raw.githubusercontent.com/anthropics/financial-services/main/README.md 2>/dev/null | head -200

Fetch financial-services README


# Claude for Foundation Models

Use Claude as a server-side language model through Apple's [Foundation Models](https://developer.apple.com/documentation/foundationmodels) framework. The package conforms Claude to the framework's `LanguageModel` protocol, so you drive it with the same `LanguageModelSession` API you use for Apple's on-device model — `respond(to:)`, streaming, guided generation, and tool calling all work the same way.

> **Beta.** This package targets the Foundation Models server-side language model API introduced in the OS 27 betas. APIs may change before general availability.

## Contents

- [Requirements](#requirements)
- [Installation](#installation)
- [Quick start](#quick-start)
- [Example](#example)
- [Choosing a model](#choosing-a-model)
- [Authentication](#authentication)
- [Streaming](#streaming)
- [Structured output](#structured-output)
- [Server-side tools](#server-side-tools)
- [Error handling](#error-handling)
- [What this package provides](#what-this-package-provides)
- [Support](#support)
- [License](#license)

## Requirements

- iOS 27, macOS 27, visionOS 27, or watchOS 27 (beta) — the OS releases whose Foundation Models framework supports server-side language models.
- Xcode 27 (beta).
- An Anthropic API key for development. See [Authentication](#authentication) for production options.

## Installation

Add the package to your `Package.swift`:

```swift
dependencies: [
  .package(url: "https://github.com/anthropics/ClaudeForFoundationModels.git", from: "0.1.0")
]
```

Or in Xcode: **File ▸ Add Package Dependencies…** and enter the repository URL.

Then add `ClaudeForFoundationModels` to your target's dependencies and import it alongside `FoundationModels`:

```swift
import FoundationModels
import ClaudeForFoundationModels
```

## Quick start

```swift
import FoundationModels
import ClaudeForFoundationModels

let model = ClaudeLanguageModel(
  name: .sonnet5,
  auth: .apiKey(ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"] ?? "")
)

let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "Plan a 4-day trip to Buenos Aires.")
print(response.content)
```

`ClaudeLanguageModel` is the entry point. Pass it to `LanguageModelSession` and use the session exactly as you would with any Foundation Models provider.

## Example

[`Examples/ClaudeExample`](Examples/ClaudeExample) is a runnable command-line target that streams one chat turn through `LanguageModelSession` to the terminal, with token usage at the end (running it requires a macOS 27 host):

```sh
ANTHROPIC_API_KEY=<key> swift run ClaudeExample "What should I see in Kyoto?"
```

Pass `--search` to enable server-side web search for the turn:

```sh
ANTHROPIC_API_KEY=<key> swift run ClaudeExample --search "Top spaceflight news this week?"
```

## Choosing a model

Model identifiers are values of `ClaudeModel`. Use a compiled-in constant, or construct one with explicit capabilities for an ID that isn't compiled in yet (see [Capabilities](#capabilities)):

```swift
ClaudeLanguageModel(name: .opus4_8, auth: auth)
```

Constants mirror API model IDs (`.opus4_8` is `claude-opus-4-8`) and carry each model's capabilities. New models ship as new constants in package releases.

Dateless model IDs like `claude-opus-4-8` (the 4.6 generation onward) are pinned snapshots, not evergreen pointers — the model behind an ID doesn't change underneath you.

### Capabilities

Each model declares what it accepts — sampling parameters, effort levels, adaptive thinking, structured output, and image input. The bridge uses this to decide which request fields to send, since sending a field a model rejects is a hard error. The constants carry the right capabilities. For an ID that isn't compiled in, declare what the model accepts:

```swift
let model = ClaudeModel(
  id: "claude-experimental-x",
  capabilities: .init(effortLevels: [.low, .high], structuredOutput: true)
)
ClaudeLanguageModel(name: model, auth: auth)
```

### Effort

Pin a Claude effort level for every request with `fixedEffort:`. It takes precedence over the framework's per-request reasoning hints. The API defaults to `high` when no effort is sent:

```swift
ClaudeLanguageModel(name: .opus4_8, auth: auth, fixedEffort: .xhigh)
```

The framework's reasoning levels map to effort per request: `.light` → `low`, `.moderate` → `medium`, `.deep` → `high`, and `.custom` accepts a Claude effort name directly (`"xhigh"`, `"max"`). Levels a model doesn't accept are dropped — a reasoning level is a hint, not a contract.

The level must be one the model accepts — each model declares which of the five levels (`low`, `medium`, `high`, `xhigh`, `max`) it takes.

## Authentication

Set the credential with the `auth:` parameter.

```swift
// Development. A bundled key is extractable from a shipping app — use one of
// the production options below before release.
ClaudeLanguageModel(name: .sonnet5, auth: .apiKey("..."))

// Production via your own backend. The relay at `baseURL` adds the credential
// server-side; the app ships no key. `headers` are sent on every request so the
// proxy can authorize the caller — pass `[:]` if it needs none.
ClaudeLanguageModel(
  name: .sonnet5,
  auth: .proxied(headers: ["X-App-Token": "..."]),
  baseURL: URL(string: "https://api.yourapp.com/claude")!
)
```

**Coming soon:** a production mode that doesn't require running your own backend — each app install authenticates with App Attest and usage is billed to your Anthropic workspace. Until that ships, use `.apiKey` for development and `.proxied` for production.

## Streaming

`streamResponse(to:)` returns the response incrementally. Each element is a cumulative snapshot:

```swift
let stream = session.streamResponse(to: "Summarize today's top science stories.")
for try await partial in stream {
  print(partial.content)
}
```

## Structured output

Annotate a type with `@Generable` and request it with `generating:`. The model returns a value of that type:

```swift
@Generable
struct Trip {
  @Guide(description: "Destination city") var destination: String
  @Guide(description: "Length in days") var days: Int
}

let response = try await session.respond(to: "Plan a trip to Tokyo.", generating: Trip.self)
print(response.content.destination)
```

Structured output requires a model whose capabilities include it (all compiled-in constants do).

## Server-side tools

Server-side tools run on Anthropic's infrastructure within a single round-trip — web search, web fetch, and code execution. Configure them per model with `serverTools:`:

```swift
let model = ClaudeLanguageModel(
  name: .sonnet5,
  auth: auth,
  serverTools: [
    .webSearch(maxUses: 5),
    .codeExecution,
  ]
)
```

`.webSearch` and `.webFetch` accept a `domains:` filter — `.unrestricted` (the default), `.allowing([...])`, or `.blocking([...])` — and an optional `maxUses`. These are distinct from the framework's `tools:` array, which holds client-side tools the framework invokes on the device.

## Error handling

Provider errors that don't map onto a Foundation Models `LanguageModelError` surface as `ClaudeError`. Pattern-match to drive product flows:

```swift
do {
  let response = try await session.respond(to: prompt)
  print(response.content)
} catch ClaudeError.missingCredential {
  // Prompt for an API key.
} catch {
  // Foundation Models errors (guardrails, context length, decoding) and transport errors.
}
```

## What this package provides

The public surface is Apple's Foundation Models provider conformance plus the configuration types that reach it — `ClaudeLanguageModel`, `ClaudeModel`, `AuthMode`, and `ClaudeServerTool`. It is not a general-purpose Anthropic Messages API client.


# Claude for Financial Services

Reference agents, skills, and data connectors for the financial-services workflows we see most — investment banking, equity research, private equity, and wealth management.

Everything here is available **two ways from one source**: install it as a [Claude Cowork](https://claude.com/product/cowork) plugin, or deploy it through the [Claude Managed Agents API](https://docs.claude.com/en/api/managed-agents) behind your own workflow engine. Same system prompt, same skills — you choose where it runs.

> [!IMPORTANT]
> Nothing in this repository constitutes investment, legal, tax, or accounting advice. These agents draft analyst work product — models, memos, research notes, reconciliations — for review by a qualified professional. They do not make investment recommendations, execute transactions, bind risk, post to a ledger, or approve onboarding; every output is staged for human sign-off. You are responsible for verifying outputs and for compliance with the laws and regulations that apply to your firm.

What's in the repo:

- **[Agents](#agents)** — named, end-to-end workflow agents (Pitch Agent, Market Researcher, GL Reconciler, …). Each ships as a Cowork plugin **and** as a [Claude Managed Agent template](./managed-agent-cookbooks) you deploy via `/v1/agents`.
- **[Vertical plugins](#vertical-plugins)** — the underlying skills, slash commands, and data connectors, bundled by FSI vertical. Install these on their own if you just want `/comps`, `/dcf`, `/earnings` and the connectors without a full agent.

## Agents

Each agent is named for the workflow it runs. They're starting points: install the ones that match your work, then tune the prompts, skills, and connectors to how your firm does it.

Each agent plugin is **self-contained** — it bundles the skills it uses, so installing the agent is all you need.

| Function | Agent | What it does |
|---|---|---|
| **Coverage & advisory** | **[Pitch Agent](./plugins/agent-plugins/pitch-agent)** | Comps, precedents, LBO → branded pitch deck, end to end |
| | **[Meeting Prep Agent](./plugins/agent-plugins/meeting-prep-agent)** | Briefing pack before every client meeting |
| **Research & modeling** | **[Market Researcher](./plugins/agent-plugins/market-researcher)** | Sector or theme → industry overview, competitive landscape, peer comps, ideas shortlist |
| | **[Earnings Reviewer](./plugins/agent-plugins/earnings-reviewer)** | Earnings call + filings → model update → note draft |
| | **[Model Builder](./plugins/agent-plugins/model-builder)** | DCF, LBO, 3-statement, comps — live in Excel |
| **Fund admin & finance ops** | **[Valuation Reviewer](./plugins/agent-plugins/valuation-reviewer)** | Ingests GP packages, runs valuation template, stages LP reporting |
| | **[GL Reconciler](./plugins/agent-plugins/gl-reconciler)** | Finds breaks, traces root cause, routes for sign-off |
| | **[Month-End Closer](./plugins/agent-plugins/month-end-closer)** | Accruals, roll-forwards, variance commentary |
| | **[Statement Auditor](./plugins/agent-plugins/statement-auditor)** | Audits LP statements before distribution |
| **Operations & onboarding** | **[KYC Screener](./plugins/agent-plugins/kyc-screener)** | Parses onboarding docs, runs the rules engine, flags gaps |

For Managed Agent deployment — `agent.yaml`, leaf-worker subagents, steering-event examples, and per-agent security notes — see **[managed-agent-cookbooks/](./managed-agent-cookbooks)**.

## Repository Layout

```
plugins/
  agent-plugins/               # Named agents — one self-contained plugin each
  vertical-plugins/            # Skill + command bundles by FSI vertical, plus MCP connectors
  partner-built/               # Partner-authored plugins (LSEG, S&P Global)
managed-agent-cookbooks/       # Claude Managed Agent cookbooks — one dir per agent
claude-for-msft-365-install/   # Admin tooling to provision the Claude Microsoft 365 add-in
scripts/                       # deploy-managed-agent.sh · check.py · validate.py · orchestrate.py · sync-agent-skills.py
```

## Getting Started

### Cowork

In Cowork, open **Settings → Plugins → Add plugin** and either:

- **Paste this repo URL** — `https://github.com/anthropics/financial-services` — then pick the agents and verticals you want from the marketplace list, or
- **Upload a zip** — zip any directory under `plugins/` (e.g. `plugins/agent-plugins/pitch-agent/`) and drop it in.

### Claude Code

```bash
# Add the marketplace
claude plugin marketplace add anthropics/financial-services

# Core skills + connectors (install first)
claude plugin install financial-analysis@claude-for-financial-services

# Named agents — pick the ones you want
claude plugin install pitch-agent@claude-for-financial-services
claude plugin install gl-reconciler@claude-for-financial-services
claude plugin install market-researcher@claude-for-financial-services

# Vertical skill bundles
claude plugin install investment-banking@claude-for-financial-services
claude plugin install equity-research@claude-for-financial-services
```

Once installed, agents appear in Cowork dispatch, skills fire automatically when relevant, and slash commands are available in your session (`/comps`, `/dcf`, `/earnings`, `/ic-memo`, …).

### Claude Managed Agents

```bash
export ANTHROPIC_API_KEY=sk-ant-...
scripts/deploy-managed-agent.sh gl-reconciler
```

Each template under [`managed-agent-cookbooks/`](./managed-agent-cookbooks) references the same system prompt and skills as its plugin counterpart. The deploy script resolves file references, uploads skills, creates leaf-worker subagents, and POSTs the orchestrator to `/v1/agents`. See [`scripts/orchestrate.py`](./scripts/orchestrate.py) for a reference event loop that routes `handoff_request` events between agents via your own orchestration layer.

> **Research Preview:** subagent delegation (`callable_agents`) is a preview capability. See per-agent READMEs for security and handoff guidance.

## How It Fits Together

| | What it is | Where it lives |
|---|---|---|
| **Agents** | Self-contained plugins that own a workflow end to end — system prompt plus the skills it uses. Cowork and the Managed Agent wrapper both reference the same directory. | `plugins/agent-plugins/<slug>/` |
| **Skills** | Domain expertise, conventions, and step-by-step methods Claude draws on automatically when relevant. Authored once in the verticals; each agent bundles a synced copy of the ones it needs. | `plugins/vertical-plugins/<vertical>/skills/` (source) · `plugins/agent-plugins/<slug>/skills/` (bundled) |
| **Commands** | Slash actions you trigger explicitly (`/comps`, `/earnings`, `/ic-memo`). | `plugins/vertical-plugins/<vertical>/commands/` |
| **Connectors** | [MCP servers](https://modelcontextprotocol.io/) that wire Claude to your data — terminals, research platforms, document stores. | `plugins/vertical-plugins/financial-analysis/.mcp.json` |
| **Managed-agent wrappers** | `agent.yaml` + depth-1 subagents + steering examples for headless deployment. | `managed-agent-cookbooks/<slug>/` |

Everything is file-based — markdown and JSON, no build step.

## Vertical Plugins

Start with **financial-analysis** — it carries the shared modeling skills and all data connectors. Add verticals for the workflows you need.

| Plugin | What it adds |
|---|---|
| **[financial-analysis](./plugins/vertical-plugins/financial-analysis)** *(core)* | Comps, DCF, LBO, 3-statement, deck QC, Excel audit. All 11 data connectors. |
| **[investment-banking](./plugins/vertical-plugins/investment-banking)** | CIMs, teasers, process letters, buyer lists, merger models, deal tracking. |
| **[equity-research](./plugins/vertical-plugins/equity-research)** | Earnings notes, initiations, model updates, thesis and catalyst tracking. |
| **[private-equity](./plugins/vertical-plugins/private-equity)** | Sourcing, screening, diligence checklists, IC memos, portfolio monitoring. |
| **[wealth-management](./plugins/vertical-plugins/wealth-management)** | Client reviews, financial plans, rebalancing, reporting, TLH. |
| **[fund-admin](./plugins/vertical-plugins/fund-admin)** | GL recon, break tracing, accruals, roll-forwards, variance commentary, NAV tie-out. |
| **[operations](./plugins/vertical-plugins/operations)** | KYC document parsing and rules-grid evaluation. |
| **[lseg](./plugins/partner-built/lseg)** *(partner)* | Bond RV, swap curves, FX carry, options vol, macro-rates monitoring on LSEG data. |
| **[sp-global](./plugins/partner-built/spglobal)** *(partner)* | Tear sheets, earnings previews, funding digests on S&P Capital IQ. |

## MCP Integrations

All connectors are centralized in the **financial-analysis** core plugin and shared across the rest.

| Provider | URL |
|---|---|
| [Daloopa](https://www.daloopa.com/) | `https://mcp.daloopa.com/server/mcp` |
| [Morningstar](https://www.morningstar.com/) | `https://mcp.morningstar.com/mcp` |
| [S&P Global](https://www.spglobal.com/) | `https://kfinance.kensho.com/integrations/mcp` |
| [FactSet](https://www.factset.com/) | `https://mcp.factset.com/mcp` |
| [Moody's](https://www.moodys.com/) | `https://api.moodys.com/genai-ready-data/m1/mcp` |
| [MT Newswires](https://www.mtnewswires.com/) | `https://vast-mcp.blueskyapi.com/mtnewswires` |
| [Aiera](https://www.aiera.com/) | `https://mcp-pub.aiera.com` |
| [LSEG](https://www.lseg.com/) | `https://api.analytics.lseg.com/lfa/mcp` |
| [PitchBook](https://pitchbook.com/) | `https://premium.mcp.pitchbook.com/mcp` |
| [Chronograph](https://www.chronograph.pe/) | `https://ai.chronograph.pe/mcp` |
| [Egnyte](https://www.egnyte.com/) | `https://mcp-server.egnyte.com/mcp` |
| [Box](https://www.box.com/home) | `https://mcp.box.com` |

> MCP access may require a subscription or API key from the provider.

## Claude for Microsoft 365 — Install Tooling

If your firm runs Claude inside Excel, PowerPoint, Word, and Outlook via the Microsoft 365 add-in, [`claude-for-msft-365-install/`](./claude-for-msft-365-install) is the admin tooling to provision it against **your own cloud** — Vertex AI, Bedrock, or an internal LLM gateway — instead of Anthropic's API.

It's a Claude Code plugin (not a Cowork plugin) that walks an IT admin through generating the customized add-in manifest, granting Azure admin consent, and writing per-user routing config via Microsoft Graph. Install with:

```bash
claude plugin install claude-for-msft-365-install@claude-for-financial-services
/claude-for-msft-365-install:setup
```

This is separate from the agents and vertical plugins above — it's the on-ramp that gets the add-in deployed in a tenant, after which the agents and skills here are what runs inside it.

## Making It Yours

These are reference templates — they get better when you tune them to how your firm works.

- **Swap connectors** — point `.mcp.json` at your data providers and internal systems.
- **Add firm context** — drop your terminology, processes, and formatting standards into skill files.
- **Bring your templates** — `/ppt-template` teaches Claude your branded PowerPoint layouts.
- **Adjust agent scope** — edit `agents/<slug>.md` to match how your team actually runs the workflow.
- **Add your own** — copy the structure for workflows we haven't covered.

## Skill & Command Reference

financial-analysis — core modeling, Excel, deck QC

| Skill | Command | Description |
|---|---|---|
| comps-analysis | `/comps` | Comparable company analysis with trading multiples |
| dcf-model | `/dcf` | DCF valuation with WACC and sensitivity analysis |
| lbo-model | `/lbo` | Leveraged buyout model |
| 3-statement-model | `/3-statement-model` | Populate 3-statement financial model templates |
| audit-xls | `/debug-model` | Excel model audit — formula tracing, hardcode detection, balance checks |
| clean-data-xls | — | Normalize and clean tabular data in Excel |
| deck-refresh | — | Re-link and refresh embedded charts/tables across a deck |
| competitive-analysis | `/competitive-analysis` | Competitive landscape and market positioning |
| ib-check-deck | — | QC presentations for errors and consistency |
| pptx-author | — | Produce a `.pptx` file headlessly (Managed Agent mode) |
| xlsx-author | — | Produce a `.xlsx` file headlessly (Managed Agent mode) |
| ppt-template-creator | `/ppt-template` | Create reusable PPT template skills |
| skill-creator | — | Guide for creating new skills |

investment-banking — deal materials and execution

| Skill | Command | Description |
|---|---|---|
| strip-profile | `/one-pager` | One-page company profiles for pitch books |
| pitch-deck | — | Populate pitch deck templates with data |
| datapack-builder | — | Build data packs from CIMs and filings |
| cim-builder | `/cim` | Draft Confidential Information Memorandums |
| teaser | `/teaser` | Anonymous one-page company teasers |
| buyer-list | `/buyer-list` | Strategic and financial buyer universe |
| merger-model | `/merger-model` | Accretion/dilution M&A analysis |
| process-letter | `/process-letter` | Bid instructions and process correspondence |
| deal-tracker | `/deal-tracker` | Track live deals, milestones, and action items |


Now let me fetch the remaining medium-priority repos and check the wiki structure:


curl -sL https://raw.githubusercontent.com/anthropics/claude-plugins-community/main/README.md 2>/dev/null | head -150

Fetch claude-plugins-community README


# Claude Plugins — Community

Community-contributed plugins for [Claude Cowork](https://claude.com/product/cowork) and [Claude Code](https://claude.com/product/claude-code).

## What this repo is

A **read-only mirror** of the community plugin marketplace. The `.claude-plugin/marketplace.json` file here is the list of community plugins available to install. It is synced nightly from Anthropic's internal review pipeline.

Every plugin listed here has been submitted via [claude.ai](https://clau.de/plugin-directory-submission), passed automated security scanning, and been approved for distribution.

## Using this marketplace

### Claude Cowork

Install plugins from [claude.com/plugins](https://claude.com/plugins/).

### Claude Code

```bash
claude plugin marketplace add anthropics/claude-plugins-community
claude plugin install <plugin-name>@claude-community
```

## Submitting a plugin

Submit via **[clau.de/plugin-directory-submission](https://clau.de/plugin-directory-submission)**. Pull requests opened directly against this repo are closed automatically — all changes flow from the internal review pipeline.

## Related

- [anthropics/claude-plugins-official](https://github.com/anthropics/claude-plugins-official) — Anthropic-maintained plugins
- [anthropics/knowledge-work-plugins](https://github.com/anthropics/knowledge-work-plugins) — role-specific knowledge-work plugins


curl -sL https://raw.githubusercontent.com/anthropics/claude-plugins-official/main/README.md 2>/dev/null | head -150

Fetch claude-plugins-official README


# Claude Code Plugins Directory

A curated directory of high-quality plugins for Claude Code.

> **⚠ Important:** Make sure you trust a plugin before installing, updating, or using it. Anthropic does not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.

## Structure

- **`/plugins`** - Internal plugins developed and maintained by Anthropic
- **`/external_plugins`** - Third-party plugins from partners and the community

## Installation

Plugins can be installed directly from this marketplace via Claude Code's plugin system.

To install, run `/plugin install {plugin-name}@claude-plugins-official`

or browse for the plugin in `/plugin > Discover`

## Contributing

### Internal Plugins

Internal plugins are developed by Anthropic team members. See `/plugins/example-plugin` for a reference implementation.

### External Plugins

Third-party partners can submit plugins for inclusion in the marketplace. External plugins must meet quality and security standards for approval. To submit a new plugin, use the [plugin directory submission form](https://clau.de/plugin-directory-submission).

## Plugin Structure

Each plugin follows a standard structure:

```
plugin-name/
├── .claude-plugin/
│   └── plugin.json      # Plugin metadata (required)
├── .mcp.json            # MCP server configuration (optional)
├── commands/            # Slash commands (optional)
├── agents/              # Agent definitions (optional)
├── skills/              # Skill definitions (optional)
└── README.md            # Documentation
```

## Plugin names are immutable

The `name` field in a marketplace entry is an **immutable slug**. Once a plugin has been published, its `name` must not change — users have it installed under that slug, and renaming it breaks their install with a `plugin-not-found` error.

- To change how a plugin is labeled in the UI, set or update `displayName` instead.
- If a rename is genuinely unavoidable, add an entry to the top-level `renames` map in `.claude-plugin/marketplace.json` so existing installs auto-migrate:

```json
"renames": {
  "old-name": "new-name"
}
```

The Claude Code plugin loader reads this map and transparently rewrites the old slug to the new one on the user's next sync.

## Skill-bundle plugins

When a plugin's source repository ships skills (`SKILL.md` files) without a `.claude-plugin/plugin.json` manifest, the marketplace entry can declare the skills directly using `strict: false` and an explicit `skills` array.

```json
{
  "name": "example-bundle",
  "description": "Brief description of the bundled skills.",
  "author": { "name": "Author Name" },
  "category": "development",
  "source": {
    "source": "git-subdir",
    "url": "https://github.com/example-org/sdk.git",
    "path": "packages/agent-skills",
    "ref": "main",
    "sha": "<commit sha>"
  },
  "strict": false,
  "skills": [
    "./skill-a",
    "./skill-b",
    "./skill-c"
  ],
  "homepage": "https://github.com/example-org/sdk"
}
```

Each path in `skills` is relative to `source.path` and points at a directory containing a `SKILL.md`. Paths can reach deeper than a single level — for example, `["./libA/skill-1", "./libB/skill-2"]` exposes a curated subset across multiple library subdirectories. Each skill is registered as `<plugin-name>:<skill-name>` in Claude Code.

For the underlying schema, see [Strict mode](https://code.claude.com/docs/en/plugin-marketplaces) in the marketplace documentation.

## License

Please see each linked plugin for the relevant LICENSE file.

## Documentation

For more information on developing Claude Code plugins, see the [official documentation](https://code.claude.com/docs/en/plugins).


curl -sL https://raw.githubusercontent.com/anthropics/claude-code-security-review/main/README.md 2>/dev/null | head -150

Fetch claude-code-security-review README


# Claude Code Security Reviewer

An AI-powered security review GitHub Action using Claude to analyze code changes for security vulnerabilities. This action provides intelligent, context-aware security analysis for pull requests using Anthropic's Claude Code tool for deep semantic security analysis. See our blog post [here](https://www.anthropic.com/news/automate-security-reviews-with-claude-code) for more details.

## Features

- **AI-Powered Analysis**: Uses Claude's advanced reasoning to detect security vulnerabilities with deep semantic understanding
- **Diff-Aware Scanning**: For PRs, only analyzes changed files
- **PR Comments**: Automatically comments on PRs with security findings
- **Contextual Understanding**: Goes beyond pattern matching to understand code semantics
- **Language Agnostic**: Works with any programming language
- **False Positive Filtering**: Advanced filtering to reduce noise and focus on real vulnerabilities

## Quick Start

Add this to your repository's `.github/workflows/security.yml`:

```yaml
name: Security Review

permissions:
  pull-requests: write  # Needed for leaving PR comments
  contents: read

on:
  pull_request:

jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha || github.sha }}
          fetch-depth: 2

      - uses: anthropics/claude-code-security-review@main
        with:
          comment-pr: true
          claude-api-key: ${{ secrets.CLAUDE_API_KEY }}
```

## Security Considerations

This action is not hardened against prompt injection attacks and should only be used to review trusted PRs. We recommend [configuring your repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#controlling-changes-from-forks-to-workflows-in-public-repositories) to use the "Require approval for all external contributors" option to ensure workflows only run after a maintainer has reviewed the PR.

## Configuration Options

### Action Inputs

| Input | Description | Default | Required |
|-------|-------------|---------|----------|
| `claude-api-key` | Anthropic Claude API key for security analysis.
*Note*: This API key needs to be enabled for both the Claude API and Claude Code usage. | None | Yes |
| `comment-pr` | Whether to comment on PRs with findings | `true` | No |
| `upload-results` | Whether to upload results as artifacts | `true` | No |
| `exclude-directories` | Comma-separated list of directories to exclude from scanning | None | No |
| `claude-model` | Claude [model name](https://docs.anthropic.com/en/docs/about-claude/models/overview#model-names) to use. Defaults to Opus 4.1. | `claude-opus-4-1-20250805` | No |
| `claudecode-timeout` | Timeout for ClaudeCode analysis in minutes | `20` | No |
| `run-every-commit` | Run ClaudeCode on every commit (skips cache check). Warning: May increase false positives on PRs with many commits. | `false` | No |
| `false-positive-filtering-instructions` | Path to custom false positive filtering instructions text file | None | No |
| `custom-security-scan-instructions` | Path to custom security scan instructions text file to append to audit prompt | None | No |

### Action Outputs

| Output | Description |
|--------|-------------|
| `findings-count` | Total number of security findings |
| `results-file` | Path to the results JSON file |

## How It Works

### Architecture

```
claudecode/
├── github_action_audit.py  # Main audit script for GitHub Actions
├── prompts.py              # Security audit prompt templates
├── findings_filter.py      # False positive filtering logic
├── claude_api_client.py    # Claude API client for false positive filtering
├── json_parser.py          # Robust JSON parsing utilities
├── requirements.txt        # Python dependencies
├── test_*.py               # Test suites
└── evals/                  # Eval tooling to test CC on arbitrary PRs
```

### Workflow

1. **PR Analysis**: When a pull request is opened, Claude analyzes the diff to understand what changed
2. **Contextual Review**: Claude examines the code changes in context, understanding the purpose and potential security implications
3. **Finding Generation**: Security issues are identified with detailed explanations, severity ratings, and remediation guidance
4. **False Positive Filtering**: Advanced filtering removes low-impact or false positive prone findings to reduce noise
5. **PR Comments**: Findings are posted as review comments on the specific lines of code

## Security Analysis Capabilities

### Types of Vulnerabilities Detected

- **Injection Attacks**: SQL injection, command injection, LDAP injection, XPath injection, NoSQL injection, XXE
- **Authentication & Authorization**: Broken authentication, privilege escalation, insecure direct object references, bypass logic, session flaws
- **Data Exposure**: Hardcoded secrets, sensitive data logging, information disclosure, PII handling violations
- **Cryptographic Issues**: Weak algorithms, improper key management, insecure random number generation
- **Input Validation**: Missing validation, improper sanitization, buffer overflows
- **Business Logic Flaws**: Race conditions, time-of-check-time-of-use (TOCTOU) issues
- **Configuration Security**: Insecure defaults, missing security headers, permissive CORS
- **Supply Chain**: Vulnerable dependencies, typosquatting risks
- **Code Execution**: RCE via deserialization, pickle injection, eval injection
- **Cross-Site Scripting (XSS)**: Reflected, stored, and DOM-based XSS

### False Positive Filtering

The tool automatically excludes a variety of low-impact and false positive prone findings to focus on high-impact vulnerabilities:
- Denial of Service vulnerabilities
- Rate limiting concerns
- Memory/CPU exhaustion issues
- Generic input validation without proven impact
- Open redirect vulnerabilities

The false positive filtering can also be tuned as needed for a given project's security goals.

### Benefits Over Traditional SAST

- **Contextual Understanding**: Understands code semantics and intent, not just patterns
- **Lower False Positives**: AI-powered analysis reduces noise by understanding when code is actually vulnerable
- **Detailed Explanations**: Provides clear explanations of why something is a vulnerability and how to fix it
- **Adaptive Learning**: Can be customized with organization-specific security requirements

## Installation & Setup

### GitHub Actions

Follow the Quick Start guide above. The action handles all dependencies automatically.

### Local Development

To run the security scanner locally against a specific PR, see the [evaluation framework documentation](claudecode/evals/README.md).

## Claude Code Integration: /security-review Command

By default, Claude Code ships a `/security-review` [slash command](https://docs.anthropic.com/en/docs/claude-code/slash-commands) that provides the same security analysis capabilities as the GitHub Action workflow, but integrated directly into your Claude Code development environment. To use this, simply run `/security-review` to perform a comprehensive security review of all pending changes.

### Customizing the Command

The default `/security-review` command is designed to work well in most cases, but it can also be customized based on your specific security needs. To do so:

1. Copy the [`security-review.md`](https://github.com/anthropics/claude-code-security-review/blob/main/.claude/commands/security-review.md?plain=1) file from this repository to your project's `.claude/commands/` folder.
2. Edit `security-review.md` to customize the security analysis. For example, you could add additional organization-specific directions to the false positive filtering instructions.

## Custom Scanning Configuration


curl -sL https://raw.githubusercontent.com/anthropics/code-migration-kit-with-claude-code/main/README.md 2>/dev/null | head -150

Fetch code-migration-kit-with-claude-code README


# Claude Code Migration Kit

A starter kit for running large-scale language migrations with Claude Code: the
prompts, templates, and scripts behind the process described in
**How Anthropic runs large-scale code migrations with Claude Code**.

This kit defaults to **structure-preserving migrations** — same architecture,
same data structures, new language. That's the case where the process below is
mechanical enough to template. If you're redesigning as you migrate, read
[If you're redesigning](#if-youre-redesigning) first: parts of this kit change,
and one part becomes invalid.

> **Provenance:** these prompts are reconstructions — generalized and reviewed
> against real production migrations, including Bun's 1M+ line Zig→Rust port,
> not transcripts. The real artifacts were messier and more specific: the Bun
> port's "prompt" was a 576-line rulebook
> ([PORTING.md](https://github.com/oven-sh/bun/commit/46d3bc29f270fa881dd5730ef1549e88407701a5))
> and a one-sentence kickoff.

> **Status:** Reference code. This repo is a companion to the blog post and is
> not actively maintained. Issues and PRs are not monitored.

## Quick start

1. Clone the kit inside (or adjacent to) the repo you're migrating:
   `git clone <kit> ./migration-kit`.
2. Copy or `@`-import the kit's `CLAUDE.md` into the target repo's `CLAUDE.md`
   before the six steps below begin — it's the operating manual every session
   reads.
3. Optional: install the skill —
   `cp -r migration-kit/skill ~/.claude/skills/code-migration`, then replace `[kit path]` inside the installed SKILL.md.
4. Open Claude Code in the target repo and paste `prompts/00-feasibility.md`
   with its placeholders filled.
5. Make sure you have a judge before Step 1. If your existing test suite hits
   the public surface (or already lives in a third language), it's your judge —
   carry it into Step 6. If it imports internals that die with the old language,
   run `prompts/00b-judge-setup.md` to build a portable parity harness and
   validate it (against the original *and* against deliberately broken code)
   before any translation. No judge, no exit condition.
6. Before any translation fan-out (prompt 03 onward): copy
   `templates/settings.json` to the target repo's `.claude/settings.json`
   (see `templates/settings.README.md`) — installed by you before prompt 03
   (Step 2's pilot needs the denies live), active through Step 4 (prompt 05),
   test denies re-activated for Step 6's fix loops. Prompts 03 and 04 verify
   it exists and stop without it — in one early test run this step was silently
   skipped and nothing caught it.
7. Then work `prompts/01`–`06` in order, one gate at a time.

## Should you migrate at all?

Start with `prompts/00-feasibility.md`. Paste it into Claude Code in your repo.
It produces a read-only report: the case for leaving, three committed calls
(structure-preserving or redesign, what verification costs, whether your tests
survive), a sketch of the six steps for your repo, and a verdict. "Don't
migrate" is a valid outcome. Nothing else in this kit matters until that
report says go.

## The six steps

Every step below follows the same doctrine: **you don't fix the code — you fix
the process that produced the code.** Individual failures get burned down by
fixer agents; recurring failures indict a rule, and the rule gets amended.

| Step | What happens | Kit artifact |
|---|---|---|
| 1. Create the map and the rules | Dependency map orders the work; gap inventory traces what the target language demands; the rulebook decides every translation question once | `scripts/depmap_*`, `prompts/01`, `prompts/02`, `templates/RULEBOOK.md`, `templates/inventory.tsv` |
| 2. Stress-test the rules | Dual-translation bakeoff + pilot run on a handful of nasty files; the only surviving output is rule changes | `prompts/03-stress-test.md` |
| 3. Translate everything | Implementer + two adversarial reviewers + fixer per unit, fanned out over a mechanical queue; the compiler waits | `prompts/04-translation-kickoff.md`, `scripts/queue_runner.mjs` |
| 4. Compile | One survey build grades everything; error list becomes a machine queue sliced by module; fixers work without compiler access | `prompts/05-survey-build.md`, `templates/settings.json` (the bans) |
| 5. Run it | Hello world, then smoke tests — the cheap end-to-end proof before the expensive one | — |
| 6. Match behavior | Inherited test suite burndown, or build a parity referee against the old code | your existing test suite is the artifact; `prompts/06-post-parity.md` after the gate |

### Step 1 — Create the map and the rules

Three artifacts, built in parallel, audited together:

1. **The rulebook** (`templates/RULEBOOK.md` — copy it to
   `migration/RULEBOOK.md` in the target repo): every decision a translator could
   make two ways, decided once. The meta-rule: *if two agents could answer
   differently, it goes in the rulebook.* Draft it in a conversation with
   Claude, then have agents survey the codebase for the facts ("how many struct
   fields," "how many uses tree-wide") and adversarial reviewers audit it — one
   mistake class each.
2. **The dependency map** (`scripts/depmap_*.py|.mjs` + `prompts/01`): a
   deterministic script, not agent judgment. Orders the work, finds the cycles
   — at file granularity AND at the target's package granularity. (Bun's port
   had a clean file graph and still hit ~16K compile errors from package-level
   cycles nobody had checked.)
3. **The gap inventory** (`prompts/02` + `templates/inventory.tsv`): one flat
   table of every site where the target language demands something the source
   let you keep in your head — ownership, lifetimes, nullability, interface
   contracts. Implementers grep it; nobody reads it top to bottom.

The sign-off gates in these prompts work like this: a workflow runs its phase
to completion, returns the evidence, and exits. **Your sign-off is the act of
kicking off the next one.** Every queue is defined by what exists on disk, so
stopping is free and resuming is a re-invocation, not a recovery. When a
prompt says "use a workflow," it means: run the phase as parallel subagents
that complete and stop at the gate — in stock Claude Code, that's a Task/Agent
fan-out.

### Step 2 — Stress-test the rules

The rulebook has never met real code. Before any fan-out:
**bakeoff** (two translators, separate contexts — one follows the rules, one
never learns they exist; a diff inspector turns every difference into a verdict
on a rule) and **pilot** (the production pipeline exactly as the fan-out will
run it, graded on obedience, not output quality). Amendments are queued for
you, never self-applied. See `prompts/03-stress-test.md`.

### Step 3 — Translate everything

The kickoff prompt is deliberately short (`prompts/04`) because by now the
rulebook is the prompt. The queue is mechanical: every manifest entry with no
output file on disk yet (`scripts/queue_runner.mjs`) —
`migration/manifest.tsv` is a Step 1 output, generated by prompt 01's
closing action from the dependency map's order with
`scripts/make_manifest.py`. Don't run the compiler — it grades everything next
step. Ban the expensive operations by configuration, not request:
`templates/settings.json`, copied to the target repo's `.claude/settings.json`
by you before prompt 03 (Step 2's pilot needs the denies live), active
through Step 4 (prompt 05), test denies re-activated for Step 6's fix loops
(see `templates/settings.README.md`).

### Step 4 — Compile

One scripted **survey build** runs the compiler across everything and emits the
error list as a machine queue, sliced by module, leaves-to-root. Parallel
fixers work the queue **without compiler access** — the daemon that owns the
build is the only process that runs it. Repeat until clean.
`prompts/05-survey-build.md` runs this step. With denies active the standard
transport is `scripts/build_daemon.sh`: the human starts it once, it reruns
the build when the tree changes, and fixers consume the numbered
`migration/build-output-rN.txt` files. In one early test a human relayed every
build by hand — fine for a couple of rounds, not for fifty.

**If your target's typecheck is cheap (TypeScript, Go), this step dissolves
into Step 3** — run the typechecker inside every unit's loop instead of
batching it. The rule: every referee has a price, and the price decides its
position in the loop. Dissolving is an edit to the installed
`.claude/settings.json` at the gate — remove the typecheck denies so the loop
may run it. If settings.json was never installed there is nothing to edit,
and the dissolve silently proceeds with no guardrails at all — one early run did
exactly that, end to end. Install first, then dissolve.

### Step 5 — Run it

Hello world. Then the smallest end-to-end command your binary supports. Cheap
proofs before expensive ones.


ls /workspace/extra/second-brain/wiki/ && ls /workspace/extra/second-brain/wiki/tools/ 2>/dev/null || echo "no tools dir" && ls /workspace/extra/second-brain/wiki/repos/ 2>/dev/null || echo "no repos dir"

Check wiki structure


Home.md
Wiki Ingest Log.md
concepts
people
reference
sources
tools
Agent Browser.md
Agent SDK Workshop.md
AgentsView.md
Anthropic CLI.md
Anthropic CWC Workshops.md
Anthropic Courses.md
Anthropic Performance Take-Home.md
Anthropic Prompt Engineering Tutorial.md
Anthropic SDK Go.md
Anthropic SDK Java.md
Anthropic SDK Python.md
Anthropic Skills Repo.md
Claude Agent SDK Demos.md
Claude Agent SDK Python.md
Claude Agent SDK TypeScript.md
Claude Code Action.md
Claude Code Migration Kit.md
Claude Code Monitoring Guide.md
Claude Code Routines.md
Claude Code Security Review.md
Claude Code Setup Plugin.md
Claude Code.md
Claude Cookbooks.md
Claude Desktop Buddy.md
Claude Fable 5 and Mythos 5.md
Claude Foundation Models Swift Package.md
Claude Plugins Community.md
Claude Plugins Official.md
Claude Quickstarts.md
Claude Tag Plugins.md
Claude for Financial Services.md
Claude for Healthcare.md
Claude for Legal.md
Claude for Life Sciences.md
Claudes C Compiler.md
ClawChief.md
Codex.md
Defending Code Reference Harness.md
Devcontainer Features.md
Devin.md
Fable Method Plugin.md
Figma.md
First Customer Finder Skill.md
GitHub MCP Server.md
Granola.md
HTML Effectiveness Examples.md
Hookify Plugin.md
K-12 Teacher Skills.md
Knowledge Work Plugins.md
Launch Your Agent Skill.md
Launch Your Agent.md
Legora.md
Linear.md
Long-Horizon Coding Agent Demo.md
Long-Running Agent Primitives.md
Managed Agents.md
OpenClaw.md
PineForge MCP.md
Ralph Loop Plugin.md
Scone Bench.md
Supertonic.md
Tailscale.md
Teach Skill.md
Wispr Flow.md
no repos dir


The wiki already has many of these pages. Let me check which ones already exist vs. need updating:


Read

/workspace/extra/second-brain/wiki/tools/Claude Agent SDK Python.md


1	# Claude Agent SDK (Python)
2
3	**Type:** Official Anthropic SDK
4	**Repo:** https://github.com/anthropics/claude-agent-sdk-python
5	**Install:** `pip install claude-agent-sdk`
6	**Docs:** https://platform.claude.com/docs/en/agent-sdk/python
7	**Prerequisites:** Python 3.10+
8	**Note:** Claude Code CLI is bundled in the wheel — no separate install required.
9
10	## Two usage modes
11
12	### 1. `query()` — Simple async queries
13
14	```python
15	from claude_agent_sdk import query
16
17	async for message in query(prompt="What is 2 + 2?"):
18	    print(message)
19	```
20
21	Returns an `AsyncIterator` of response messages. Good for fire-and-forget tasks.
22
23	### 2. `ClaudeSDKClient` — Bidirectional, interactive
24
25	Adds two capabilities `query()` doesn't have: **custom tools** and **hooks**.
26
27	```python
28	async with ClaudeSDKClient(options=options) as client:
29	    await client.query("Do something")
30	    async for msg in client.receive_response():
31	        print(msg)
32	```
33
34	## Key features
35
36	### In-process MCP servers (big deal)
37
38	Custom tools run as in-process MCP servers — same process, no subprocess, no IPC overhead:
39
40	```python
41	from claude_agent_sdk import tool, create_sdk_mcp_server
42
43	@tool("greet", "Greet a user", {"name": str})
44	async def greet_user(args):
45	    return {"content": [{"type": "text", "text": f"Hello, {args['name']}!"}]}
46
47	server = create_sdk_mcp_server(name="my-tools", version="1.0.0", tools=[greet_user])
48	options = ClaudeAgentOptions(mcp_servers={"tools": server}, allowed_tools=["mcp__tools__greet"])
49	```
50
51	Benefits vs. external MCP servers: no subprocess management, better performance, simpler deployment, easier debugging.
52
53	### Hooks — Python functions that intercept the agent loop
54
55	```python
56	async def check_bash_command(input_data, tool_use_id, context):
57	    if "foo.sh" in input_data["tool_input"].get("command", ""):
58	        return {"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", ...}}
59	    return {}
60
61	options = ClaudeAgentOptions(
62	    hooks={"PreToolUse": [HookMatcher(matcher="Bash", hooks=[check_bash_command])]}
63	)
64	```
65
66	### Tool permissions
67
68	- `allowed_tools` — auto-approve listed tools (doesn't remove others; they fall through to `permission_mode`)
69	- `disallowed_tools` — block specific tools entirely
70	- `permission_mode` — controls fallback behavior (`acceptEdits`, etc.)
71
72	## Options
73
74	```python
75	ClaudeAgentOptions(
76	    system_prompt="...",
77	    max_turns=1,
78	    cwd="/path/to/project",
79	    allowed_tools=["Read", "Write", "Bash"],
80	    disallowed_tools=["..."],
81	    permission_mode='acceptEdits',
82	    mcp_servers={...},
83	    hooks={...},
84	    cli_path="/custom/claude"  # if not using bundled CLI
85	)
86	```
87
88	## Error types
89
90	| Exception | Cause |
91	|---|---|
92	| `CLINotFoundError` | Claude Code not installed |
93	| `CLIConnectionError` | Connection issues |
94	| `ProcessError` | Process failed (has `.exit_code`) |
95	| `CLIJSONDecodeError` | JSON parsing issues |
96
97	## Session persistence (`SessionStore`)
98
99	Persist and resume agent sessions across backends. Adapters for S3, Redis, and Postgres. Pass a `SessionStore` instance in options to activate.
100
101	## Effort levels (`EffortLevel`)
102
103	Control thinking budget via `EffortLevel`: `"low"`, `"medium"`, `"high"`, `"max"`, `"xhigh"`. Useful for trading latency vs. depth on complex tasks.
104
105	## Deferred tool use decisions
106
107	Hooks can defer the approval/deny decision for tool use, enabling async human-in-the-loop flows. Feature-parity with TypeScript SDK (added v0.1.74).
108
109	## Current version
110
111	**0.2.87** — bundled Claude CLI v2.1.150.
112
113	## Migration from Claude Code SDK
114
115	- `ClaudeCodeOptions` → `ClaudeAgentOptions`
116	- Merged system prompt config
117	- New: programmatic subagents, session forking
118
119	## Related
120
121	- [[Claude Agent SDK TypeScript]] — `npm install @anthropic-ai/claude-agent-sdk` (Node.js equivalent)
122	- [[Claude Agent SDK Demos]] — 8 demo apps showing patterns; Python versions may be included
123	- [[Claude Cookbooks]] — Code recipes using the Claude API
124


/workspace/extra/second-brain/wiki/tools/Claude Agent SDK TypeScript.md