···11+---
22+name: body
33+description: Development guidelines, project structure, coding standards, testing, and environment for solstone. TRIGGER when contributing code, reviewing PRs, setting up development environment, or asking about project conventions.
44+---
55+66+# Development Guidelines
77+88+**solstone** is a Python-based AI-driven desktop journaling toolkit with three packages: `observe/` for multimodal capture and AI-powered analysis, `think/` for data post-processing, AI agent orchestration, and intelligent insights, and `convey/` for the web application, with `apps/` for extensions. The project uses a modular architecture where each package can operate independently while sharing common utilities and data formats through the journal system.
99+1010+## Key Concepts
1111+1212+- **Journal**: Central data structure organized as `journal/YYYYMMDD/` directories. All captured data, transcripts, and analysis artifacts are stored here.
1313+- **Facets**: Project/context organization system that groups related content and provides scoped views of entities, tasks, and activities.
1414+- **Entities**: Extracted information tracked over time across transcripts and interactions and associated with facets for semantic navigation.
1515+- **Agents**: AI processors with configurable prompts that analyze content, extract insights, and respond to queries.
1616+- **Callosum**: Message bus that enables asynchronous communication between components.
1717+- **Indexer**: Builds and maintains SQLite database from journal data, enabling fast search and retrieval.
1818+1919+## Architecture
2020+2121+**Core Pipeline**: `observe` (capture) → JSON transcripts → `think` (analyze) → SQLite index → `convey` (web UI)
2222+2323+**Data Organization**:
2424+- Everything organized under `journal/YYYYMMDD/` daily directories.
2525+- Import segments are anchored to creation/modification time, not content "about" time.
2626+- Facets provide project-scoped organization and filtering.
2727+- Entities are extracted from transcripts and tracked across time.
2828+- Indexer builds SQLite database for fast search and retrieval.
2929+3030+**Component Communication**:
3131+- Callosum message bus enables async communication between services.
3232+- Cortex orchestrates AI agent execution via `sol cortex`, spawning agent subprocesses with agent configurations.
3333+- The unified CLI is `sol`. Run `sol` to see status and available commands.
3434+3535+## Quick Commands
3636+3737+```bash
3838+make install # Install package (includes all deps)
3939+make skills # Discover and symlink Agent Skills from muse/ dirs
4040+make format # Auto-fix formatting, then report remaining issues
4141+make test # Run unit tests
4242+make ci # Full CI check (format check + lint + test)
4343+make dev # Start stack (Ctrl+C to stop)
4444+```
4545+4646+## Reference
4747+4848+- `reference/project-structure.md` — Directory layout, package organization, CLI routing, file locations.
4949+- `reference/coding-standards.md` — Style rules, naming conventions, file headers, development principles, dependencies.
5050+- `reference/testing.md` — Test structure, fixtures, make commands, worktree development.
5151+- `reference/environment.md` — Journal paths, API keys, error handling, documentation pointers, git practices.
+51
muse/body/reference/coding-standards.md
···11+# Coding Standards
22+33+## Language & Tools
44+55+- **Ruff** (`make format`) - Formatting, linting, and import sorting
66+- **mypy** (`make check`) - Type checking
77+- Configuration in `pyproject.toml`
88+99+## Naming Conventions
1010+1111+- **Modules/Functions/Variables**: `snake_case`
1212+- **Classes**: `PascalCase`
1313+- **Constants**: `UPPER_SNAKE_CASE`
1414+- **Private Members**: `_leading_underscore`
1515+1616+## Code Organization
1717+1818+- **Imports**: Prefer absolute imports, grouped (stdlib, third-party, local), one per line
1919+- **Docstrings**: Google or NumPy style with parameter/return descriptions
2020+- **Type Hints**: Should be included on function signatures (legacy helpers may still need updates)
2121+- **File Structure**: Constants → helpers → classes → main/CLI
2222+2323+## File Headers
2424+2525+All source code files (but not text or markdown files or prompts) must begin with a license and copyright header:
2626+2727+```
2828+# SPDX-License-Identifier: AGPL-3.0-only
2929+# Copyright (c) 2026 sol pbc
3030+```
3131+3232+Use `//` comments for JavaScript files.
3333+3434+## Development Principles
3535+3636+- **DRY, KISS, YAGNI**: Extract common logic, prefer simple solutions, don't over-engineer
3737+- **Single Responsibility**: Functions/classes do one thing well
3838+- **Conciseness & Maintainability**: Clear code over clever code
3939+- **Robustness**: Minimize assumptions that must be kept in sync across the codebase, avoid fragility and increasing maintenance burden.
4040+- **Self-Contained Codebase**: All code that depends on this project lives within this repository—never add backwards-compatibility shims, fallback aliases, re-exports for moved symbols, deprecated parameter handling, or legacy support code. When renaming or removing something, update all usages directly. For journal data format changes, write a migration script (see [docs/APPS.md](docs/APPS.md) for `maint` commands) instead of adding compatibility layers.
4141+- **Security**: Never expose secrets, validate/sanitize all inputs
4242+- **Performance**: Profile before optimizing
4343+- **Git**: Small focused commits, descriptive branch names. Run git commands directly (not `git -C`) since you're already in the repo.
4444+4545+## Dependencies
4646+4747+- **Minimize Dependencies**: Use standard library when possible
4848+- **All Dependencies**: Add to `dependencies` in `pyproject.toml`
4949+- **Package Manager**: [uv](https://docs.astral.sh/uv/) — lock file (`uv.lock`) is committed, `make install` syncs from it
5050+- **Installation**: `make install` (creates isolated `.venv/`, syncs deps from lock file, symlinks `sol` to `~/.local/bin`)
5151+- **Updating**: `make update` upgrades all deps to latest and regenerates the lock file
+36
muse/body/reference/environment.md
···11+# Environment
22+33+## Journal Path
44+55+The journal lives at `journal/` in the project root. `get_journal()` from `think.utils` returns the path. For tests, set `_SOLSTONE_JOURNAL_OVERRIDE` to override.
66+77+## API Keys
88+99+Store API keys in `.env` file, never commit to repository.
1010+1111+## Error Handling & Logging
1212+1313+- Raise specific exceptions with clear messages
1414+- Use logging module, not print statements
1515+- Validate all external inputs (paths, user data)
1616+- Fail fast with clear errors - avoid silent failures
1717+1818+## Documentation
1919+2020+- Update README files for new functionality
2121+- Code comments explain "why" not "what"
2222+- Function signatures should include type hints; highlight gaps when touching older modules
2323+- **All docs in `docs/`**: Browse for JOURNAL.md, APPS.md, CORTEX.md, CALLOSUM.md, THINK.md, and more
2424+- Each package has a README.md symlink pointing to its documentation in `docs/`.
2525+- **App/UI work**: [docs/APPS.md](docs/APPS.md) is required reading before modifying `apps/`
2626+2727+## Git Practices
2828+2929+- **Git**: Small focused commits, descriptive branch names. Run git commands directly (not `git -C`) since you're already in the repo.
3030+3131+## Getting Help
3232+3333+- Run `sol` for status and CLI command list
3434+- Check [docs/DOCTOR.md](docs/DOCTOR.md) for debugging and diagnostics
3535+- Browse `docs/` for all subsystem documentation
3636+- Review test files in `tests/` for usage examples
+47
muse/body/reference/project-structure.md
···11+# Project Structure
22+33+## Directory Layout
44+55+```text
66+solstone/
77+├── sol.py # Unified CLI entry point (run: sol <command>)
88+├── observe/ # Multimodal capture & AI analysis
99+├── think/ # Data post-processing, AI agents & orchestration
1010+├── convey/ # Web app frontend & backend
1111+├── apps/ # Convey app extensions (see docs/APPS.md)
1212+├── muse/ # Agent/generator configs + Agent Skills (muse/*/SKILL.md)
1313+├── tests/ # Pytest test suites + test fixtures under tests/fixtures/
1414+├── docs/ # All documentation (*.md files)
1515+├── AGENTS.md # Development guidelines (this file)
1616+├── CLAUDE.md # Symlink to AGENTS.md for Claude Code
1717+└── README.md # Project overview
1818+```
1919+2020+Each package has a README.md symlink pointing to its documentation in `docs/`.
2121+2222+## Package Organization
2323+2424+- **Python**: Requires Python 3.10+
2525+- **Modules**: Each top-level folder is a Python package with `__init__.py` unless it is data-only (e.g., `tests/fixtures/`)
2626+- **Imports**: Prefer absolute imports (e.g., `from think.utils import setup_cli`) whenever feasible
2727+- **Entry Points**: Commands are registered in `sol.py`'s `COMMANDS` dict (pyproject.toml just defines the `sol` entry point)
2828+- **Journal**: Data stored under `journal/` at the project root
2929+- **Calling**: When calling other modules as a separate process always use `sol <command>` and never call using `python -m ...` (e.g., use `sol indexer`, NOT `python -m think.indexer`)
3030+3131+## CLI Routing
3232+3333+`sol.py`'s `COMMANDS` dict maps command names to module paths. The unified CLI is `sol`. Run `sol` to see status and available commands. `sol call` routes to `think/call.py`, which discovers `apps/*/call.py` Typer sub-apps and mounts them as subcommands.
3434+3535+## Agent & Skill Organization
3636+3737+`muse/*.md` stores agent personas and generator templates. Apps can add their own in `apps/*/muse/*.md`. Skills live at `muse/*/SKILL.md` and are symlinked to `.agents/skills/` and `.claude/skills/` via `make skills`.
3838+3939+## File Locations
4040+4141+- **Entry Points**: `sol.py` `COMMANDS` dict
4242+- **Test Fixtures**: `tests/fixtures/journal/` - complete mock journal
4343+- **Live Logs**: `journal/health/<service>.log`
4444+- **Agent Personas**: `muse/*.md` (apps can add their own in `muse/`, see [docs/APPS.md](docs/APPS.md))
4545+- **Generator Templates**: `muse/*.md` (apps can add their own in `muse/`, see [docs/APPS.md](docs/APPS.md))
4646+- **Agent Skills**: `muse/*/SKILL.md` - symlinked to `.agents/skills/` and `.claude/skills/` via `make skills`, read https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices to create the best skills
4747+- **Scratch Space**: `scratch/` - git-ignored local workspace
+61
muse/body/reference/testing.md
···11+# Testing
22+33+## Test Structure
44+55+- **Framework**: pytest with coverage reporting
66+- **Unit Tests**: `tests/` root directory
77+ - Fast, no external API calls
88+ - Use `tests/fixtures/journal/` mock data
99+ - Test individual functions and modules
1010+- **Integration Tests**: `tests/integration/` subdirectory
1111+ - Test real backends (Anthropic, OpenAI, Google)
1212+ - Require API keys in `.env`
1313+ - Test end-to-end workflows
1414+- **Naming**: Files `test_*.py`, functions `test_*`
1515+- **Fixtures**: Shared fixtures in `tests/conftest.py`
1616+1717+## Fixture Journal
1818+1919+```python
2020+# Use comprehensive mock journal data for testing
2121+os.environ["_SOLSTONE_JOURNAL_OVERRIDE"] = "tests/fixtures/journal"
2222+# Now all journal operations work with test data
2323+```
2424+2525+The `tests/fixtures/journal/` directory contains a complete mock journal structure with sample facets, agents, transcripts, and indexed data for testing.
2626+2727+## Running Tests
2828+2929+- `make test` for unit tests
3030+- `make test-apps` to run app tests
3131+- `make test-integration` for integration tests
3232+- `make test-all` to run all tests (core + apps + integration)
3333+- `make test-only TEST=path` to run specific tests
3434+- `make coverage` to generate a coverage report
3535+- `make ci` before committing (formats, lints, tests)
3636+- Always run `sol restart-convey` after editing `convey/` or `apps/` to reload code
3737+- Use `sol screenshot <route>` to capture UI screenshots for visual testing
3838+3939+## Worktree Development
4040+4141+Run the full stack (supervisor + callosum + sense + cortex + convey) against test fixture data:
4242+4343+```bash
4444+make dev # Start stack (Ctrl+C to stop)
4545+```
4646+4747+In a second terminal, take screenshots or hit endpoints:
4848+4949+```bash
5050+export _SOLSTONE_JOURNAL_OVERRIDE=tests/fixtures/journal
5151+export PATH=$(pwd)/.venv/bin:$PATH
5252+sol screenshot / -o scratch/home.png
5353+curl -s http://localhost:$(cat tests/fixtures/journal/health/convey.port)/
5454+```
5555+5656+Notes:
5757+5858+- Agents won't execute without API keys — this is expected in worktrees
5959+- Output artifacts go in `scratch/` (git-ignored)
6060+- Service logs: `tests/fixtures/journal/health/<service>.log`
6161+- `make dev` writes runtime artifacts (stats cache, health logs, task logs) into the fixtures journal — these are covered by `tests/fixtures/journal/.gitignore` and should never be committed