Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6ebbdf2
feat(hooks): implement user-configurable lifecycle hooks system (FEAT…
IndenScale Feb 13, 2026
83bc2fb
docs(issues): fix frontmatter format for hooks system issues
IndenScale Feb 13, 2026
8bcad31
feat(issues): close FEAT-0001 - hooks system core architecture completed
IndenScale Feb 13, 2026
13367a4
feat(hooks): implement session lifecycle hooks integration (FEAT-0002)
IndenScale Feb 13, 2026
bc5e1ac
chore(issue): update FEAT-0002
IndenScale Feb 13, 2026
8932819
chore(issues): update EPIC-0001 to mark FEAT-0002 as completed
IndenScale Feb 13, 2026
4fcc48e
feat(hooks): implement tool interception hooks (FEAT-0003)
IndenScale Feb 13, 2026
bfe508a
docs(issue): add review comments to FEAT-0003
IndenScale Feb 13, 2026
d43ea24
chore(issue): review FEAT-0003
IndenScale Feb 13, 2026
44c1c1e
chore(issue): closed FEAT-0003
IndenScale Feb 13, 2026
62565a0
docs(epic): update EPIC-0001 progress - FEAT-0002 and FEAT-0003 compl…
IndenScale Feb 13, 2026
675ccae
chore(issue): move FEAT-0003 to closed status
IndenScale Feb 13, 2026
ee39103
close(issue): FEAT-0004 高级钩子类型与调试能力 - completed
IndenScale Feb 13, 2026
9def1c2
fix(issue): FEAT-0004 移除重复的 solution 字段
IndenScale Feb 13, 2026
19bcd93
chore(issue): update FEAT-0004
IndenScale Feb 13, 2026
9d8a16d
feat(hooks): FEAT-0004 高级钩子类型与调试能力
IndenScale Feb 13, 2026
4deb66a
refactor(hooks): simplify hooks system to command-only type
IndenScale Feb 13, 2026
57956c5
feat(hooks): 发布 hooks 特性
IndenScale Feb 13, 2026
41cc245
chore: 从 Git 移除 monoco 相关目录并添加到 .gitignore
IndenScale Feb 13, 2026
144a673
fix(hooks): enforce-tests 只运行单元测试,缩短超时时间
IndenScale Feb 13, 2026
e0c85a3
fix(tests): 修复测试并优化 enforce-tests hook
IndenScale Feb 13, 2026
abf461f
fix(hooks): disable test execution in enforce-tests hook to prevent b…
IndenScale Feb 13, 2026
05a43ca
fix(hooks): address Devin Review feedback
IndenScale Feb 13, 2026
7c6d9d5
fix(hooks): address Devin Review feedback from round 2
IndenScale Feb 13, 2026
98c7319
docs(configuration): update hooks documentation to Agent Hooks standard
IndenScale Feb 14, 2026
22d28e8
refactor(agenthooks): standardize hook triggers with pre/post-event p…
IndenScale Feb 14, 2026
4432dd0
refactor(hooks): remove legacy trigger aliases and compatibility code
IndenScale Feb 14, 2026
cf5d1c0
feat(hooks): add /hooks slash command for displaying AgentHooks
IndenScale Feb 14, 2026
310c641
fix(hooks): remove global AGENTS.md pollution from project file
IndenScale Feb 14, 2026
1804b23
fix(hooks): address Devin Review feedback round 3
IndenScale Feb 15, 2026
0b32cde
fix(agenthooks): remove tracked log file and update .gitignore
IndenScale Feb 15, 2026
c7911ff
fix(agenthooks): address Devin Review feedback round 4
IndenScale Feb 15, 2026
a19831e
feat(agenthooks): print hook stderr to UI for all events
IndenScale Feb 21, 2026
d3fe4b7
WIP: local changes before rebase
IndenScale Mar 13, 2026
4231974
feat(ui): optimize path display in tool arguments
IndenScale Mar 22, 2026
d7071ec
fix: remove undefined debug_hooks residue from upstream sync
IndenScale Mar 22, 2026
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
43 changes: 43 additions & 0 deletions .agent/skills/engineer/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: engineer
description: Engineer Role - Responsible for code implementation, testing, and submitting changes
type: role
version: 1.0.0
author: Monoco
---

# Engineer Role

Engineer Role - Responsible for code implementation, testing, and submitting changes

# Identity
You are the **Engineer Agent** powered by Monoco, responsible for specific code implementation and delivery.

# Core Workflow
Your core workflow defined in `workflow-dev` includes the following phases:
1. **setup**: Use monoco issue start --branch to create feature branch
2. **investigate**: Deeply understand Issue requirements and context
3. **implement**: Write clean, maintainable code on the feature branch
4. **test**: Write and pass unit tests to ensure no regressions
5. **report**: Sync file tracking, record changes
6. **submit**: Submit code and request Review

# Mindset
- **TDD**: Test-driven development, write tests before implementation
- **KISS**: Keep code simple and intuitive, avoid over-engineering
- **Quality**: Code quality is the first priority

# Rules
- Strictly prohibited from directly modifying code on Trunk (main/master)
- Must use monoco issue start --branch to create feature branch
- All unit tests must pass before submission
- One logical unit per commit, maintain reviewability


## Mindset & Preferences

- TDD: Encourage test-driven development
- KISS: Keep code simple and intuitive
- Branching: Strictly prohibited from direct modification on Trunk (main/master), must use monoco issue start to create Branch
- Small Commits: Commit in small steps, frequently sync file tracking
- Test Coverage: Prioritize writing tests, ensure test coverage
61 changes: 61 additions & 0 deletions .agent/skills/monoco_atom_doc_convert/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: monoco_atom_doc_convert
description: Document conversion and intelligent analysis - Use LibreOffice to convert Office/PDF documents to analyzable formats
type: atom
---

## Document Intelligence

When analyzing Office documents (.docx, .xlsx, .pptx, etc.) or PDFs, use this workflow.

### Core Principles

1. **No external GPU services** - Do not use MinerU or other parsing services requiring task queues
2. **Leverage existing Vision capabilities** - Kimi CLI / Claude Code have built-in visual analysis capabilities
3. **Synchronous LibreOffice calls** - Local conversion, no background services needed

### Conversion Workflow

**Step 1: Check LibreOffice Availability**

```bash
which soffice
```

**Step 2: Convert Document to PDF**

```bash
soffice --headless --convert-to pdf "{input_path}" --outdir "{output_dir}"
```

**Step 3: Use Vision Capabilities for Analysis**

The converted PDF can be directly analyzed using the Agent's visual capabilities, no additional OCR needed.

### Supported Formats

| Input Format | Conversion Method | Notes |
|-------------|-------------------|-------|
| .docx | LibreOffice → PDF | Word documents |
| .xlsx | LibreOffice → PDF | Excel spreadsheets |
| .pptx | LibreOffice → PDF | PowerPoint presentations |
| .odt | LibreOffice → PDF | OpenDocument format |
| .pdf | Use directly | No conversion needed |

### Best Practices

- **Temporary file management**: Convert output to `/tmp/` or project `.monoco/tmp/`
- **Caching strategy**: If caching parsing results is needed, use ArtifactManager for storage
- **Error handling**: Report specific error messages to users when conversion fails

### Example

Analyze a Word document:

```bash
# Convert
soffice --headless --convert-to pdf "./report.docx" --outdir "./tmp"

# Analyze (using vision capabilities)
# Then read ./tmp/report.pdf for analysis
```
83 changes: 83 additions & 0 deletions .agent/skills/monoco_atom_doc_extract/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: monoco_atom_doc_extract
description: Extract documents to WebP pages for VLM analysis - Convert PDF, Office, Images to standardized WebP format
type: atom
---

## Document Extraction

Extract documents to WebP pages suitable for Vision Language Model (VLM) analysis.

### When to Use

Use this skill when you need to:
- Analyze PDF documents with visual capabilities
- Process Office documents (DOCX, PPTX, XLSX) for content extraction
- Convert images or scanned documents to page sequences
- Handle documents from ZIP archives

### Commands

**Extract a document:**

```bash
monoco doc-extractor extract <file_path> [--dpi 150] [--quality 85] [--pages "1-5,10"]
```

**List extracted documents:**

```bash
monoco doc-extractor list [--category pdf] [--limit 20]
```

**Search documents:**

```bash
monoco doc-extractor search <query>
```

**Show document details:**

```bash
monoco doc-extractor show <hash_prefix>
monoco doc-extractor cat <hash_prefix> # Show metadata JSON
```

### Parameters

| Parameter | Default | Description |
|-----------|---------|-------------|
| `--dpi` | 150 | DPI for rendering (72-300) |
| `--quality` | 85 | WebP quality (1-100) |
| `--pages` | all | Page range (e.g., "1-5,10,15-20") |

### Output

Documents are stored in `~/.monoco/blobs/{sha256_hash}/`:
- `source.{ext}` - Original file
- `source.pdf` - Normalized PDF
- `pages/*.webp` - Rendered page images
- `meta.json` - Document metadata

### Example

```bash
# Extract a PDF with high quality
monoco doc-extractor extract ./report.pdf --dpi 200 --quality 90

# Extract specific pages from a document
monoco doc-extractor extract ./presentation.pptx --pages "1-10"

# List all PDF documents
monoco doc-extractor list --category pdf

# Show details of extracted document
monoco doc-extractor show a1b2c3d4
```

### Best Practices

- Use `--dpi 200` or higher for documents with small text
- Use `--quality 90` for better image quality (larger files)
- Extracted documents are cached by content hash - re-extraction is instant
- Archives (ZIP) are automatically extracted and processed
49 changes: 49 additions & 0 deletions .agent/skills/principal/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: principal
description: Principal Engineer Role - Responsible for architecture design, technical planning, and requirements modeling
type: role
version: 1.0.0
author: Monoco
---

# Principal Role

Principal Engineer Role - Responsible for architecture design, technical planning, and requirements modeling

# Identity
You are the **Principal Engineer Agent** powered by Monoco, responsible for architecture design, technical planning, and requirements modeling.

This role consolidates the former Manager and Planner responsibilities:
- **Requirements Management**: Extract requirements from Memos/feedback and transform them into clear Issues
- **Architecture Design**: Produce architecture design documents (ADRs) and implementation plans
- **Task Assignment**: Decompose into independently deliverable subtasks

# Core Workflow
Your core workflow includes the following phases:
1. **extract**: Extract key information from requirements
2. **analyze**: Fully understand requirements and context
3. **design**: Produce architecture design solutions
4. **plan**: Create executable task plans
5. **handoff**: Hand over tasks to Engineer

# Mindset
- **Evidence Based**: All decisions must be supported by evidence
- **Incremental**: Prioritize incremental design, avoid over-engineering
- **Clarity First**: Requirements must be clear before assignment
- **Vertical Slicing**: Decompose into independently deliverable subtasks

# Rules
- Write design documents before creating implementation tasks
- Every task must have clear acceptance criteria
- Complex tasks must be decomposed into Epic + Features
- Provide complete context and implementation guidance for Engineers


## Mindset & Preferences

- Evidence Based: All architectural decisions must be supported by code or documentation evidence
- Incremental Design: Prioritize incremental design, avoid over-engineering
- Clear Boundaries: Define clear module boundaries and interface contracts
- Document First: Write design documents before creating implementation tasks
- 5W2H: Use 5W2H analysis to clarify requirements
- Vertical Slicing: Decompose tasks into vertically sliced deliverables
41 changes: 41 additions & 0 deletions .agent/skills/reviewer/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: reviewer
description: Reviewer Role - Responsible for code quality checks and adversarial testing
type: role
version: 1.0.0
author: Monoco
---

# Reviewer Role

Reviewer Role - Responsible for code quality checks and adversarial testing

# Identity
You are the **Reviewer Agent** powered by Monoco, responsible for code quality checks.

# Core Workflow
Your core workflow defined in `workflow-review` adopts a **dual defense system**:
1. **checkout**: Acquire code pending review
2. **verify**: Verify tests submitted by Engineer (White-box)
3. **challenge**: Adversarial testing, attempt to break code (Black-box)
4. **review**: Code review, check quality and maintainability
5. **decide**: Make decisions to approve, reject, or request changes

# Mindset
- **Double Defense**: Verify + Challenge
- **Try to Break It**: Find edge cases and security vulnerabilities
- **Quality First**: Quality is the first priority

# Rules
- Must pass Engineer's tests (Verify) first, then conduct challenge tests (Challenge)
- Must attempt to write at least one edge test case
- Prohibited from approving without testing
- Merge valuable Challenge Tests into codebase


## Mindset & Preferences

- Double Defense: Dual defense system - Engineer self-verification (Verify) + Reviewer challenge (Challenge)
- Try to Break It: Attempt to break code, find edge cases
- No Approve Without Test: Prohibited from approving without testing
- Challenge Tests: Retain valuable Challenge Tests and submit to codebase
1 change: 1 addition & 0 deletions .agents/hooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.logs/
113 changes: 113 additions & 0 deletions .agents/hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Kimi CLI Agent Hooks

This directory contains [Agent Hooks](https://github.com/yourorg/agenthooks) for dogfooding the hooks system in Kimi CLI.

## Hooks Overview

| Hook | Trigger | Purpose | Priority | Async |
| -------------------------- | --------------- | -------------------------------------------------- | -------- | ----- |
| `block-dangerous-commands` | `before_tool` | Security hook that blocks dangerous shell commands | 999 | No |
| `enforce-tests` | `before_stop` | Quality gate ensuring tests pass before completion | 999 | No |
| `auto-format-python` | `after_tool` | Auto-formats Python files with black after write | 100 | Yes |
| `session-logger` | `session_start` | Logs session start events | 50 | Yes |
| `session-logger-end` | `session_end` | Logs session end events | 50 | Yes |

## Quick Test

### Test Security Hook

```bash
# This should be blocked by the security hook (exit code 2)
echo '{"event_type":"before_tool","tool_name":"Shell","tool_input":{"command":"rm -rf /"}}' | .agents/hooks/block-dangerous-commands/scripts/run.sh
echo "Exit code: $?" # Should be 2

# This should be allowed (exit code 0)
echo '{"event_type":"before_tool","tool_name":"Shell","tool_input":{"command":"ls -la"}}' | .agents/hooks/block-dangerous-commands/scripts/run.sh
echo "Exit code: $?" # Should be 0
```

### Test Auto-Format Hook

```bash
# Create a poorly formatted Python file
cat > /tmp/test_format.py << 'EOF'
x=1+2
def foo( ):
return x
EOF

# Run the hook
echo '{"event_type":"after_tool","tool_name":"WriteFile","tool_input":{"file_path":"/tmp/test_format.py"}}' | .agents/hooks/auto-format-python/scripts/run.sh

# Check the formatted file
cat /tmp/test_format.py
rm /tmp/test_format.py
```

### Test Session Logger

```bash
# Log a session start
echo '{"event_type":"session_start","session_id":"test-123","timestamp":"2024-01-15T10:30:00Z","work_dir":"'$(pwd)'"}' | .agents/hooks/session-logger/scripts/run.sh

# Log a session end
echo '{"event_type":"session_end","session_id":"test-123","duration_seconds":3600,"work_dir":"'$(pwd)'","exit_reason":"user_exit"}' | .agents/hooks/session-logger-end/scripts/run.sh

# Check the log
cat .agents/hooks/.logs/session.log
```

## Python API Test

```python
import asyncio
from kimi_cli.hooks import HookDiscovery, HookExecutor
from pathlib import Path

async def test():
# Discover hooks
discovery = HookDiscovery(Path('.').absolute())
hooks = discovery.discover()
print(f"Discovered {len(hooks)} hook(s)")

# Get security hook
security_hook = discovery.get_hook_by_name('block-dangerous-commands')

# Test event
event_data = {
'event_type': 'before_tool',
'timestamp': '2024-01-15T10:30:00Z',
'session_id': 'test-123',
'work_dir': str(Path('.').absolute()),
'tool_name': 'Shell',
'tool_input': {'command': 'rm -rf /'},
'tool_use_id': 'tool_123'
}

# Execute hook
executor = HookExecutor()
result = await executor.execute(security_hook, event_data)
print(f"Should block: {result.should_block}")
print(f"Reason: {result.reason}")

asyncio.run(test())
```

## Dogfooding Goals

1. **Security**: Prevent accidental data loss from dangerous commands
2. **Code Quality**: Ensure consistent formatting and passing tests
3. **Audit**: Track session activity for analysis

## Configuration

Hooks are discovered from:

- Project-level: `./.agents/hooks/` (this directory)
- User-level: `~/.config/agents/hooks/`

See [AgentHooks Specification](../../agenthooks/docs/en/SPECIFICATION.md) for full details.

## CI Note

The `.logs/` directory is gitignored to prevent session logs from being committed.
Loading