This document defines how automated agents should work in this repo.
- Follow these guidelines for code, docs, and PRs.
- Keep changes small and focused.
- Prefer incremental changes with clear validation steps.
- Avoid unrelated formatting-only edits.
- LumoKit is a Swift package for on-device RAG workflows.
- Public API is defined in
Sources/LumoKit/LumoKit.swift. - Chunking logic lives in
Sources/LumoKit/Chunking/. - Tests live in
Tests/LumoKitTests/. README.mdis the source of truth for API examples and install info.
PicoDocsis used for document ingestion and parsing.VecturaKithandles vector storage and search.- Keep any wrapper APIs aligned with upstream names and behavior.
- Create a feature branch per task.
- Keep commits scoped and descriptive.
- Run
swiftlint,swift build, andswift testbefore opening a PR. - Keep README examples and API overview in sync with public API changes.
- Prefer
swift testover selective runs unless tests are isolated.
- Preserve public API stability unless a change is explicitly required.
- Favor clarity over cleverness in chunking logic.
- Use explicit error handling and avoid force unwraps.
- Add tests for behavior changes and regressions.
- Avoid non-ASCII text unless needed.
- Minimize allocations in chunking paths; reuse existing helper patterns.
- If the public API changes, update
README.mdand add tests. - For new features, include a short usage example in README or tests.
- When adding methods that wrap VecturaKit, mirror naming and behavior.
- Maintain async/await signatures consistent with existing public APIs.
- Ensure chunks never exceed
chunkSizeunless explicitly documented. - Avoid duplicating content when splitting oversized segments.
- Keep metadata positions consistent with original text offsets.
- Preserve content type in
ChunkMetadata. - Preserve overlap semantics and flags (
hasOverlapWithPrevious/Next).
- Keep heavy work off the main actor unless required by APIs.
- Avoid introducing shared mutable state across chunkers.
- Prefer pure functions and local state for chunking logic.
- Use
LumoKitErrorfor predictable user-facing failures. - Wrap lower-level errors with context using
LumoKitError.chunkingFailed. - Avoid swallowing errors in fallbacks; wrap and rethrow.
- Keep error mappings consistent with existing
LumoKitErrorcases.
- Add regression tests for bugs and edge cases.
- Prefer small, deterministic inputs to reduce flakiness.
- When fixing chunking issues, add a test that would have failed before.
- Keep tests in
Tests/LumoKitTests/and match existing naming patterns.
- Keep
README.mdexamples and API overview up to date. - Document new behaviors or breaking changes in release notes.
- Keep
Claude.mdas a simple pointer to this file. - Update README version snippets when releasing new versions.
- Follow semantic versioning; note breaking changes clearly.
- Include release notes for user-visible changes and fixes.
- Ensure
README.mdmatches the latest release version.
- Include a clear summary and testing notes.
- Call out any user-visible behavior changes.
- Link related issues or PRs when applicable.