Initial commit: Flutter 无书应用项目

This commit is contained in:
Developer
2026-03-30 02:35:31 +08:00
commit 9175ff9905
566 changed files with 103261 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
---
name: planning-with-files
description: Manus-style file-based planning for complex tasks. Creates and maintains task_plan.md, findings.md, and progress.md under .kiro/plan/. Use when planning, breaking down work, resuming a multi-step task, tracking phases, or restoring context after compaction. Trigger phrases include start planning, continue task, resume work, current phase, restore context.
license: MIT
compatibility: Requires a POSIX shell or PowerShell, Python 3 for session-catchup, and read/write access to the workspace. See Kiro Agent Skills — https://kiro.dev/docs/skills/
allowed-tools: shell read write
metadata:
version: "3.0.0-kiro"
integration: kiro
---
# Planning with Files (Kiro)
Work like **Manus**: use persistent markdown as your **working memory on disk** while the model context behaves like volatile RAM. Deep background: [references/manus-principles.md](references/manus-principles.md).
Kiro complements this with:
- **Agent Skills** (this file) — progressive disclosure when the task matches the description.
- **Steering** — after bootstrap, `.kiro/steering/planning-context.md` uses `inclusion: auto` and `#[[file:…]]` live references ([Steering docs](https://kiro.dev/docs/steering/)).
**Hooks are not bundled:** project-level hooks affect every chat in the workspace. Prefer this skill + steering + the reminder block below.
---
## STEP 0 — Bootstrap (once per workspace)
From the **workspace root**:
```bash
sh .kiro/skills/planning-with-files/assets/scripts/bootstrap.sh
```
Windows (PowerShell):
```powershell
pwsh -ExecutionPolicy Bypass -File .kiro/skills/planning-with-files/assets/scripts/bootstrap.ps1
```
Creates:
- `.kiro/plan/task_plan.md`, `findings.md`, `progress.md`
- `.kiro/steering/planning-context.md` (auto + `#[[file:.kiro/plan/…]]`)
Idempotent: existing files are not overwritten.
**Import as a workspace skill (optional):** Kiro → *Agent Steering & Skills**Import a skill* → choose this `planning-with-files` folder ([Skills docs](https://kiro.dev/docs/skills/)).
---
## STEP 1 — Persistent reminder (after skill activation)
Append the following block to the **end of your reply**, and repeat it at the **end of subsequent replies** while this planning session is active:
> `[Planning Active]` Before each turn, read `.kiro/plan/task_plan.md` and `.kiro/plan/progress.md` to restore context.
---
## STEP 2 — Read plan every turn (while active)
1. Read `.kiro/plan/task_plan.md` — goal, phases, status
2. Read `.kiro/plan/progress.md` — recent actions
3. Use `.kiro/plan/findings.md` for research and decisions
If `.kiro/plan/` is missing, run STEP 0.
---
## STEP 3 — Session catchup (after a long gap or suspected drift)
Summaries + file mtimes (compare with `git diff --stat` if needed):
```bash
$(command -v python3 || command -v python) \
.kiro/skills/planning-with-files/assets/scripts/session-catchup.py "$(pwd)"
```
Windows:
```powershell
python .kiro/skills/planning-with-files/assets/scripts/session-catchup.py (Get-Location)
```
Then reconcile planning files with the actual codebase.
---
## Optional — Phase checklist
From workspace root (defaults to `.kiro/plan/task_plan.md`):
```bash
sh .kiro/skills/planning-with-files/assets/scripts/check-complete.sh
```
```powershell
pwsh -File .kiro/skills/planning-with-files/assets/scripts/check-complete.ps1
```
---
## Rules (summary)
Full detail: [references/planning-rules.md](references/planning-rules.md). Inline template skeletons: [references/planning-templates.md](references/planning-templates.md).
1. **Plan first** — no open-ended multi-step work without `task_plan.md`.
2. **2-action rule** — after every two view/search/browser steps, write to `findings.md`.
3. **Read before big decisions** — refresh `task_plan.md` into attention.
4. **Update after each phase**`in_progress``complete`, log errors.
5. **Never repeat the same failed action** — change tool, approach, or assumptions.
## When to use
**Use:** multi-step work, research, refactors, anything that spans many tool calls.
**Skip:** one-off questions, tiny single-file edits.
## Anti-patterns
| Avoid | Prefer |
|-------|--------|
| Goals only in chat | `.kiro/plan/task_plan.md` |
| Silent retries | Log errors; change approach |
| Huge pasted logs in chat | Append to `findings.md` or `progress.md` |

View File

@@ -0,0 +1,53 @@
# Bootstrap planning-with-files into the current workspace (idempotent).
# Run from the workspace root:
# pwsh -File .kiro/skills/planning-with-files/assets/scripts/bootstrap.ps1
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$SkillDir = (Resolve-Path (Join-Path $ScriptDir "..\..")).Path
$TemplatesSrc = Join-Path $SkillDir "assets\templates"
$ProjectDir = if ($env:PLANNING_PROJECT_ROOT) { $env:PLANNING_PROJECT_ROOT } else { (Get-Location).Path }
$PlanDest = Join-Path $ProjectDir ".kiro\plan"
$SteeringDest = Join-Path $ProjectDir ".kiro\steering"
Write-Host ""
Write-Host "planning-with-files (Kiro) — bootstrap"
Write-Host "Project: $ProjectDir"
Write-Host ""
Write-Host "[ Planning files → $PlanDest ]"
New-Item -ItemType Directory -Force -Path $PlanDest | Out-Null
$installed = 0
$skipped = 0
foreach ($tpl in @("task_plan.md", "findings.md", "progress.md")) {
$dest = Join-Path $PlanDest $tpl
$src = Join-Path $TemplatesSrc $tpl
if (Test-Path $dest) {
Write-Host " SKIP $tpl"
$skipped++
} else {
Copy-Item -Path $src -Destination $dest
Write-Host " OK $tpl"
$installed++
}
}
Write-Host ""
Write-Host "[ Steering → $SteeringDest ]"
New-Item -ItemType Directory -Force -Path $SteeringDest | Out-Null
$contextSrc = Join-Path $TemplatesSrc "planning-context.md"
$contextDest = Join-Path $SteeringDest "planning-context.md"
if (Test-Path $contextDest) {
Write-Host " SKIP planning-context.md"
} else {
Copy-Item -Path $contextSrc -Destination $contextDest
Write-Host " OK planning-context.md (auto inclusion + #[[file:]] references)"
}
Write-Host ""
Write-Host "Done. Planning files: .kiro/plan/"
Write-Host "Optional: import this folder as a Kiro workspace skill (Agent Steering & Skills → Import)."
Write-Host ""

View File

@@ -0,0 +1,52 @@
#!/usr/bin/env sh
# Bootstrap planning-with-files into the current workspace (idempotent).
# Run from the workspace root: sh .kiro/skills/planning-with-files/assets/scripts/bootstrap.sh
set -e
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname "$0")" && pwd)"
SKILL_DIR="$(CDPATH= cd -- "$SCRIPT_DIR/../.." && pwd)"
TEMPLATES_SRC="$SKILL_DIR/assets/templates"
PROJECT_DIR="${PLANNING_PROJECT_ROOT:-$(pwd)}"
PLAN_DEST="$PROJECT_DIR/.kiro/plan"
STEERING_DEST="$PROJECT_DIR/.kiro/steering"
echo ""
echo "planning-with-files (Kiro) — bootstrap"
echo "Project: $PROJECT_DIR"
echo ""
echo "[ Planning files → $PLAN_DEST ]"
mkdir -p "$PLAN_DEST"
installed_files=0
skipped_files=0
for tpl in task_plan.md findings.md progress.md; do
dest="$PLAN_DEST/$tpl"
if [ -f "$dest" ]; then
echo " SKIP $tpl"
skipped_files=$((skipped_files + 1))
else
cp "$TEMPLATES_SRC/$tpl" "$dest"
echo " OK $tpl"
installed_files=$((installed_files + 1))
fi
done
echo ""
echo "[ Steering → $STEERING_DEST ]"
mkdir -p "$STEERING_DEST"
CONTEXT_SRC="$TEMPLATES_SRC/planning-context.md"
CONTEXT_DEST="$STEERING_DEST/planning-context.md"
if [ -f "$CONTEXT_DEST" ]; then
echo " SKIP planning-context.md"
else
cp "$CONTEXT_SRC" "$CONTEXT_DEST"
echo " OK planning-context.md (auto inclusion + #[[file:]] references)"
fi
echo ""
echo "Done. Planning files: .kiro/plan/"
echo "Optional: import this folder as a Kiro workspace skill (Agent Steering & Skills → Import)."
echo ""

View File

@@ -0,0 +1,36 @@
# Report phase completion status for task_plan.md (stdout only, always exit 0).
# Default plan path: .kiro/plan/task_plan.md (relative to current directory).
param(
[string]$PlanFile = ".kiro/plan/task_plan.md"
)
if (-not (Test-Path $PlanFile)) {
Write-Host "[planning-with-files] No task plan at $PlanFile — run bootstrap or specify path."
exit 0
}
$content = Get-Content $PlanFile -Raw
$TOTAL = ([regex]::Matches($content, "### Phase")).Count
$COMPLETE = ([regex]::Matches($content, "\*\*Status:\*\* complete")).Count
$IN_PROGRESS = ([regex]::Matches($content, "\*\*Status:\*\* in_progress")).Count
$PENDING = ([regex]::Matches($content, "\*\*Status:\*\* pending")).Count
if ($COMPLETE -eq 0 -and $IN_PROGRESS -eq 0 -and $PENDING -eq 0) {
$COMPLETE = ([regex]::Matches($content, "\[complete\]")).Count
$IN_PROGRESS = ([regex]::Matches($content, "\[in_progress\]")).Count
$PENDING = ([regex]::Matches($content, "\[pending\]")).Count
}
if ($COMPLETE -eq $TOTAL -and $TOTAL -gt 0) {
Write-Host "[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL)."
} else {
Write-Host "[planning-with-files] In progress ($COMPLETE/$TOTAL phases complete)."
if ($IN_PROGRESS -gt 0) {
Write-Host "[planning-with-files] $IN_PROGRESS phase(s) in_progress."
}
if ($PENDING -gt 0) {
Write-Host "[planning-with-files] $PENDING phase(s) pending."
}
}
exit 0

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env sh
# Report phase completion status for task_plan.md (stdout only, always exit 0).
# Default plan path: .kiro/plan/task_plan.md (relative to current directory).
PLAN_FILE="${1:-.kiro/plan/task_plan.md}"
if [ ! -f "$PLAN_FILE" ]; then
echo "[planning-with-files] No task plan at $PLAN_FILE — run bootstrap or specify path."
exit 0
fi
TOTAL=$(grep -c "### Phase" "$PLAN_FILE" 2>/dev/null || echo 0)
COMPLETE=$(grep -cF "**Status:** complete" "$PLAN_FILE" 2>/dev/null || echo 0)
IN_PROGRESS=$(grep -cF "**Status:** in_progress" "$PLAN_FILE" 2>/dev/null || echo 0)
PENDING=$(grep -cF "**Status:** pending" "$PLAN_FILE" 2>/dev/null || echo 0)
if [ "$COMPLETE" -eq 0 ] && [ "$IN_PROGRESS" -eq 0 ] && [ "$PENDING" -eq 0 ]; then
COMPLETE=$(grep -c "\[complete\]" "$PLAN_FILE" 2>/dev/null || echo 0)
IN_PROGRESS=$(grep -c "\[in_progress\]" "$PLAN_FILE" 2>/dev/null || echo 0)
PENDING=$(grep -c "\[pending\]" "$PLAN_FILE" 2>/dev/null || echo 0)
fi
: "${TOTAL:=0}"
: "${COMPLETE:=0}"
: "${IN_PROGRESS:=0}"
: "${PENDING:=0}"
if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then
echo "[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL)."
else
echo "[planning-with-files] In progress ($COMPLETE/$TOTAL phases complete)."
if [ "$IN_PROGRESS" -gt 0 ]; then
echo "[planning-with-files] $IN_PROGRESS phase(s) in_progress."
fi
if [ "$PENDING" -gt 0 ]; then
echo "[planning-with-files] $PENDING phase(s) pending."
fi
fi
exit 0

View File

@@ -0,0 +1,121 @@
#!/usr/bin/env python3
"""
Session catchup for Kiro / planning-with-files.
Scans .kiro/plan/ for planning files and prints a short report (mtime + summary)
so the agent can re-orient after a context reset or long gap.
Usage:
python3 session-catchup.py [project_dir]
"""
from __future__ import annotations
import datetime
import os
import sys
def read_file_safe(path: str) -> str | None:
try:
with open(path, "r", encoding="utf-8") as f:
return f.read()
except OSError:
return None
def get_mtime_str(path: str) -> str:
try:
mtime = os.path.getmtime(path)
return datetime.datetime.fromtimestamp(mtime).strftime("%Y-%m-%d %H:%M:%S")
except OSError:
return "unknown"
def extract_section(content: str, heading: str) -> str | None:
lines = content.splitlines()
in_section = False
result: list[str] = []
for line in lines:
if line.startswith("## " + heading) or line.startswith("# " + heading):
in_section = True
continue
if in_section:
if line.startswith("## ") or line.startswith("# "):
break
result.append(line)
text = "\n".join(result).strip()
return text[:500] if text else None
def main() -> None:
project_dir = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else os.getcwd())
plan_dir = os.path.join(project_dir, ".kiro", "plan")
plan_files = {
"task_plan.md": os.path.join(plan_dir, "task_plan.md"),
"findings.md": os.path.join(plan_dir, "findings.md"),
"progress.md": os.path.join(plan_dir, "progress.md"),
}
found = {name: path for name, path in plan_files.items() if os.path.exists(path)}
if not found:
print("[planning-with-files] No planning files under .kiro/plan/. Run bootstrap first.")
sys.exit(0)
print("=" * 60)
print("[planning-with-files] SESSION CATCHUP REPORT")
print(f"Project: {project_dir}")
print("=" * 60)
for name, path in found.items():
mtime = get_mtime_str(path)
content = read_file_safe(path)
print(f"\n--- {name} (last modified: {mtime}) ---")
if not content:
print(" (empty)")
continue
if name == "task_plan.md":
goal = extract_section(content, "Goal")
current_phase = extract_section(content, "Current Phase")
if goal:
print(f" Goal: {goal[:200]}")
if current_phase:
print(f" Current Phase: {current_phase[:100]}")
for line in content.splitlines():
if "Status:" in line:
print(f" {line.strip()}")
elif name == "findings.md":
requirements = extract_section(content, "Requirements")
if requirements:
lines = [
l
for l in requirements.splitlines()
if l.strip() and not l.strip().startswith("<!--")
]
preview = "\n ".join(lines[:5])
if preview:
print(f" Requirements:\n {preview}")
elif name == "progress.md":
lines = [
l
for l in content.splitlines()
if l.strip() and not l.strip().startswith("<!--")
]
last_lines = lines[-8:] if len(lines) >= 8 else lines
if last_lines:
print(" Recent entries:")
for line in last_lines:
print(f" {line}")
print("\n" + "=" * 60)
print("Next: read the full files under .kiro/plan/, then `git diff --stat` if repo drift is suspected.")
print("=" * 60)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,95 @@
# Findings & Decisions
<!--
WHAT: Your knowledge base for the task. Stores everything you discover and decide.
WHY: Context windows are limited. This file is your "external memory" - persistent and unlimited.
WHEN: Update after ANY discovery, especially after 2 view/browser/search operations (2-Action Rule).
-->
## Requirements
<!--
WHAT: What the user asked for, broken down into specific requirements.
WHY: Keeps requirements visible so you don't forget what you're building.
WHEN: Fill this in during Phase 1 (Requirements & Discovery).
EXAMPLE:
- Command-line interface
- Add tasks
- List all tasks
- Delete tasks
- Python implementation
-->
<!-- Captured from user request -->
-
## Research Findings
<!--
WHAT: Key discoveries from web searches, documentation reading, or exploration.
WHY: Multimodal content (images, browser results) doesn't persist. Write it down immediately.
WHEN: After EVERY 2 view/browser/search operations, update this section (2-Action Rule).
EXAMPLE:
- Python's argparse module supports subcommands for clean CLI design
- JSON module handles file persistence easily
- Standard pattern: python script.py <command> [args]
-->
<!-- Key discoveries during exploration -->
-
## Technical Decisions
<!--
WHAT: Architecture and implementation choices you've made, with reasoning.
WHY: You'll forget why you chose a technology or approach. This table preserves that knowledge.
WHEN: Update whenever you make a significant technical choice.
EXAMPLE:
| Use JSON for storage | Simple, human-readable, built-in Python support |
| argparse with subcommands | Clean CLI: python todo.py add "task" |
-->
<!-- Decisions made with rationale -->
| Decision | Rationale |
|----------|-----------|
| | |
## Issues Encountered
<!--
WHAT: Problems you ran into and how you solved them.
WHY: Similar to errors in task_plan.md, but focused on broader issues (not just code errors).
WHEN: Document when you encounter blockers or unexpected challenges.
EXAMPLE:
| Empty file causes JSONDecodeError | Added explicit empty file check before json.load() |
-->
<!-- Errors and how they were resolved -->
| Issue | Resolution |
|-------|------------|
| | |
## Resources
<!--
WHAT: URLs, file paths, API references, documentation links you've found useful.
WHY: Easy reference for later. Don't lose important links in context.
WHEN: Add as you discover useful resources.
EXAMPLE:
- Python argparse docs: https://docs.python.org/3/library/argparse.html
- Project structure: src/main.py, src/utils.py
-->
<!-- URLs, file paths, API references -->
-
## Visual/Browser Findings
<!--
WHAT: Information you learned from viewing images, PDFs, or browser results.
WHY: CRITICAL - Visual/multimodal content doesn't persist in context. Must be captured as text.
WHEN: IMMEDIATELY after viewing images or browser results. Don't wait!
EXAMPLE:
- Screenshot shows login form has email and password fields
- Browser shows API returns JSON with "status" and "data" keys
-->
<!-- CRITICAL: Update after every 2 view/browser operations -->
<!-- Multimodal content must be captured as text immediately -->
-
---
<!--
REMINDER: The 2-Action Rule
After every 2 view/browser/search operations, you MUST update this file.
This prevents visual information from being lost when context resets.
-->
*Update this file after every 2 view/browser/search operations*
*This prevents visual information from being lost*

View File

@@ -0,0 +1,13 @@
---
inclusion: auto
name: planning-context
description: Active multi-step task context. Include when the user asks to continue a task, resume work, check current phase, show progress, or work on any ongoing planned project.
---
## Current Task Plan
#[[file:.kiro/plan/task_plan.md]]
## Recent Progress
#[[file:.kiro/plan/progress.md]]

View File

@@ -0,0 +1,114 @@
# Progress Log
<!--
WHAT: Your session log - a chronological record of what you did, when, and what happened.
WHY: Answers "What have I done?" in the 5-Question Reboot Test. Helps you resume after breaks.
WHEN: Update after completing each phase or encountering errors. More detailed than task_plan.md.
-->
## Session: [DATE]
<!--
WHAT: The date of this work session.
WHY: Helps track when work happened, useful for resuming after time gaps.
EXAMPLE: 2026-01-15
-->
### Phase 1: [Title]
<!--
WHAT: Detailed log of actions taken during this phase.
WHY: Provides context for what was done, making it easier to resume or debug.
WHEN: Update as you work through the phase, or at least when you complete it.
-->
- **Status:** in_progress
- **Started:** [timestamp]
<!--
STATUS: Same as task_plan.md (pending, in_progress, complete)
TIMESTAMP: When you started this phase (e.g., "2026-01-15 10:00")
-->
- Actions taken:
<!--
WHAT: List of specific actions you performed.
EXAMPLE:
- Created todo.py with basic structure
- Implemented add functionality
- Fixed FileNotFoundError
-->
-
- Files created/modified:
<!--
WHAT: Which files you created or changed.
WHY: Quick reference for what was touched. Helps with debugging and review.
EXAMPLE:
- todo.py (created)
- todos.json (created by app)
- task_plan.md (updated)
-->
-
### Phase 2: [Title]
<!--
WHAT: Same structure as Phase 1, for the next phase.
WHY: Keep a separate log entry for each phase to track progress clearly.
-->
- **Status:** pending
- Actions taken:
-
- Files created/modified:
-
## Test Results
<!--
WHAT: Table of tests you ran, what you expected, what actually happened.
WHY: Documents verification of functionality. Helps catch regressions.
WHEN: Update as you test features, especially during Phase 4 (Testing & Verification).
EXAMPLE:
| Add task | python todo.py add "Buy milk" | Task added | Task added successfully | ✓ |
| List tasks | python todo.py list | Shows all tasks | Shows all tasks | ✓ |
-->
| Test | Input | Expected | Actual | Status |
|------|-------|----------|--------|--------|
| | | | | |
## Error Log
<!--
WHAT: Detailed log of every error encountered, with timestamps and resolution attempts.
WHY: More detailed than task_plan.md's error table. Helps you learn from mistakes.
WHEN: Add immediately when an error occurs, even if you fix it quickly.
EXAMPLE:
| 2026-01-15 10:35 | FileNotFoundError | 1 | Added file existence check |
| 2026-01-15 10:37 | JSONDecodeError | 2 | Added empty file handling |
-->
<!-- Keep ALL errors - they help avoid repetition -->
| Timestamp | Error | Attempt | Resolution |
|-----------|-------|---------|------------|
| | | 1 | |
## 5-Question Reboot Check
<!--
WHAT: Five questions that verify your context is solid. If you can answer these, you're on track.
WHY: This is the "reboot test" - if you can answer all 5, you can resume work effectively.
WHEN: Update periodically, especially when resuming after a break or context reset.
THE 5 QUESTIONS:
1. Where am I? → Current phase in task_plan.md
2. Where am I going? → Remaining phases
3. What's the goal? → Goal statement in task_plan.md
4. What have I learned? → See findings.md
5. What have I done? → See progress.md (this file)
-->
<!-- If you can answer these, context is solid -->
| Question | Answer |
|----------|--------|
| Where am I? | Phase X |
| Where am I going? | Remaining phases |
| What's the goal? | [goal statement] |
| What have I learned? | See findings.md |
| What have I done? | See above |
---
<!--
REMINDER:
- Update after completing each phase or encountering errors
- Be detailed - this is your "what happened" log
- Include timestamps for errors to track when issues occurred
-->
*Update after completing each phase or encountering errors*

View File

@@ -0,0 +1,132 @@
# Task Plan: [Brief Description]
<!--
WHAT: This is your roadmap for the entire task. Think of it as your "working memory on disk."
WHY: After 50+ tool calls, your original goals can get forgotten. This file keeps them fresh.
WHEN: Create this FIRST, before starting any work. Update after each phase completes.
-->
## Goal
<!--
WHAT: One clear sentence describing what you're trying to achieve.
WHY: This is your north star. Re-reading this keeps you focused on the end state.
EXAMPLE: "Create a Python CLI todo app with add, list, and delete functionality."
-->
[One sentence describing the end state]
## Current Phase
<!--
WHAT: Which phase you're currently working on (e.g., "Phase 1", "Phase 3").
WHY: Quick reference for where you are in the task. Update this as you progress.
-->
Phase 1
## Phases
<!--
WHAT: Break your task into 3-7 logical phases. Each phase should be completable.
WHY: Breaking work into phases prevents overwhelm and makes progress visible.
WHEN: Update status after completing each phase: pending → in_progress → complete
-->
### Phase 1: Requirements & Discovery
<!--
WHAT: Understand what needs to be done and gather initial information.
WHY: Starting without understanding leads to wasted effort. This phase prevents that.
-->
- [ ] Understand user intent
- [ ] Identify constraints and requirements
- [ ] Document findings in findings.md
- **Status:** in_progress
<!--
STATUS VALUES:
- pending: Not started yet
- in_progress: Currently working on this
- complete: Finished this phase
-->
### Phase 2: Planning & Structure
<!--
WHAT: Decide how you'll approach the problem and what structure you'll use.
WHY: Good planning prevents rework. Document decisions so you remember why you chose them.
-->
- [ ] Define technical approach
- [ ] Create project structure if needed
- [ ] Document decisions with rationale
- **Status:** pending
### Phase 3: Implementation
<!--
WHAT: Actually build/create/write the solution.
WHY: This is where the work happens. Break into smaller sub-tasks if needed.
-->
- [ ] Execute the plan step by step
- [ ] Write code to files before executing
- [ ] Test incrementally
- **Status:** pending
### Phase 4: Testing & Verification
<!--
WHAT: Verify everything works and meets requirements.
WHY: Catching issues early saves time. Document test results in progress.md.
-->
- [ ] Verify all requirements met
- [ ] Document test results in progress.md
- [ ] Fix any issues found
- **Status:** pending
### Phase 5: Delivery
<!--
WHAT: Final review and handoff to user.
WHY: Ensures nothing is forgotten and deliverables are complete.
-->
- [ ] Review all output files
- [ ] Ensure deliverables are complete
- [ ] Deliver to user
- **Status:** pending
## Key Questions
<!--
WHAT: Important questions you need to answer during the task.
WHY: These guide your research and decision-making. Answer them as you go.
EXAMPLE:
1. Should tasks persist between sessions? (Yes - need file storage)
2. What format for storing tasks? (JSON file)
-->
1. [Question to answer]
2. [Question to answer]
## Decisions Made
<!--
WHAT: Technical and design decisions you've made, with the reasoning behind them.
WHY: You'll forget why you made choices. This table helps you remember and justify decisions.
WHEN: Update whenever you make a significant choice (technology, approach, structure).
EXAMPLE:
| Use JSON for storage | Simple, human-readable, built-in Python support |
-->
| Decision | Rationale |
|----------|-----------|
| | |
## Errors Encountered
<!--
WHAT: Every error you encounter, what attempt number it was, and how you resolved it.
WHY: Logging errors prevents repeating the same mistakes. This is critical for learning.
WHEN: Add immediately when an error occurs, even if you fix it quickly.
EXAMPLE:
| FileNotFoundError | 1 | Check if file exists, create empty list if not |
| JSONDecodeError | 2 | Handle empty file case explicitly |
-->
| Error | Attempt | Resolution |
|-------|---------|------------|
| | 1 | |
## Notes
<!--
REMINDERS:
- Update phase status as you progress: pending → in_progress → complete
- Re-read this plan before major decisions (attention manipulation)
- Log ALL errors - they help avoid repetition
- Never repeat a failed action - mutate your approach instead
-->
- Update phase status as you progress: pending → in_progress → complete
- Re-read this plan before major decisions (attention manipulation)
- Log ALL errors - they help avoid repetition

View File

@@ -0,0 +1,121 @@
# Manus context engineering (reference)
This workflow is inspired by **Manus**-style context engineering: treat markdown on disk as durable working memory while the model context window behaves like volatile RAM.
**Kiro layout:** planning files live under **`.kiro/plan/`** (not the project root). See [Kiro Steering — file references](https://kiro.dev/docs/steering/) for `#[[file:path]]` live includes.
---
# Reference: Manus Context Engineering Principles
This skill is based on context engineering principles from Manus, the AI agent company acquired by Meta for $2 billion in December 2025.
## The 6 Manus Principles
### Principle 1: Design Around KV-Cache
> "KV-cache hit rate is THE single most important metric for production AI agents."
**Statistics:**
- ~100:1 input-to-output token ratio
- Cached tokens: $0.30/MTok vs Uncached: $3/MTok
- 10x cost difference!
**Implementation:**
- Keep prompt prefixes STABLE (single-token change invalidates cache)
- NO timestamps in system prompts
- Make context APPEND-ONLY with deterministic serialization
### Principle 2: Mask, Don't Remove
Don't dynamically remove tools (breaks KV-cache). Use logit masking instead.
**Best Practice:** Use consistent action prefixes (e.g., `browser_`, `shell_`, `file_`) for easier masking.
### Principle 3: Filesystem as External Memory
> "Markdown is my 'working memory' on disk."
**The Formula:**
```
Context Window = RAM (volatile, limited)
Filesystem = Disk (persistent, unlimited)
```
**Compression Must Be Restorable:**
- Keep URLs even if web content is dropped
- Keep file paths when dropping document contents
- Never lose the pointer to full data
### Principle 4: Manipulate Attention Through Recitation
> "Creates and updates todo.md throughout tasks to push global plan into model's recent attention span."
**Problem:** After ~50 tool calls, models forget original goals ("lost in the middle" effect).
**Solution:** Re-read `.kiro/plan/task_plan.md` before major decisions. Goals appear in the attention window.
### Principle 5: Keep the Wrong Stuff In
> "Leave the wrong turns in the context."
**Why:**
- Failed actions with stack traces let model implicitly update beliefs
- Reduces mistake repetition
- Error recovery is "one of the clearest signals of TRUE agentic behavior"
### Principle 6: Don't Get Few-Shotted
> "Uniformity breeds fragility."
**Problem:** Repetitive action-observation pairs cause drift and hallucination.
**Solution:** Introduce controlled variation:
- Vary phrasings slightly
- Don't copy-paste patterns blindly
- Recalibrate on repetitive tasks
---
## The 3 Context Engineering Strategies
Based on Lance Martin's analysis of Manus architecture.
### Strategy 1: Context Reduction
**Compaction:**
```
Tool calls have TWO representations:
├── FULL: Raw tool content (stored in filesystem)
└── COMPACT: Reference/file path only
RULES:
- Apply compaction to STALE (older) tool results
- Keep RECENT results FULL (to guide next decision)
```
### Strategy 2: Context Isolation (Multi-Agent)
Multi-agent setups can isolate exploration in separate contexts while persisting shared state in files (e.g. under `.kiro/plan/`).
### Strategy 3: Context Offloading
- Store full results in the filesystem, not only in context
- Progressive disclosure: load information only as needed
---
## File Types (Kiro paths)
| File | Purpose |
|------|---------|
| `.kiro/plan/task_plan.md` | Phase tracking, progress |
| `.kiro/plan/findings.md` | Discoveries, decisions |
| `.kiro/plan/progress.md` | Session log |
---
## Source
Manus context engineering blog:
https://manus.im/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus

View File

@@ -0,0 +1,45 @@
# Planning rules (full reference)
All paths below are under the workspace root.
## The 3-Strike Error Protocol
```
ATTEMPT 1: Diagnose & Fix
ATTEMPT 2: Alternative approach (never repeat the exact same failing action)
ATTEMPT 3: Broader rethink; update the plan if needed
AFTER 3 FAILURES: Escalate to the user with evidence
```
## Read vs Write Decision Matrix
| Situation | Action |
|-----------|--------|
| Just wrote a file | Do not re-read unless stale |
| Viewed image/PDF/browser output | Write to `.kiro/plan/findings.md` immediately |
| Starting a new phase | Read `.kiro/plan/task_plan.md` and `findings.md` |
| Resuming after a gap | Read all files under `.kiro/plan/` |
## The 5-Question Reboot Test
| Question | Answer source |
|----------|----------------|
| Where am I? | `.kiro/plan/task_plan.md` |
| Where am I going? | Remaining phases in `task_plan.md` |
| What's the goal? | Goal section in `task_plan.md` |
| What have I learned? | `.kiro/plan/findings.md` |
| What have I done? | `.kiro/plan/progress.md` |
## Phase status values
- `pending` — not started
- `in_progress` — active
- `complete` — done
## Error log (in `task_plan.md`)
```markdown
## Errors Encountered
| Error | Attempt | Resolution |
|-------|---------|------------|
```

View File

@@ -0,0 +1,100 @@
# Planning file templates (reference)
Bootstrap copies the canonical templates from `assets/templates/` into `.kiro/plan/`. This page is a **compact reference** (inline skeletons) when you need to paste structure without opening those files.
To use as a Kiro **manual steering** document, copy this file to `.kiro/steering/planning-templates.md` and add front matter:
```yaml
---
inclusion: manual
name: planning-templates
description: Markdown templates for task_plan, findings, and progress.
---
```
---
## task_plan.md
```markdown
# Task Plan
## Goal
[One sentence describing the end state]
## Current Phase
Phase X: [Name] - [Status]
## Phases
### Phase 1: [Name]
**Status:** pending | in_progress | complete
- [ ] Step 1
- [ ] Step 2
### Phase 2: [Name]
**Status:** pending
- [ ] Step 1
- [ ] Step 2
## Key Questions
- Question 1?
- Question 2?
## Decisions Made
| Decision | Rationale | Date |
|----------|-----------|------|
## Errors Encountered
| Error | Attempt | Resolution |
|-------|---------|------------|
```
## findings.md
```markdown
# Findings
## Requirements
- Requirement 1
- Requirement 2
## Research Findings
### [Topic 1]
- Finding 1
- Finding 2
## Technical Decisions
| Decision | Options Considered | Chosen | Why |
|----------|-------------------|--------|-----|
## Resources
- [Resource 1](url)
- [Resource 2](url)
```
## progress.md
```markdown
# Progress Log
## Session: [Date]
**Phase:** [Current phase]
**Start Time:** [Time]
### Actions Taken
1. Action 1
2. Action 2
### Files Modified
- `file1.js` — Added feature X
- `file2.py` — Fixed bug Y
### Test Results
| Test | Input | Expected | Actual | Status |
|------|-------|----------|--------|--------|
### Error Log
| Time | Error | Attempt | Resolution |
|------|-------|---------|------------|
```