Rewrite CLAUDE.md and add Claude Code rules#154
Conversation
Replace 1,690-line cumulative changelog with 75-line project guide covering build/test commands, directory structure, API packages, known limitations, and architecture notes. Add 5 Claude Code rules: memory constants, JNI boundary, auto-review, research-before-code, and test coverage workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
schenksj
left a comment
There was a problem hiding this comment.
Looks great! Please address the conflicts and we can merge!
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Overall
Big improvement in signal-to-noise. The old CLAUDE.md is ~1,690 lines of cumulative "REVOLUTIONARY BREAKTHROUGH" changelog entries dated across Aug 2025 – Jan 2026 — dense with things that are either stale, duplicated in docs/, or feature announcements rather than actionable guidance. Trimming to ~75 lines is the right call, and since this file is re-read every turn the context savings compound.
The new structure (Build & Test → Project Structure → Java API Packages → Key Concepts → Known Limitations → Architecture Notes) is the right skeleton, and the rule files are a good extraction point for reusable guidance.
Verified accurate
- Makefile targets —
compile,test,test-cloud,test-all,package,clean,setupall exist. - Rust directory map — matches reality.
- Most Java API packages —
core,split,query,aggregation,batch,iceberg,delta,parquet,memory,configall exist. - Memory constants (
MIN=15MB,DEFAULT=50MB,LARGE=128MB,XL=256MB) — match the codebase. - Debug env var
TANTIVY4JAVA_DEBUG=1— correct. - Package name
io.indextables.tantivy4java— correct.
Issues to fix before merge
1. (Blocking) The RangeAggregation "known limitation" is factually wrong
The new CLAUDE.md says:
RangeAggregation — not implemented in the native Rust layer. Returns empty results.
This is incorrect. RangeAggregation is fully implemented:
native/src/split_searcher/aggregation_arrow_ffi.rs:412—range_to_record_batchproduces a real Arrow RecordBatch withkey/doc_count/from/tocolumns plus sub-agg metrics, driven byBucketResult::Range { buckets }from Tantivy.src/test/java/io/indextables/tantivy4java/RangeAggregationTest.javahas hard assertions that would fail if results were empty — e.g.assertEquals(4L, rangeCounts.get("cheap")),assertEquals(3L, rangeCounts.get("budget")), total-doc-count checks, etc.
There is a real nearby limitation: extract_inner_buckets (aggregation_arrow_ffi.rs:603) returns Vec::new() for BucketResult::Range { .. }, meaning Range cannot be used as a nested inner bucket under another bucket aggregation for flattening purposes (the comment says "Terms only for now"). If this is what was meant, the correct phrasing is something like:
RangeAggregation as a nested sub-bucket — flattening Range buckets inside a parent bucket aggregation is not supported (see
extract_inner_bucketsinaggregation_arrow_ffi.rs). Top-level RangeAggregation works correctly.
Publishing "Returns empty results" is worse than not listing it at all — it will mislead contributors into avoiding a working path, and it directly contradicts a passing test suite.
2. (Minor) Missing packages in the Java API table
The table lists 10 packages; the actual layout also has:
result— SearchResult, Hit, aggregation results (user-facing, should be listed)util— utilitiesfilter— filter APIssplit/merge— merge subpackage
examples is fine to omit. I'd add result at minimum since it's part of the user-facing API surface, and filter if it's non-trivial.
On the rules files
All five read well and are the right size (each <30 lines).
memory-constants.md— exact, grounded in a real historical incident. Good.jni-boundary.md— captures a non-obvious decision rule. Good.auto-review.md— This is an opt-in behavior change: every coding task will now auto-spawn apr-review-toolkit:code-revieweragent and run the test-coverage workflow. That's a meaningful tool/context cost on every task, not a free convention. Worth confirming the repo owner actually wants that default. The "When NOT to trigger" list is reasonable but doesn't include "small single-line fixes," which may be the highest-frequency case.research-before-code.md— Strong rule. "NEVER start coding immediately" + "Propose 2-3 approaches with pros/cons" means a one-line helper fix turns into a research memo. Consider softening to "For non-trivial changes…" and leaning on the existing trivial-fix exception at the bottom.test-coverage-workflow.md— The severity-prioritized table format is genuinely useful. Minor: "Review coverage once — don't write tests piecemeal" will bite in interactive debugging loops where the test set naturally evolves.
schenksj
left a comment
There was a problem hiding this comment.
please see comments in the conversation
Summary
CLAUDE.mdfrom 1,690 lines to 75 lines — replaced cumulative changelog/feature diary with a concise project guide.claude/rules/for consistent contributor behaviorMethodology
We ran the
/claude-md-management:claude-md-improveraudit skill, which:The before/after scores below come directly from that audit. The rewrite was then reviewed interactively — we discussed what to keep from the old version (known limitations, debug env var, Python parity context), what to extract into rules (memory constants, JNI boundary), and what to drop entirely (changelog entries, stale benchmarks, local machine paths).
CLAUDE.md Quality Assessment
What was removed
docs/)file:/Users/schenksj/...)What was added
.claude/rules/:memory-constants.md— always useIndex.Memoryconstants, never hardcode heap sizesjni-boundary.md— Java handles I/O, Rust handles search/indexingauto-review.md— automatic code review + test coverage after every coding taskresearch-before-code.md— research and propose options before writing codetest-coverage-workflow.md— structured test planning with severity-prioritized tableRationale
CLAUDE.md is re-read on every Claude Code turn. A 1,690-line changelog wastes context window on every message and makes it harder for Claude to find actionable information. The rewrite optimizes for "what do I need to know to work in this repo" rather than "what features have been shipped."
🤖 Generated with Claude Code