docs(spec): document context_tier_hydrator module in ACMS architecture section #9208

Merged
HAL9000 merged 2 commits from docs/reference-glossary into master 2026-06-03 03:25:12 +00:00
3 changed files with 62 additions and 0 deletions
+10
View File
@@ -174,6 +174,16 @@ ensuring data is stored with proper parameter values.
`src/cleveragents/cli/commands/plan.py` to show correct positional argument order.
CONTRIBUTING.md updated with the required CLI docstring example style guide.
### Documentation
- **`context_tier_hydrator` module documented in ACMS architecture section** (#9208): Added
a new **Context Tier Hydration** subsection to the ACMS Architecture section of the
specification (`docs/specification.md`), documenting the `context_tier_hydrator` module's
public interface (`hydrate_tiers_for_plan`, `hydrate_tiers_from_project`), file listing
strategy (git ls-files for git-checkout, os.walk fallback), budget limits (256 KB per file,
10 MB total per project), and fragment structure (`TieredFragment` with HOT tier placement
and metadata keys `path`, `detail_depth`, `relevance_score`). Closes #6175.
### Fixed
- **fileConfig error handling in alembic env.py** (#7874): Wrapped the `fileConfig()`
+1
View File
@@ -72,3 +72,4 @@ Below are some of the specific details of various contributions.
* HAL 9000 has contributed the plan tree JSON `decision_id` fix (#9096): updated `step_tree_json_valid` in features/steps/plan_explain_steps.py to correctly handle the {"data": [...]} envelope structure produced by format_output, and removed @tdd_expected_fail from the @tdd_issue_4254 scenario so it runs as a permanent regression guard.
* HAL 9000 has contributed the TDD scenario for plan tree correction visual marking (PR #8671 / issue #8576): added a failing BDD scenario proving that corrected nodes (decisions with is_correction=True) are not visually distinguished in the plan tree output, formalizing Spec Requirement #7 as an executable specification.
* HAL 9000 has contributed the `--clone-into` CLI argument for `container-instance`, the `CloneIntoHandler` module, the `devcontainer-instance` snapshot sandbox strategy, and the `ContainerLifecycleState.DISCOVERED` terminology alignment (PR #8304, issue #7555).
* HAL 9000 has contributed the ACMS Context Tier Hydration documentation (PR #9208 / issue #6175): documented the `context_tier_hydrator` module in the ACMS Architecture section of the specification, covering its public interface, file listing strategy, budget limits, and fragment structure.
+51
View File
2
@@ -45928,6 +45928,57 @@ Organizations can adopt ACMS features progressively. At each stage, existing res
This design ensures agents never wait for index building during execution, providing a responsive and predictable experience even on massive codebases.
#### Context Tier Hydration
Before context assembly begins, `ContextTierService` must be populated from the project's linked resources. This hydration step is performed by the `context_tier_hydrator` module (`src/cleveragents/application/services/context_tier_hydrator.py`).
**Integration Point:** Hydration runs inside `LLMExecuteActor.execute()` before the context assembly pipeline is invoked. Without this step, `ContextTierService` starts empty on every CLI invocation and the LLM receives zero file context.
**Public Interface:**
```python
def hydrate_tiers_for_plan(
tier_service: ContextTierService,
project_names: list[str],
project_repository: ProjectRepository,
resource_registry: ResourceRegistry,
) -> int:
"""Hydrate all projects linked to a plan. Returns total fragment count."""
def hydrate_tiers_from_project(
tier_service: ContextTierService,
project_name: str,
resource_id: str,
resource_location: str,
resource_type: str,
) -> int:
"""Hydrate a single project resource. Returns fragment count."""
```
**File Listing Strategy:**
- For `git-checkout` resources: uses `git ls-files` to enumerate tracked files only
- For all other resource types: falls back to `os.walk` directory traversal
**Budget Limits (per project):**
- Maximum file size: 256 KB — files exceeding this limit are skipped
- Maximum total size: 10 MB — hydration stops when the per-project budget is exhausted
- Binary files are skipped automatically
- Common non-source directories are excluded: `.git`, `node_modules`, `__pycache__`, `.venv`, `dist`, `build`
**Fragment Structure:**
Each file is stored as a `TieredFragment` in `ContextTierService` with:
- `tier`: `ContextTier.HOT` (all hydrated fragments start in the hot tier)
- `metadata["path"]`: relative file path (string)
- `metadata["detail_depth"]`: depth indicator (string, not int)
- `metadata["relevance_score"]`: relevance score (string, not float)
!!! note
`detail_depth` and `relevance_score` are stored as strings. This was a deliberate fix (PR #5998) — earlier versions stored these as numeric types, causing serialization inconsistencies.
### Storage and Persistence
!!! adr "Architecture Decision"