---
schema_version: 1
id: RAC-KTQ63DYMGTZC
type: roadmap
---
# RAC v0.8.0 — Service Layer Extraction

## Problem

RAC capabilities currently exist primarily as CLI-accessible workflows.

Commands such as:

```text
rac validate
rac inspect
rac improve
rac ingest
rac relationships
rac portfolio
```

provide useful repository intelligence, but future consumers require direct programmatic access.

Upcoming interfaces such as:

- Explorer
- IDE integrations
- Automation tools
- AI workflows

should not execute CLI commands or parse terminal output.

The CLI should become one consumer of RAC capabilities rather than the owner of application logic.

---

## Outcomes

Introduce a stable service layer that allows RAC capabilities to be consumed from Python.

The architecture shall become:

```text
             RAC Core

          /            \

       CLI          Explorer
```

rather than:

```text
Explorer

   ↓

 CLI

   ↓

Logic
```

Users experience no CLI behavior changes.

---

## Initiatives

## Initiative 1 — Service Package

Introduce a service layer.

Example:

```text
rac/
├── services/
│   ├── validate.py
│   ├── inspect.py
│   ├── improve.py
│   ├── ingest.py
│   ├── relationships.py
│   └── portfolio.py
│
└── cli/
```

Services shall expose typed Python functions.

---

## Initiative 2 — CLI Refactor

Move business logic out of CLI handlers.

Before:

```text
Command
  |
Logic
```

After:

```text
Command
  |
Service
  |
Core
```

CLI commands become:

- Argument handling
- Formatting
- Exit codes

only.

---

## Initiative 3 — Stable Result Objects

Services shall return structured objects.

Examples:

```python
ValidationResult

InspectionResult

RelationshipReport

PortfolioSummary
```

Services shall not return formatted terminal output.

---

## Initiative 4 — Preserve JSON Contracts

Existing:

```bash
rac command --json
```

outputs must remain stable.

The CLI should serialize service results.

---

## Requirements

## REQ-001 — No CLI Dependency

Core capabilities shall not depend on CLI code.

---

## REQ-002 — Importable Services

Consumers shall be able to call RAC functionality directly from Python.

---

## REQ-003 — Compatibility

Existing CLI behavior shall remain unchanged.

---

## REQ-004 — Typed Results

Service outputs shall use stable models.

---

## Non-Goals

- New repository intelligence
- TUI implementation
- API servers
- Cloud services

---

## Success Measures

Explorer can consume RAC capabilities without invoking subprocess commands.

CLI becomes a presentation layer.

All existing tests continue passing.