Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
346 changes: 247 additions & 99 deletions .claude-plugin/marketplace.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions .claude/commands/create-blog-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If no topic provided, ask the user what angle they want to cover.

## MCP Server Required

This command requires the `hashi-reddit` MCP server to be installed and running.
This command requires the `reddit` MCP server to be installed and running.

## Phase 1: Research Reddit Discussions

Expand Down Expand Up @@ -68,9 +68,9 @@ Analyze how Han's features address the discovered pain points:

| Reddit Pain Point | Han Solution |
|-------------------|--------------|
| Inconsistent code quality | Jutsu validation hooks |
| Lack of specialization | Do discipline agents |
| Poor tool integration | Hashi MCP bridges |
| Inconsistent code quality | Validation plugin hooks |
| Lack of specialization | Discipline plugin agents |
| Poor tool integration | Service plugin MCP integrations |
| No memory across sessions | Memory system |
| Uncalibrated confidence | Metrics tracking |
| Missing documentation | Blueprints system |
Expand Down
20 changes: 10 additions & 10 deletions .claude/commands/create-plugin.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Create a new Han plugin (jutsu, hashi, or do)
description: Create a new Han plugin (language, validation, service, tool, or discipline)
---

# Create a Han Plugin
Expand All @@ -10,19 +10,19 @@ Create a new plugin for: $ARGUMENTS

First, determine what type of plugin to create based on the user's request:

### Jutsu (術 - Technique)
### Language/Validation Plugin
**Use when**: The plugin provides validation hooks for a technology (linting, type-checking, testing, formatting)
- Examples: biome, typescript, eslint, rust, playwright
- Key feature: Runs validation commands on Stop events
- Structure: `validation/{name}/` or `languages/{name}/` or `tools/{name}/`

### Hashi (橋 - Bridge)
### Service Plugin
**Use when**: The plugin provides MCP server integration with an external service
- Examples: github, gitlab, reddit, playwright-mcp, sentry
- Key feature: Connects Claude Code to external APIs via MCP
- Structure: `services/{name}/`

### Do (道 - The Way)
### Discipline Plugin
**Use when**: The plugin provides specialized agents for a discipline
- Examples: frontend-development, accessibility, content writing
- Key feature: Contains agent definitions for domain expertise
Expand All @@ -49,7 +49,7 @@ All plugins share this base structure:

---

## Jutsu Plugin Template
## Language/Validation Plugin Template

For validation/quality enforcement plugins:

Expand Down Expand Up @@ -109,7 +109,7 @@ memory: null

---

## Hashi Plugin Template
## Service Plugin Template

For MCP server integrations:

Expand Down Expand Up @@ -178,7 +178,7 @@ memory: null

---

## Do Plugin Template
## Discipline Plugin Template

For discipline/agent plugins:

Expand Down Expand Up @@ -259,19 +259,19 @@ Summon this agent when:
- Include comprehensive README.md
- Test before submitting

### Jutsu (Validation)
### Language/Validation
- Use `--fail-fast` for quick feedback
- Validate, don't auto-fix
- Support monorepos with `dirs_with`
- Use `if_changed` for caching

### Hashi (MCP)
### Service (MCP)
- Prefer HTTP MCP when available (no install needed)
- Document required environment variables
- Include memory provider for team knowledge
- Add commands for common workflows

### Do (Agents)
### Discipline (Agents)
- Create 3-5 focused agents per discipline
- Write detailed agent definitions (1000+ words)
- Include when/when-not to invoke
Expand Down
2 changes: 1 addition & 1 deletion .claude/commands/research-new-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Research feature requests, pain points, and community discussions about Claude A

## MCP Server Required

This command requires the `hashi-reddit` MCP server to be installed and running.
This command requires the `reddit` MCP server to be installed and running.

## Target Subreddits

Expand Down
2 changes: 1 addition & 1 deletion .claude/han.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hanBinary: bun "$(git rev-parse --show-toplevel)/packages/han/lib/main.ts"
{}
37 changes: 18 additions & 19 deletions .claude/rules/blueprints/blueprints-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Technical documentation for this project's architecture and systems.

## When to Consult Blueprints

Before modifying system architecture, use `search_blueprints` and `read_blueprint` to understand:
Before modifying system architecture, use Glob and Read on the `blueprints/` directory to understand:
- Current design decisions and rationale
- Integration points and dependencies
- Established patterns to follow
Expand All @@ -21,7 +21,7 @@ Consult blueprints when working on:

## After Modifications

Update blueprints via `write_blueprint` when you:
Update blueprints using the Write tool on `blueprints/{name}.md` when you:
- Add new systems or major features
- Change architectural patterns
- Discover undocumented conventions
Expand All @@ -31,27 +31,26 @@ Update blueprints via `write_blueprint` when you:
<!-- AUTO-GENERATED INDEX - DO NOT EDIT BELOW THIS LINE -->
| Blueprint | Summary |
|-----------|---------|
| blueprint-system | MCP-based blueprint management with frontmatter metadata |
| browse-architecture | Han browse command architecture - GraphQL + Vite unified server |
| build-deployment | CI/CD automation for releases and deployments |
| checkpoint-system | Session and agent checkpoints for scoped hook execution |
| blueprint-system | Skills-based blueprint management with frontmatter metadata |
| browse-architecture | Han browse command architecture - remote dashboard with local GraphQL coordinator |
| build-deployment | CI/CD with auto-versioning, cross-platform builds from Linux, npm OIDC publishing, and Railway deployment |
| cli-architecture | Entry point, command structure, and CLI framework |
| cli-interface | Interactive CLI with AI-powered plugin discovery |
| coordinator-daemon | Coordinator daemon architecture with GraphQL server, lazy startup, and unified data access |
| coordinator-data-layer | Single-coordinator pattern for indexing JSONL transcripts to SQLite database |
| distribution-architecture | NPM wrapper + platform-specific Bun binaries distribution model |
| cli-interface | Interactive CLI with Commander.js, Ink UI, and AI-powered plugin discovery via Agent SDK |
| coordinator-daemon | Coordinator daemon with GraphQL server, lazy startup, file watching, and unified data access via han-native |
| coordinator-data-layer | JSONL transcript indexing to SQLite via han-native with FTS5 search and DataLoader-compatible batch queries |
| distribution-architecture | NPM wrapper with platform-specific Bun binaries, curl installer, and Homebrew distribution |
| han-events-logging | Session-scoped logging of Han events (hooks, MCP calls) to JSONL files indexed into SQLite for Browse UI visibility |
| han-memory-system | Complete architecture and implementation of Han Memory - five-layer semantic memory with synthesis via Agent SDK, streaming output, and citation-backed answers |
| han-memory-system | Memory system with Agent SDK synthesis, multi-strategy search (FTS/Vector/Hybrid), plugin-discovered MCP providers, and read-only Memory Agent for autonomous research |
| hook-result-parent-linkage | Hook result messages need parent_id linkage to hook run messages |
| hook-system | Complete hook lifecycle from definition to execution with centralized orchestration, checkpoint filtering, and cross-plugin dependencies |
| marketplace | Central plugin registry and distribution |
| hook-system | Direct plugin hook execution via Claude Code with no centralized orchestration |
| marketplace | Central plugin registry with canonical names, backward-compatible aliases, and category-based organization |
| mcp-server | Model Context Protocol server exposing plugin tools |
| metrics-system | Self-reporting agent performance tracking with validation |
| native-module | High-performance Rust bindings for hook operations |
| plugin-directory | Filesystem organization and naming conventions |
| plugin-installation | Installation flow and marketplace integration |
| plugin-types | Bushido, Jutsu, Do, and Hashi plugin categories |
| rust-graphql-migration | Migration plan for tight DB-GraphQL coupling with Seaography, Relay connections, and sqlite3_update_hook subscriptions |
| metrics-system | Automatic task tracking via Claude Code native TaskCreate/TaskUpdate indexed from JSONL transcripts |
| native-module | Rust NAPI-RS bindings providing complete database layer, JSONL indexing, FTS search, and coordinator management |
| plugin-directory | Filesystem organization with category-based directories and short plugin identifiers |
| plugin-installation | Multi-scope plugin installation with auto-detection, three-tier UX fallback, and npm distribution |
| plugin-types | Plugin categories organized by function: core, languages, validation, services, tools, frameworks, disciplines |
| rust-graphql-migration | [PROPOSAL] Migration plan for tight DB-GraphQL coupling with Seaography, Relay connections, and sqlite3_update_hook subscriptions |
| sdlc-coverage | AI-native engineering workflow alignment with OpenAI's framework |
| settings-management | Multi-scope settings with precedence rules |
| validation | Configuration validation and schema enforcement |
Expand Down
39 changes: 39 additions & 0 deletions .claude/rules/browse/always-local-flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Always Use --local Flag for Browse (CRITICAL)

## Rule

When starting `han browse` for local development or verification, **ALWAYS** use the `--local` flag:

```bash
cd packages/han && bun run lib/main.ts browse --local
```

## Why

Without `--local`, the browse command opens the **remote** dashboard at `dashboard.local.han.guru` and immediately exits. This does NOT serve the local browse-client code — it just opens the deployed Railway site in the browser.

The `--local` flag starts a **local Vite dev server** on port 41956 that:
- Serves the local browse-client source with HMR
- Starts relay-compiler in watch mode
- Reflects your uncommitted code changes immediately

## NEVER Do This

```bash
# WRONG — opens remote dashboard, doesn't serve local code
bun run lib/main.ts browse
```

## Verification After Changes

```bash
# Kill existing
lsof -ti:41956 | xargs kill -9 2>/dev/null

# Start LOCAL server
cd packages/han && bun run lib/main.ts browse --local &

# Wait and verify
sleep 12
curl -s -o /dev/null -w "%{http_code}" http://localhost:41956/ # Should return 200
```
50 changes: 50 additions & 0 deletions .claude/rules/browse/local-dashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Local Dashboard Development

## Rule: Always Open the Local Dashboard When Developing Locally

When developing or testing browse-client or GraphQL changes locally, **always use the local dashboard** served by `han browse`, not the remote Railway deployment.

## How to Start

```bash
# From the han package directory
cd packages/han && bun run lib/main.ts browse
```

This starts the coordinator with:
- GraphQL API at `https://localhost:41957/graphql`
- Web UI at `http://localhost:41956/`

## Verification After Changes

After modifying GraphQL types, resolvers, or browse-client components:

```bash
# Kill existing processes
lsof -ti:41956 | xargs kill -9 2>/dev/null
lsof -ti:41957 | xargs kill -9 2>/dev/null

# Start fresh
cd packages/han && bun run lib/main.ts browse &
sleep 8

# Verify
curl -s -o /dev/null -w "%{http_code}" http://localhost:41956/
curl -sk https://localhost:41957/graphql -X POST \
-H "Content-Type: application/json" \
-d '{"query":"{ __typename }"}' | grep -q "data" && echo "GraphQL OK"
```

## Why Local, Not Remote

1. **Immediate feedback** — See changes without deploying to Railway
2. **Real data** — Local coordinator reads from your actual `~/.han/han.db`
3. **GraphQL iteration** — Test schema changes against the local server
4. **No deployment lag** — Railway builds add delays to the feedback loop

## When to Use Remote

Only use the remote dashboard (`dashboard.local.han.guru`) for:
- Final verification before merging
- Testing TLS/CORS behavior in production-like environment
- Demonstrating to others
106 changes: 104 additions & 2 deletions .claude/rules/cc-feature-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,82 @@ Han maintains feature parity with Claude Code releases. This file tracks which v

## Current Support Level

**Supported up to:** Claude Code 2.1.10
**Supported up to:** Claude Code 2.1.63

## Features Tracked

### 2.1.10 (Current)
### 2.1.63 (Current)
- **Task tool renamed to Agent** - The `Task` tool (for spawning subagents) is now called `Agent`. PreToolUse/PostToolUse matchers should match both `Agent|Task` for backward compatibility.
- HTTP hooks (`type: "http"`) - POST JSON to a URL, receive JSON response instead of running shell commands
- `/simplify` and `/batch` bundled slash commands
- Project configs and auto memory shared across git worktrees of same repository
- `ENABLE_CLAUDEAI_MCP_SERVERS=false` env var to opt out of claude.ai MCP servers
- Fixed `/clear` not resetting cached skills
- Massive memory leak fix batch (git root detection, JSON parsing, MCP caches, WebSocket listeners, hooks config, bridge polling, etc.)

### 2.1.59
- Auto-memory: Claude automatically saves useful context, managed with `/memory` command
- `/copy` command with interactive picker for selecting individual code blocks
- Improved "always allow" prefix suggestions for compound bash commands (per-subcommand prefixes)
- `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` env var to disable auto memory

### 2.1.51
- `claude remote-control` subcommand for local environment serving from any device
- Custom npm registries and version pinning when installing plugins
- Managed settings via macOS plist or Windows Registry
- `CLAUDE_CODE_ACCOUNT_UUID`, `CLAUDE_CODE_USER_EMAIL`, `CLAUDE_CODE_ORGANIZATION_UUID` env vars for SDK
- `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS` env var (default now 120s, was 30s)
- Tool results > 50K chars persisted to disk (was 100K)
- BashTool skips login shell by default when shell snapshot available
- Security fix: `statusLine` and `fileSuggestion` hook commands require workspace trust

### 2.1.50
- WorktreeCreate hook event (fires on worktree creation, receives `name` slug, must print worktree path to stdout)
- WorktreeRemove hook event (fires on worktree removal, receives `worktree_path`, cannot block)
- LSP `startupTimeout` configuration support
- `claude agents` CLI command (list all configured agents)
- 1M context window for Opus 4.6 fast mode
- `CLAUDE_CODE_SIMPLE` mode strips down to minimal experience
- Fix: custom agents/skills now discovered when running from a git worktree

### 2.1.49
- ConfigChange hook event (fired when Claude Code configuration is modified, matcher on config source)
- Background agents (`background: true` in agent frontmatter)
- Worktree isolation (`isolation: worktree` in agent frontmatter)

### 2.1.47
- `last_assistant_message` field in Stop/SubagentStop hook inputs

### 2.1.45
- Sonnet 4.6 model support

### 2.1.36
- Fast mode for Opus 4.6 (same model, faster output)

### 2.1.33
- TeammateIdle hook event (fired when a teammate agent goes idle)
- TaskCompleted hook event (fired when a task is marked completed)
- Agent `memory` frontmatter field (`project`, `session`, etc.)
- `Agent(agent_type)` restriction for spawning specific agent types (was `Task(agent_type)` before 2.1.63)

### 2.1.32
- Agent Teams (TeamCreate, SendMessage, multi-agent coordination)
- Opus 4.6 model support
- Automatic memories (persistent auto memory directory)

### 2.1.27
- PR linkage (`--from-pr` flag, auto-link on `gh pr create`)
- PR-linked sessions for resuming work from pull requests

### 2.1.20
- Task deletion (`status: "deleted"` in TaskUpdate)

### 2.1.16
- Task system overhaul with dependencies (blocks/blockedBy)
- TaskCreate, TaskUpdate, TaskGet, TaskList tools
- Task status workflow: pending → in_progress → completed

### 2.1.10
- Setup hook (`--init`, `--init-only`, `--maintenance` flags)
- Session slug (human-readable session names like "snug-dreaming-knuth")
- Token usage in messages (input_tokens, output_tokens, cache_read/creation_tokens)
Expand All @@ -20,6 +91,37 @@ Han maintains feature parity with Claude Code releases. This file tracks which v
- MCP tool calls
- Session summaries and compaction

## Complete Hook Events Reference (as of 2.1.63)

| Event | Matcher | Hook Types | Since |
|-------|---------|------------|-------|
| SessionStart | startup/resume/clear/compact | command only | 2.0.x |
| UserPromptSubmit | No | command, http, prompt, agent | 2.0.x |
| PreToolUse | tool name | command, http, prompt, agent | 2.0.x |
| PermissionRequest | tool name | command, http, prompt, agent | ~2.1.50 |
| PostToolUse | tool name | command, http, prompt, agent | 2.0.x |
| PostToolUseFailure | tool name | command, http, prompt, agent | ~2.1.50 |
| Notification | notification type | command only | 2.0.x |
| SubagentStart | agent type | command only | 2.0.x |
| SubagentStop | agent type | command, http, prompt, agent | 2.0.x |
| Stop | No | command, http, prompt, agent | 2.0.x |
| TeammateIdle | No | command only | 2.1.33 |
| TaskCompleted | No | command, http, prompt, agent | 2.1.33 |
| ConfigChange | config source | command only | 2.1.49 |
| WorktreeCreate | No | command only | 2.1.50 |
| WorktreeRemove | No | command only | 2.1.50 |
| PreCompact | manual/auto | command only | ~2.1.50 |
| SessionEnd | exit reason | command only | 2.0.x |

## Hook Types (as of 2.1.63)

| Type | Description | Since |
|------|-------------|-------|
| command | Execute shell command | 2.0.x |
| prompt | Return text to agent | 2.0.x |
| agent | Spawn agent hook | 2.1.x |
| http | POST JSON to URL, receive JSON response | 2.1.63 |

## Notes

- **Turn duration**: Calculated client-side, not in JSONL - no data to index
Expand Down
3 changes: 3 additions & 0 deletions .claude/rules/database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Database Conventions
- Han Team Platform (#42)
- Han Team Platform (#42)
Loading
Loading