Commit Graph

70 Commits

Author SHA1 Message Date
Val-sss
a99dcfe255 fix: move tree-sitter back to base deps (pre-built wheels available)
tree-sitter and tree-sitter-python provide pre-built wheels for
Windows/Mac/Linux on Python 3.10-3.12, so no compiler needed.
AST engine is now always installed with base package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 12:16:23 +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>
v1.0.7
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
314972b9b9 fix: PPT misclassification + SSH ops guidance
1. Gate _postprocess: expand OFFICE_FORMATS to include "ppt", "演示文稿", "汇报"
   (was only matching ".pptx" and "ppt模板", missing common Chinese expressions)

2. Gate prompt: add PPT/幻灯片 examples + negative example (HTML展示≠office)

3. ChatExpert system prompt: add ops guidance — when user asks SSH/docker/nginx,
   output command instructions with /bash hint instead of executing directly

Verified with qwen3:8b: 4/4 PPT cases now correctly route to office.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 08:26:53 +08:00
Val-sss
c316feb833 docs: add round 2 walkthrough report (10 new scenarios, no fixes)
Findings:
- 2 serious: SSH/ops not routable (design gap), PPT misclassified (prompt gap)
- 3 acceptable: search boundary, difficulty boundary, hint quality
- Framework mechanisms all working correctly (auto_decompose 4/4, Gate 8/10)
- Issues are coverage/prompt gaps, not architecture bugs

Decision needed from user:
1. SSH: new ops expert_type vs extend ChatExpert?
2. PPT: add trigger words to Gate prompt (risk of over-triggering)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 07:27:12 +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
e32a43982b fix: wire up 4 remaining walkthrough issues
1. TrajectoryCollector.get_by_expert() — method was missing, ab_tester
   called it on expert graduation. Added to trajectory_collector.py.

2. auto_decompose integrated into _run_task() — hard tasks now auto-split
   via Planner.auto_decompose() + _handle_multi_with_tasks() helper.

3. Pre-search (P1-B) wired into _run_task() — Gate needs_search=true
   triggers QueryGenerator + ddg_search before orchestrator.run(),
   results passed via pre_search_results parameter.

4. session_md.save_session() wired into REPL exit — SESSION.md now
   written on vram_watcher.stop() with recent task summaries.

All 4 issues from WALKTHROUGH_REPORT.md resolved.
311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:52:33 +08:00
Val-sss
bbd573170f fix: planner regex bug + add WALKTHROUGH_REPORT.md
Fixed: Planner._build_dag_from_hints() regex non-greedy \[.*?\] stopped
at first ] inside depends_on:[], causing all auto_decompose to fail.
Changed to greedy \[.*\] — verified with real qwen3:8b model.

Added WALKTHROUGH_REPORT.md documenting 10-scenario system test results:
- 4 issues found (1 bug fixed, 3 unwired features)
- All Gate/QueryGenerator/TokenTracking mechanisms verified working
- 8B model correctly outputs needs_search, subtask_hint, site: queries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:44:46 +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
3482379c79 feat: smart search — LLM auto-decides site: restriction in queries
QueryGenerator prompt upgraded:
- First query: LLM judges which site has best answer (arxiv/github/stackoverflow/etc)
- Remaining queries: broader without site restriction
- Zero new API, zero new dependency — just a prompt change

Also added:
- _clean_query() safety filter (blocks prompt injection attempts)
- 'realtime' intent for pre-search scenarios
- QueryGenerator accepts plain string (not just TaskContext) for flexibility

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:27:15 +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
8dfb962515 docs: add CODE_REVIEW_LESSONS.md — post-mortem and prevention rules
Summarizes 8 issues found in code review:
- 3 dead code (module exists but never called)
- 3 feature conflicts (parallel race, override missing)
- 2 data errors (placeholder never replaced)

Establishes 5 prevention rules:
1. New module → verify call chain (who instantiates, who calls)
2. Parallel feature → check shared mutable state
3. Placeholder → must have TODO comment
4. New feature → check interaction with all existing features
5. Review order: call chain → parallel safety → data truth → combinations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 03:00:51 +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
723574cb34 fix: resolve 8 code review issues (dead code, race conditions, data errors)
Issues fixed:
1. DebugSubagent now instantiated and injected into orchestrator (was dead code)
2. PromptOptimizer now triggered on expert graduation (was never called)
3. Reranker: already gracefully degrades, no change needed (documented)
4. Checkpoint race condition: skip_checkpoint=True in multi-task mode
5. Hard tasks: TaskPlanner already exists, needs CLI integration (next step)
6. force_plan_mode: now overridable (no_search flag disables it)
7. conversation_history: stores real LLM output instead of user_input
8. Multi-language AST: already correctly scoped to Python-only (no false claims)

Also: mock_run signature updated in test_task_compiler.py for skip_checkpoint param.

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 02:55:49 +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
bc730bc731 docs: update CHANGELOG for v1.0.3
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 02:23:28 +08:00
Val-sss
1b9610628a feat: implement 3-layer context architecture (KWCODE_CONTEXT_SPEC)
Based on Active+Archive layering (Letta 2026) + GCC state passing + SWE-Pruner code protection.

1. context.py: add subtask_results, current_task_id, upstream_summary fields
   - Structured State (Layer 2): subtask results passed via Python objects, not conversation history
   - Active Context (Layer 1): upstream_summary ≤2K tokens for Gate/Generator

2. context_pruner.py: CTX-RED-1 code block protection
   - Detect ```code blocks``` in messages
   - Extract and preserve code content during compression (never keyword-ize code)
   - Non-code text still compressed normally
   - Performance maintained <5ms (verified: 1.55ms)

3. Three-layer architecture:
   Layer 1 (Active): text summaries Gate/Generator see (≤2K tokens, compressible)
   Layer 2 (Structured State): Python objects (subtask_results, code_snippets) - precise, not compressed
   Layer 3 (Archive): persistent files (SESSION.md, PATTERN.md) - BM25 retrieved on demand

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 02:22:08 +08:00
Val-sss
a809367b86 feat: persistent SSH session via paramiko
- Add kaiwu/tools/ssh_session.py: SSHSession class with connect/exec/upload/download/close
- Integrate into ToolExecutor: ssh_connect/ssh_exec/ssh_upload/ssh_download/ssh_close
- Guardrails apply to remote commands too (rm -rf blocked on SSH)
- Persistent connection: connect once, exec multiple commands without reconnecting
- Supports password auth and SSH key auth

Usage flow:
  executor.ssh_connect("183.222.230.89", port=22102, username="linux", password="xxx")
  executor.ssh_exec("systemctl status nginx")
  executor.ssh_exec("cd /app && cat config.yml")
  executor.ssh_close()

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 02:14:49 +08:00
Val-sss
2f3eb6bf2e fix: sensitive files backup instead of block (like Claude Code)
Changed guardrail behavior for .env/credentials.json/id_rsa etc:
- Before: write blocked entirely (too restrictive)
- After: auto-backup to .bak before overwrite (preserves original, allows write)

Matches Claude Code behavior: write proceeds but original is preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 20:55:41 +08:00
Val-sss
8fd5275b2e feat: complete MoE framework — token budget, guardrails, observability, session continuity
P1: Token budget tracking (llm/llama_backend.py)
  - Auto-count input/output tokens per LLM call
  - BudgetExceededError when over limit
  - OpenAI API uses real usage data, Ollama estimates

P2: Guardrails (tools/executor.py)
  - Block dangerous commands (rm -rf, git push --force, drop database, etc.)
  - Protect sensitive files (.env, credentials.json, id_rsa)
  - Confine writes to project_root

P3: Execution observability (core/execution_trace.py)
  - Structured trace per task (steps, timing, tokens, success)
  - Human-readable summary() output

P4: Session continuity (memory/session_md.py)
  - Auto-save SESSION.md on exit (recent task summaries)
  - Auto-load on next startup into Gate memory_context
  - Based on Claude Code 4-Layer Memory + Augment "Session-End Spec Update"

Also fixed: apply_patch method accidentally dropped during executor.py rewrite.

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 20:52:13 +08:00
Val-sss
91f52b34f7 feat: dynamic retry budget + TaskPlanner + context pollution fix
1. Dynamic retry budget (orchestrator.py):
   - easy tasks: 2 retries (fast fail)
   - hard tasks: 4 retries (more chances)
   - Based on Turn-Control Strategies paper (arXiv:2510.16786)

2. TaskPlanner (core/task_planner.py):
   - 1 LLM call to decompose complex tasks into DAG JSON
   - Only triggers on hard + >30 char tasks (saves LLM calls)
   - Fails gracefully to single-task execution
   - Based on "Hidden Architectural Seam" research

3. Context pollution fix (orchestrator.py):
   - Clear debug_info on each retry (ephemeral state)
   - Prevents previous debug traces from polluting next attempt
   - Based on CodeDelegator EPSS pattern (arXiv:2601.14914)

311 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 20:23:04 +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
c0ec272925 fix: LLMBackend auto-detect OpenAI-compatible API vs Ollama
Problem: user configures base_url as https://api.deepseek.com during
onboarding, but LLMBackend hardcodes /api/chat (Ollama endpoint),
resulting in 404 errors on cloud APIs.

Solution: auto-detect based on URL pattern:
  - localhost:11434 → Ollama (/api/chat)
  - Cloud domains (deepseek/siliconflow/openai/groq/etc) → OpenAI compat (/v1/chat/completions)
  - Remote non-localhost → OpenAI compat
  - URL containing /v1 → OpenAI compat

Also:
  - Pass api_key from config to LLMBackend
  - New _chat_openai_compat() method handles OpenAI format (Authorization header, standard payload)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 19:44:08 +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
0aeb91b766 feat: upgrade expert system to SKILL.md progressive disclosure format
- Add SKILL.md directory format (YAML frontmatter + Markdown instructions + scripts/)
- 3 pilot experts converted: bugfix/, fastapi/, testgen/ (with scripts)
- expert_loader.py: load_skill_dir() + load_directory() supports both formats
- expert_registry.py: get_instructions() (Level 2) + get_scripts() (Level 3)
- gate.py: uses instructions field for SKILL.md experts
- prompt_optimizer.py: _update_skill_md() appends rules to markdown body
- SKILL.md takes priority over same-name YAML (backward compat preserved)
- 19 new tests (311 total, all passing)

Progressive disclosure architecture:
  Level 1 (Gate): name + keywords only (~100 tokens per expert)
  Level 2 (Generator): full instructions loaded only for matched expert
  Level 3 (on-demand): scripts executed deterministically, never enter LLM context

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 19:15:19 +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
Val-sss
1266591951 feat: add /multi command for serial+parallel multi-task execution
Usage:
  /multi task1 ; task2 ; task3     — parallel (semicolons)
  /multi task1 -> task2 -> task3   — serial chain (arrows)
  /multi                           — interactive mode (> prefix = depends on previous)

Interactive mode example:
  + add comments to func_a        (parallel)
  + add comments to func_b        (parallel)
  + >write tests for both         (serial, depends on t1+t2)

Integrates TaskCompiler DAG scheduler into CLI with:
- Rich spinner progress during execution
- Per-task result summary (files modified / errors)
- Parallel/serial count display before execution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 13:49:08 +08:00
Val-sss
56b9c1e7da docs: update STATUS.md to v0.9.0, document architecture corrections
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 13:19:58 +08:00
Val-sss
4bcf932639 feat: add Debug Subagent for runtime debugging on retry
Based on Debug2Fix (Microsoft, 2026): weak model + debugger > strong model.

- Add kaiwu/experts/debug_subagent.py: sys.settrace-based variable capture,
  LLM-guided debug strategy, pytest --tb=long fallback
- Add debug_info field to TaskContext
- Orchestrator calls _do_debug() after verifier failure (non-blocking)
- Generator retry prompts (strategy 1+2) inject ctx.debug_info
- 15 new tests (292 total, all passing)

Flow: verifier fails → LLM decides breakpoint location + variables →
sys.settrace captures runtime values → injected into next generator retry

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 13:16:32 +08:00
Val-sss
7f2f74fbb6 feat: DAG task compiler + prompt optimizer, remove Python expert system
- Add TaskCompiler (kaiwu/core/task_compiler.py): lightweight DAG scheduler
  with ThreadPoolExecutor + topological sort for serial/parallel multi-task
- Add PromptOptimizer (kaiwu/flywheel/prompt_optimizer.py): analyzes trajectories
  via Opus/Sonnet API, appends learned rules to expert YAML system_prompt
- Add Cross-Encoder reranker (kaiwu/search/reranker.py): optional BM25+CE pipeline
- Add Reflexion persistence (kaiwu/memory/pattern_md.py): REFLECTION.md structured
  pattern memory with /plan integration
- Remove Python expert system (ExpertBase, BugFixExpert.py, SelfImprovingOptimizer)
- Revert registry to YAML-only loading
- Remove _get_python_expert/_run_python_expert from orchestrator
- Replace run_self_improvement with run_prompt_optimization in ab_tester
- 277 tests passing (265 regression + 12 new task_compiler tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 11:12:13 +08:00
Val-sss
9a460d6837 update STATUS.md: comprehensive v0.7.0 progress summary
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 00:22:48 +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
Val-sss
c6197d0316 v0.7.0: P1+P2+搜索重构+UI全面优化
P1: KWCODE.md规则注入、/plan风险评估、Checkpoint快照、DocReader
P2: 模型能力自适应、飞轮通知、价值量化仪表盘
搜索: 四级提取管道、并行搜索+BM25重排、意图感知、ChatExpert门控
UI: spinner动画、结果摘要、静默日志、重影大字Header
新增: kwcode setup-search 一键安装SearXNG
测试: 282/282 PASS (含17个E2E真实模型测试)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 17:52:59 +08:00
Val-sss
65cdf9818f Flywheel E2E verified: 5 tasks → pattern → expert gen → 3 gates → lifecycle
Full flywheel loop confirmed:
- 5 same-type trajectories trigger pattern detection (gate 1)
- LLM generates expert YAML from trajectories (gemma3:4b)
- Gate 2 backtest passes (valid YAML + matching pipeline)
- Expert registered with lifecycle=new
- 6 successes → mature, 10 failures → declining

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 10:05:46 +08:00
Val-sss
432177424d Update STATUS: CLI rename kwqode complete
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 10:03:09 +08:00
Val-sss
8660e26b1a Rename CLI command kaiwu → kwqode
- Entry point: kwqode = "kaiwu.cli.main:app"
- Display name: KwQode (banners, help, REPL prompt)
- MCP tool: kwqode_execute
- Python package name kaiwu/ and imports unchanged
- .kaiwu/ config dir and KAIWU.md unchanged

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 10:01:04 +08:00
Val-sss
61e7efcc32 Update STATUS: China network optimization complete
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 09:49:52 +08:00
Val-sss
5e6a4096a8 China network optimization: proxy, Bing fallback, ModelScope auto-switch
Three-layer China network support:
1. Model download: auto-detect HuggingFace connectivity, switch to
   ModelScope when unreachable. MODELSCOPE_MODELS mapping added.
2. Search: DDG primary, auto-fallback to cn.bing.com HTML scraping
   when DDG fails (SEARCH-RED-5 revised). Zero API keys.
3. Fetch: all httpx calls now support KAIWU_PROXY/HTTPS_PROXY env var
   and ~/.kaiwu/config.yaml proxy field.

New module: kaiwu/core/network.py — unified network detection + proxy config.
CLI shows network status hint on startup when China network detected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 09:48:49 +08:00
Val-sss
2f28793018 Update STATUS: all spec v4 steps complete
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 01:14:18 +08:00
Val-sss
8b9b1b8bec Add --no-search flag and memory reset command
- CLI: --no-search disables search augmentation on retries
- CLI: kaiwu memory --reset clears .kaiwu/ directory
- Orchestrator: no_search parameter skips SearchAugmentor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 01:12:36 +08:00
Val-sss
3592060eb5 Generator: add test generation path for TestGenExpert
New _run_test_generation() creates test files instead of modifying source.
Detects test tasks via expert name, gate type, and Chinese keywords.
Uses dedicated GENERATOR_TEST_PROMPT with source code context.

Benchmark results:
- BugFixExpert: 5/5 = 100% (gemma3:4b, avg 3.2s)
- TestGenExpert: gemma3:4b 1/5, gemma4:e2b 3/5 (model capability limit)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 01:04:33 +08:00
Val-sss
01f99aaa1e Add tree-sitter dependencies to pyproject.toml
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 00:50:17 +08:00
Val-sss
44cb2690cd Expert benchmark framework + validation results
BugFixExpert: 5/5 = 100% (avg 3.2s, gemma3:4b)
TestGenExpert: 3/5 = 60% (codegen pipeline needs improvement for new file generation)

Known issue: Generator's "read original → generate modified" design
doesn't handle pure new-file creation well. Needs codegen-specific
generation path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 00:47:57 +08:00