35 Commits

Author SHA1 Message Date
Val-sss
5a6803fc30 release: v2.1.0 — ReAct多轮交互循环,Eval 22%→53% (26/50 PASS)
新增ReAct循环(kaiwu/agent/react_loop.py):
- 工具集: read_file/write_file/run_test/grep/list_dir/submit
- 门控: retry_count≥1时触发,小模型5步/中8步/大10步
- 上下文管理: 保留system+初始user+最近6轮,早期压缩
- 安全: 写入前Python语法检查,禁写测试文件,失败恢复

Eval结果 (qwen2.5-coder:32b-instruct-q4_K_M, 50题):
- 总通过率: 26/50 (53%), 对比v2.0.0的8/36(22%)提升141%
- Go题: 6/9 PASS (t42/t43/t44/t46/t56/t57)
- 多文件API: 3/3 全过 (t51/t52/t53)
- 综合题: t10_comprehensive PASS (425s, 之前timeout)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-14 07:11:38 +08:00
Val-sss
01f8dccc06 release: v2.0.0 — Eval驱动架构升级,数据量化验证每个改动
核心成果:Eval 0%→20% (3/15 PASS),总测试通过数 294→377 (+28%)

新增:
- usage_finder: AST确定性调用关系传递
- bug_decomposed: 多bug任务逐TestClass拆解修复
- 新文件创建: _maybe_create_missing_module
- 工程约束注入: _detect_engineering_hints
- 自适应采样: 大文件1次/小文件3次
- bench诊断报告系统: bench_diagnose.py

实验验证(数据说话):
- diff格式对32B弊大于利(超时),已回滚
- 自适应采样解决超时但降低多样性
- usage_finder/bug_decomposed机制有效但受模型能力限制

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-10 15:59:59 +08:00
Val-sss
2c4d792baa feat: v1.7.0 KAIJU架构借鉴 — bounded context + sub-task decomposition + DetailedLogger
三个核心改动:
1. Generator bounded context: 只传当前函数代码+相关failing tests,不传完整历史
2. 存根任务sub-task decomposition: 多pass函数逐个独立实现,每个函数独立context
3. DetailedLogger完整流水线日志: 不截断LLM输入输出,记录各节点IO和工程决策

附带修复:
- OpenAI兼容API检测: localhost非标准端口探测/api/tags判断是否Ollama
- LLM Backend on_call钩子: 每次调用自动触发回调记录

513 tests passed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 18:24:56 +08:00
Val-sss
ca55970ad8 release: v1.6.2 版本号统一 + README/CHANGELOG/STATUS更新
- 版本号统一到1.6.2(pyproject/__init__/formatters/telemetry/server)
- README: badge 1.6.2, License Apache-2.0, 更新日志加v1.6.2条目
- CHANGELOG: 完整v1.6.2变更记录
- STATUS: 当前版本更新到v1.6.2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 14:42:21 +08:00
Val-sss
fa1390f8a9 release: v1.6.1 版本号统一 + README/STATUS更新 + License Apache-2.0
- pyproject.toml/formatters/telemetry/server/models/__init__ 全部统一到 1.6.1
- README: badge更新、更新日志加v1.6.0/v1.6.1条目
- STATUS: 版本号描述更新

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 09:23:19 +08:00
Val-sss
892e8062bc release: v1.5.1 — update docs, fix remaining audit issues
- GENERATOR_PROMPT: negative indent instruction → positive ("必须4空格,与原文件完全一致")
- ast_grep_engine: json.loads wrapped in try/except (5th JSON protection)
- STATUS.md: updated to reflect all v1.5.1 features (501 tests)
- CHANGELOG.md: full v1.5.1 release notes (flywheel, telemetry, hashline, adaptthink, audit, model_capability)
- README.md: version badge 1.5.1, updated changelog table

501 tests green, 0 regression.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 21:11:45 +08:00
Val-sss
0f1fe8ab76 docs: update README banner to v1.5.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 18:46:02 +08:00
Val-sss
40edbf6076 docs: update README v1.5.0 + unify comments to Chinese
- README: add v1.5.0 changelog entry, SearchSubagent architecture section
- README: version badge 1.4.0 → 1.5.0, add contract_violation to error routes
- Comments: English → Chinese in orchestrator/context/generator/locator
- Comments: remove decorative # ── xxx ── separator lines

451/451 tests green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 17:59:34 +08:00
Val-sss
a502c9db63 feat: v1.4.0 多语言AST + FastAPI Server + Textual TUI + VSCode插件
三个模块按顺序实施,424测试全绿:

模块A - 多语言支持:
- ast-grep预定义模板查询(LLM只填参数不写pattern)
- TreeSitterParser扩展支持JS/TS/Go/Rust/Java(可选依赖)
- 多语言Verifier(jest/go test/cargo test/mvn test)
- 4个新SKILL.md(golang/typescript/rust/java)

模块B - Server + TUI:
- FastAPI + SSE事件流,端口7355
- kwcode serve命令 + kwcode --tui选项
- Textual TUI(文件树+事件流+输入框)
- pipeline_factory共享构建

模块C - VSCode插件:
- 薄客户端连接kwcode server
- SSE事件流 + Webview面板
- 文件保存触发RIG刷新

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 14:57:16 +08:00
Val-sss
f6af3845df chore: bump version to 1.3.0 for PyPI release
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 13:42:59 +08:00
Val-sss
0f3c9e6e61 feat: v1.3.0 架构升级 — EventBus/ToolGateway/错误策略路由/认知门控/渐进压缩/Wink自修复/SearchRouter
10个模块实现:
- EventBus 统一事件总线(append-only日志+replay)
- ToolGateway 专家权限隔离(deny-first+文件缓存)
- 错误策略路由(按error_type切换重试序列+import_fixer确定性修复)
- CognitiveGate 认知门控(patch行数递减检测边际收益递减)
- GraduatedCompactor 3层渐进压缩(70%/85%/95%)
- Plan自动触发(hard任务自动生成计划)
- Worktree隔离(/multi并行任务文件隔离)
- Speculative Prefetch(Locator后台预读文件)
- SearchRouter意图感知搜索(arxiv/S2/GitHub/PyPI/Open-Meteo零key)
- Wink自修复监控(偏离检测+课程纠正)

搜索层网络保护:
- DDG为主SearXNG可选,不自动拉Docker
- search_enabled开关,内网用户可完全禁用网络请求
- 所有搜索异常静默处理不阻塞流水线

357/357 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 13:39:00 +08:00
Val-sss
ce8646f57e feat: P0+P1 optimization — circuit breaker, gate confidence, experience replay, session state
- P0-1: Verifier structured error output (error_type/file/line/message extraction)
- P0-2: Circuit breaker + scope narrowing (syntax/import fast-break, 3x same-error hard-break, auto-narrow on 2nd failure)
- P0-3: Gate confidence estimation (keyword signal scoring, low-confidence retry reduction)
- P1-1: Experience Replay via BM25 trajectory similarity search
- P1-2: SessionState multi-turn coherence + attention decay countermeasure
- P1-3: Locator minimal context extraction (function boundary detection, comment stripping, 60-line cap)
- Add CONTRIBUTING.md with architecture red lines and PR standards
- Update README contributing section with quick reference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 11:39:45 +08:00
dashitongzhi
a3a133df2a merge: sync with upstream/master 2026-05-01 22:40:47 +08:00
YonghaoZhao722
d9b51b4b29 feat: add macOS platform support with Apple Silicon GPU detection
- Add macOS GPU detection using sysctl hw.model
- Display "Apple Silicon GPU" for Mac users
- Preserve NVIDIA GPU detection for Windows/Linux
- Add macOS installation guide in README
- Document Apple Silicon unified memory architecture

Fixes platform compatibility issue where Mac users see no GPU info.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 19:21:52 +08:00
Val-sss
8b39161a44 docs: update README version badge to v1.0.9
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 12:44:38 +08:00
dashitongzhi
e9f3937369 refactor: vision expert second review + remove hardcoded credentials
- Remove hardcoded API URL and model defaults
- Require KWCODE_VISION_API_URL, _API_KEY, _MODEL env vars
- Clear error message with setup instructions when unconfigured
- README: add Vision API configuration guide with model examples
- VisionExpert.run() handles multi-image internally
- MAX_IMAGE_BYTES (20MB) and MAX_IMAGE_COUNT (20) limits
- Magic bytes detection for unknown image formats
- Subprocess-based code execution with proper error reporting
2026-04-30 12:10:14 +08:00
dashitongzhi
b2e9d33164 feat: add multimodal vision expert for image analysis and code generation
- VisionExpert class: image analysis + code generation from images
- Anthropic Messages API integration (mimo-v2-omni model)
- Gate classifier: new 'vision' expert type
- Orchestrator: vision pipeline with image_paths support
- CLI: /paste (clipboard) and /image (file) commands
- Optional deps: pip install kwcode[multimodal] (Pillow + pyperclip)
- Architecture diagram in docs/
2026-04-30 11:46:49 +08:00
Val-sss
edd7e5d1ee feat: publish to PyPI + fix installation issues
- Restructure deps: move llama-cpp-python/tree-sitter to optional
  (base install is pure Python, no compiler needed)
- Add __main__.py for pipx/python -m support
- Add GitHub Actions auto-publish on tag push
- Fix install scripts: correct package name, remove Ollama check,
  add pipx priority
- Wrap ast_engine imports in try/except for graceful degradation
- Published v1.0.7 to PyPI: pip install kwcode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 11:45:56 +08:00
Val-sss
a88e0c18b3 docs: one line per day in README changelog 2026-04-30 08:31:15 +08:00
Val-sss
efa3b15183 docs: simplify README changelog to daily summary
Consolidate per-version entries into per-day summaries for readability.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 08:29:47 +08:00
Val-sss
7b6e853a55 docs: update CHANGELOG and README for v1.0.7
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:54:12 +08:00
Val-sss
48184ed821 docs: update CHANGELOG and README for v1.0.6
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:28:49 +08:00
Val-sss
67e9b61131 feat: P1+P2 — auto task decomposition, pre-search, PCED-Lite
P1-A: Hard tasks auto-trigger TaskCompiler
  - Gate PROMPT extended with needs_search + subtask_hint (backward compat)
  - Planner.auto_decompose(): hint-based DAG generation (1 LLM call)
  - Graceful degradation: parse failure → single task (P1-RED-1)

P1-B: Gate search decision front-loading
  - orchestrator.run() accepts pre_search_results parameter
  - Pre-search results injected into ctx before pipeline starts
  - Avoids 2 failed retries before searching

P2: PCED-Lite (search/pced_lite.py)
  - Parallel independent inference per document (ThreadPoolExecutor)
  - Consistency voting for final answer (char-level overlap)
  - FLEX-2: degrades on VRAM<6GB or <3 documents
  - Based on arXiv:2601.08670 (PCED, 2026)

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:15:27 +08:00
Val-sss
0c36d0cfc8 docs: update CHANGELOG and README for v1.0.4
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 02:57:07 +08:00
Val-sss
8a49561fff docs: add update log table to README top section
Shows daily progress with version, date, and concise description
of what was optimized/implemented. Links to full CHANGELOG.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 02:31:03 +08:00
Val-sss
3c48a33545 docs: update README and CHANGELOG for v1.0.0 final
README:
- Update test count badge (311)
- Add Reviewer to project structure as 5th meta-expert
- Update flywheel/registry descriptions (SKILL.md not YAML)
- Rewrite contribution section (recommend fork + modify)
- List what's safe to change vs architecture-frozen parts

CHANGELOG:
- Add OpenAI-compatible API auto-detect to Added section
- Add LLMBackend api_key support to Changed
- Add Fixed section for /api/chat vs /v1/chat/completions bug
- Add "weak model + skill > strong model" to Architecture Decisions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 19:51:18 +08:00
Val-sss
347b4ad976 feat: v1.0.0 — 5 meta-experts + 15 SKILL.md knowledge layer, architecture finalized
Meta-expert system (atomic capabilities, fixed):
  1. Locator — BM25+AST call graph code localization
  2. Generator — LLM code generation with domain knowledge injection
  3. Verifier — syntax check + pytest validation
  4. Debugger — runtime variable capture via sys.settrace
  5. Reviewer — requirement alignment check (LLM compares intent vs changes)

Knowledge layer (SKILL.md progressive disclosure, extensible):
  15 domain experts converted from YAML to SKILL.md directory format
  - Level 1 (Gate): name+keywords ~100 tokens/expert
  - Level 2 (Generator): full instructions loaded only for matched expert
  - Level 3 (on-demand): deterministic scripts, never enter LLM context

Key decisions based on 2025-2026 research:
  - Experts split by atomic capability, not business domain (arXiv:2604.09780)
  - Progressive disclosure prevents noise (Anthropic Agent Skills)
  - Only specific domain knowledge helps; generic rules hurt (SWE-Skills-Bench)
  - 5 atomic skills compose into all complex tasks (GitHub Copilot paper)

Changes:
  - Add kaiwu/experts/reviewer.py (Reviewer meta-expert)
  - Convert all 15 experts from .yaml to SKILL.md directories
  - Delete all .yaml expert files
  - Add CHANGELOG.md
  - Update README (meta-expert architecture, version badge)
  - Bump version to 1.0.0
  - 311 tests passing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 19:35:24 +08:00
Val-sss
6fd78a3e06 docs: expand references with design decisions and project history
- Add TRUSTEE paper reference (8B reliable tool calling)
- Add OpenHands V1 as borrowed project (agent delegation, context condensation)
- Add "Design Decisions" section explaining key architectural choices:
  - Why deterministic pipeline over ReAct loop
  - Why YAML experts over Python classes (and the failed experiment)
  - Why no LoRA training
  - Why strict constraints > loose prompts for small models
- Source: project architecture discussions (0426-0429)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 15:45:56 +08:00
Val-sss
4bfc2f2417 docs: add detailed references table (papers + open source projects)
List all 11 papers with specific applications in KWCode,
plus 7 open source projects we drew inspiration from.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 15:35:50 +08:00
Val-sss
22773f6586 docs: rewrite README for v0.9.0
- Add Debug Subagent (Debug2Fix paper), DAG TaskCompiler (LLMCompiler),
  Prompt Optimizer (SICA), Reflexion persistence
- Remove all Ollama-specific mentions, generalize to "any OpenAI-compatible API"
- Add /multi command usage examples
- Update reference table with all 9 papers and their applications in KWCode
- Update project structure, test count (292), version badge
- Clean up tone, remove personal rant section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 15:30:17 +08:00
ValHuang
abff0f5a0f 更新 README.md 2026-04-28 22:59:58 +08:00
Val-sss
f5c23966bd docs: remove Ollama as hard requirement, add cloud API option
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 18:30:45 +08:00
Val-sss
5765a4f329 docs: rewrite pain points section — context overflow, retry loops, tool execution
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 18:05:54 +08:00
Val-sss
248dd7f1d5 docs: add /api command usage (temp/default/show) to README
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 17:59:33 +08:00
Val-sss
3b806fdede rename README_zh.md → README.md for GitHub display
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 17:54:45 +08:00