Commit Graph

16 Commits

Author SHA1 Message Date
Hunter Bown 3899ca3f58 feat(project-context): stabilize pack ordering (#2418)
Harvested from #2392 with thanks to @wplll.

Makes project context pack path ordering deterministic across Unix and Windows-style separators while keeping README/config/source entries prioritized before general directory noise.
2026-05-31 02:53:08 -07:00
Matt Van Horn f3def32ef9 feat: read global AGENTS.md from ~/.agents/ as vendor-neutral fallback 2026-05-30 19:26:39 -07:00
donglovejava 03c4b6bd24 fix: trailing newline in project_context.rs (cargo fmt) 2026-05-30 19:16:25 -07:00
donglovejava 32f424df26 fix(tui): skip hidden worktrees in workspace discovery to prevent TUI saturation 2026-05-30 19:16:25 -07:00
Hunter Bown a554aa9603 feat(project-context): add tracing log when context file is loaded
Emit a tracing::info! line with the file path and byte size when a
project context file (AGENTS.md, CLAUDE.md, etc.) is successfully loaded.
This helps users and maintainers verify which file was used during
prompt assembly, addressing the confusion reported in #2227.
2026-05-26 13:20:25 -05:00
Hunter Bown 25ce4f5970 feat(v0.8.44): SWE-bench adapter, markdown table fix, contributor sync, receipt truncation fix
- SWE-bench: codewhale swebench run/export writes prediction JSONL
  from working-tree diff, with untracked-file inclusion via git add -N
- CLI: --workspace / -C global flag forwards to TUI for file ops
- CLI: codewhale exec --auto semantics clarified in help text
- Markdown: table pipes inside inline code no longer create phantom columns
  (split_table_cells with backtick-awareness)
- Receipt: floor_char_boundary prevents multibyte UTF-8 slice panic
- Contributors: Ling (LING71671 #1839 #1911), Ben Younes (ousamabenyounes #1938),
  jeoor npm fix (#1860) credited across all 3 READMEs
- ja-JP README: 19 contributors synced to parity with EN/zh-CN (80 each)
- Docs: SWEBENCH.md, RECURSIVE_SELF_IMPROVEMENT.md, MODES.md exec clarification
- Sub-agent footer: Alt+V hint now says 'details' not 'raw'
2026-05-24 14:47:42 -05:00
Hunter Bown 5fa24733e9 chore(rebrand): update repository links for CodeWhale 2026-05-23 14:07:36 -05:00
Hunter Bown ddaabbfed2 chore(rebrand): finish codewhale release surfaces 2026-05-23 13:41:46 -05:00
Hunter Bown f0a4e25360 fix(prompt): trim first-turn context noise 2026-05-13 13:12:14 -05:00
LinQ a5c4a21c9b feat(project-context): merge global AGENTS.md with project AGENTS.md (#1157)
travel into every session, ideally merged with a project's local
AGENTS.md when both exist. Maintainer agreed:

> yes that makes sense! am working on getting this organizational
> structure better today so that worktrees etc can feel like an
> intended way of using this.

The fallback path already loaded the global file when no workspace
context existed, but dropped it silently the moment a project
AGENTS.md showed up. After this PR:

* Both files present → merged. The global block is prepended with a
  labelled HTML-style fence (`<!-- global: /home/u/.deepseek/AGENTS.md -->`),
  then the project block follows with its own fence
  (`<!-- project (overrides global where they conflict) -->`). Order
  is global-first so workspace rules read last and win "last word"
  precedence with the model when they disagree.
* Only project file present → unchanged from before.
* Only global file present → unchanged from before (still acts as a
  fallback). The merge framing is suppressed in the global-only case
  so the prompt stays minimal.

`source_path` continues to point at the more-specific file (project
> global > nothing) because that's the path the user is likely to
edit when they want to override something.

Two tests:
* `test_local_and_global_agents_merge_when_both_exist` —
  the actual #1157 scenario. Asserts both blocks are present, global
  precedes project, and the merge-framing label appears between them.
* `test_global_agents_only_no_project_unchanged_fallback` — sanity
  check that the global-only path doesn't accidentally inherit the
  merge framing.

The pre-existing `test_load_global_agents_when_project_has_no_context`
still passes, so the global-as-fallback contract is preserved.

Refs #1157
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 19:29:43 -05:00
Hunter Bown a617e3af18 fix: add missing closing brace in project_context tests 2026-05-10 08:29:03 -05:00
manaskarra cdcb907780 feat(project-context): load global AGENTS fallback 2026-05-10 08:24:21 -05:00
Hunter Bown 54ca5718d2 feat(cache): cache-aware prompt diagnostics and wire payload optimization (#1196)
Merge of PR #1196 by wplll. Adds:

Cache-aware prompt layering:
  - PromptBuilder struct separates prompt construction from inspection
  - System prompt split into named layers with stability classification
  - Layers classified as static/history/dynamic for cache debugging

/cache inspect command:
  - SHA-256 hashes of each rendered prompt layer
  - Base static prefix hash vs full request prefix hash
  - Static prefix stability status across turns
  - First-divergence tracking from previous request

Wire payload optimization:
  - Tool result budget: large outputs compacted before API request
  - Tool result dedup: repeated outputs replaced by compact refs
  - Turn metadata dedup: repeated <turn_meta> blocks deduplicated
  - Wire-only: local session messages remain unchanged

Project context pack:
  - Deterministic workspace summary injected into stable prefix
  - Configurable via [context] project_pack = false

Cache warmup and improved footer cache display.
Thanks to wplll for the contribution.
2026-05-09 00:20:13 -05:00
Lloyd Zhou 6d3e67e9ce fix(cache): auto-generate .deepseek/instructions.md to stabilize KV prefix cache (#1080)
When a workspace has no context file anywhere up the parent chain, `load_project_context_with_parents` now writes a short `.deepseek/instructions.md` (project tree + summary) on first launch. This replaces the previous per-turn filesystem-scan fallback in `prompts.rs`, whose output varied turn-to-turn and broke KV prefix-cache stability for the system prompt.

The auto-generated file is plainly labelled and the user can edit or delete it freely; it's only created when there is no existing context file to respect.

Thanks to @lloydzhou — making the cache surface stable through a real on-disk artifact is exactly the right move for prefix-cache hit rate.
2026-05-07 12:44:18 -05:00
Reid 93cfb83a67 fix(tui): persist workspace trust in global config
fix(tui): persist workspace trust in global config
2026-05-06 10:24:55 -05:00
Hunter Bown 7b91169017 refactor: move source files into workspace crates
- Move src/* into crates/tui/src/ to create a proper workspace structure
- Add .claude/ and .trimtab/ directories for Trimtab closed-loop workflow
- Add DEPENDENCY_GRAPH.md and update documentation
- Update Cargo.toml files to reflect new crate dependencies
- Update CI workflows and npm package scripts
- All tests pass, release build works
2026-03-11 20:00:38 -05:00