Proposal: update specification — actor schema additions (role_hint, response_format, lsp_context_enrichment, tool_sources, NodeLspBinding) #3255

Open
opened 2026-04-05 08:33:53 +00:00 by freemo · 3 comments
Owner

Spec Update Proposal

Triggered by: Proactive spec scan — cycle 5 (2026-04-05)
Source: src/cleveragents/actor/schema.py and src/cleveragents/actor/role_validation.py


Gap: Actor YAML schema has several fields not documented in the specification

The implementation of ActorConfigSchema and NodeDefinition in src/cleveragents/actor/schema.py contains several fields and sub-models that are not documented in docs/specification.md. These are genuine improvements discovered during implementation.


Discrepancy 1: role_hint field on ActorConfigSchema

Implementation (src/cleveragents/actor/schema.py):

role_hint: RoleHint | None = Field(
    default=None,
    description="Optional role hint for role-aware validation",
)

RoleHint is a StrEnum with values: strategy, execution, estimation, invariant_reconciliation, review.

Purpose: When set, enables role-aware compatibility checks. For example, estimation actors with role_hint: estimation are warned if they don't define response_format or use context_view: strategist.

Spec gap: The spec describes actor roles (strategy actor, execution actor, etc.) but does not document a role_hint field in the actor YAML schema.

Proposed spec addition (in the Actor YAML schema section):

role_hint: estimation  # Optional: strategy | execution | estimation | invariant_reconciliation | review
                       # Enables role-aware compatibility checks and warnings

Discrepancy 2: response_format field on ActorConfigSchema

Implementation:

response_format: dict[str, Any] | None = Field(
    default=None,
    description="Optional JSON schema for structured LLM output",
)

Validated to have type: "object" or type: "json_schema".

Purpose: Enables structured output from LLM actors by specifying a JSON schema for the response format. Required for estimation actors (enforced via role_hint warnings).

Spec gap: The spec does not document a response_format field in the actor YAML schema.

Proposed spec addition:

response_format:       # Optional: JSON schema for structured LLM output
  type: json_schema    # "object" or "json_schema"
  json_schema:
    name: estimation_result
    schema: { ... }

Discrepancy 3: lsp_context_enrichment field on ActorConfigSchema

Implementation:

class LspContextEnrichment(BaseModel):
    diagnostics: bool = Field(default=True, description="Inject diagnostics")
    type_annotations: bool = Field(default=False, description="Inject type annotations")
    max_diagnostics_per_file: int = Field(default=50, description="Max diagnostics per file")

lsp_context_enrichment: LspContextEnrichment | None = Field(
    default=None,
    description="Automatic LSP context enrichment settings",
)

Purpose: Controls how LSP diagnostics and type annotations are automatically injected into the ACMS hot context for the actor. The spec mentions LSP context enrichment as a capability but doesn't document the configuration fields.

Spec gap: The spec mentions "diagnostics and type annotations injected into the ACMS hot context" but doesn't document the lsp_context_enrichment configuration block.

Proposed spec addition (in the Actor YAML schema section):

lsp_context_enrichment:
  diagnostics: true              # Inject file diagnostics into ACMS hot context (default: true)
  type_annotations: false        # Inject type info into ACMS hot context (default: false)
  max_diagnostics_per_file: 50   # Cap on diagnostics per file (default: 50)

Discrepancy 4: tool_sources on NodeDefinition

Implementation:

class ToolSourceRef(BaseModel):
    type: str  # "skill", "mcp", "builtin", "custom"
    name: str | None  # Namespaced name for skill/mcp sources
    group: str | None  # Group identifier for builtin sources

tool_sources: list[ToolSourceRef] = Field(
    default_factory=list,
    description="Tool source references",
)

Purpose: Allows graph nodes to declare where their tools come from — skills, MCP servers, or builtin tool groups.

Spec gap: The spec describes tool sources at a high level but doesn't document the tool_sources field on graph nodes in the actor YAML schema.

Proposed spec addition (in the Actor YAML schema, node definition section):

nodes:
  - id: code_writer
    type: agent
    tool_sources:
      - type: skill
        name: local/file-ops
      - type: mcp
        name: local/github-mcp
      - type: builtin
        group: filesystem

Discrepancy 5: NodeLspBinding — per-node LSP binding schema

Implementation:

class NodeLspBinding(BaseModel):
    server: str | None  # Namespaced LSP server name (e.g. "local/pyright")
    languages: list[str]  # Languages for language-based binding
    auto: bool  # Auto-resolve from project resources
    capabilities: list[str] | None  # Optional capability filter

Purpose: Allows individual graph nodes to override or specify their own LSP server bindings independently of the actor-level lsp setting.

Spec gap: The spec mentions per-node LSP bindings but doesn't document the NodeLspBinding schema fields.

Proposed spec addition (in the Actor YAML schema, node definition section):

nodes:
  - id: type_checker
    type: agent
    lsp_binding:
      server: local/pyright        # Explicit server (namespaced)
      languages: [python]          # Language-based binding
      auto: false                  # Auto-resolve from project resources
      capabilities: [diagnostics]  # Optional capability filter

Rationale

All five additions are genuine implementation improvements that were discovered during development:

  • role_hint enables role-aware validation without requiring separate actor types
  • response_format enables structured output from LLM actors (critical for estimation actors)
  • lsp_context_enrichment provides fine-grained control over LSP context injection
  • tool_sources on nodes enables declarative tool source configuration per node
  • NodeLspBinding enables per-node LSP binding overrides

Scope

Sections affected:

  • Actor YAML schema documentation (actor configuration reference)
  • Actor glossary entry (add role_hint to actor description)
  • LSP Integration section (add lsp_context_enrichment configuration)

Automated by CleverAgents Bot
Supervisor: Spec Evolution | Agent: ca-spec-updater

## Spec Update Proposal **Triggered by**: Proactive spec scan — cycle 5 (2026-04-05) **Source**: `src/cleveragents/actor/schema.py` and `src/cleveragents/actor/role_validation.py` --- ### Gap: Actor YAML schema has several fields not documented in the specification The implementation of `ActorConfigSchema` and `NodeDefinition` in `src/cleveragents/actor/schema.py` contains several fields and sub-models that are not documented in `docs/specification.md`. These are genuine improvements discovered during implementation. --- ### Discrepancy 1: `role_hint` field on `ActorConfigSchema` **Implementation** (`src/cleveragents/actor/schema.py`): ```python role_hint: RoleHint | None = Field( default=None, description="Optional role hint for role-aware validation", ) ``` `RoleHint` is a `StrEnum` with values: `strategy`, `execution`, `estimation`, `invariant_reconciliation`, `review`. **Purpose**: When set, enables role-aware compatibility checks. For example, estimation actors with `role_hint: estimation` are warned if they don't define `response_format` or use `context_view: strategist`. **Spec gap**: The spec describes actor roles (strategy actor, execution actor, etc.) but does not document a `role_hint` field in the actor YAML schema. **Proposed spec addition** (in the Actor YAML schema section): ```yaml role_hint: estimation # Optional: strategy | execution | estimation | invariant_reconciliation | review # Enables role-aware compatibility checks and warnings ``` --- ### Discrepancy 2: `response_format` field on `ActorConfigSchema` **Implementation**: ```python response_format: dict[str, Any] | None = Field( default=None, description="Optional JSON schema for structured LLM output", ) ``` Validated to have `type: "object"` or `type: "json_schema"`. **Purpose**: Enables structured output from LLM actors by specifying a JSON schema for the response format. Required for estimation actors (enforced via `role_hint` warnings). **Spec gap**: The spec does not document a `response_format` field in the actor YAML schema. **Proposed spec addition**: ```yaml response_format: # Optional: JSON schema for structured LLM output type: json_schema # "object" or "json_schema" json_schema: name: estimation_result schema: { ... } ``` --- ### Discrepancy 3: `lsp_context_enrichment` field on `ActorConfigSchema` **Implementation**: ```python class LspContextEnrichment(BaseModel): diagnostics: bool = Field(default=True, description="Inject diagnostics") type_annotations: bool = Field(default=False, description="Inject type annotations") max_diagnostics_per_file: int = Field(default=50, description="Max diagnostics per file") lsp_context_enrichment: LspContextEnrichment | None = Field( default=None, description="Automatic LSP context enrichment settings", ) ``` **Purpose**: Controls how LSP diagnostics and type annotations are automatically injected into the ACMS hot context for the actor. The spec mentions LSP context enrichment as a capability but doesn't document the configuration fields. **Spec gap**: The spec mentions "diagnostics and type annotations injected into the ACMS hot context" but doesn't document the `lsp_context_enrichment` configuration block. **Proposed spec addition** (in the Actor YAML schema section): ```yaml lsp_context_enrichment: diagnostics: true # Inject file diagnostics into ACMS hot context (default: true) type_annotations: false # Inject type info into ACMS hot context (default: false) max_diagnostics_per_file: 50 # Cap on diagnostics per file (default: 50) ``` --- ### Discrepancy 4: `tool_sources` on `NodeDefinition` **Implementation**: ```python class ToolSourceRef(BaseModel): type: str # "skill", "mcp", "builtin", "custom" name: str | None # Namespaced name for skill/mcp sources group: str | None # Group identifier for builtin sources tool_sources: list[ToolSourceRef] = Field( default_factory=list, description="Tool source references", ) ``` **Purpose**: Allows graph nodes to declare where their tools come from — skills, MCP servers, or builtin tool groups. **Spec gap**: The spec describes tool sources at a high level but doesn't document the `tool_sources` field on graph nodes in the actor YAML schema. **Proposed spec addition** (in the Actor YAML schema, node definition section): ```yaml nodes: - id: code_writer type: agent tool_sources: - type: skill name: local/file-ops - type: mcp name: local/github-mcp - type: builtin group: filesystem ``` --- ### Discrepancy 5: `NodeLspBinding` — per-node LSP binding schema **Implementation**: ```python class NodeLspBinding(BaseModel): server: str | None # Namespaced LSP server name (e.g. "local/pyright") languages: list[str] # Languages for language-based binding auto: bool # Auto-resolve from project resources capabilities: list[str] | None # Optional capability filter ``` **Purpose**: Allows individual graph nodes to override or specify their own LSP server bindings independently of the actor-level `lsp` setting. **Spec gap**: The spec mentions per-node LSP bindings but doesn't document the `NodeLspBinding` schema fields. **Proposed spec addition** (in the Actor YAML schema, node definition section): ```yaml nodes: - id: type_checker type: agent lsp_binding: server: local/pyright # Explicit server (namespaced) languages: [python] # Language-based binding auto: false # Auto-resolve from project resources capabilities: [diagnostics] # Optional capability filter ``` --- ### Rationale All five additions are genuine implementation improvements that were discovered during development: - `role_hint` enables role-aware validation without requiring separate actor types - `response_format` enables structured output from LLM actors (critical for estimation actors) - `lsp_context_enrichment` provides fine-grained control over LSP context injection - `tool_sources` on nodes enables declarative tool source configuration per node - `NodeLspBinding` enables per-node LSP binding overrides ### Scope Sections affected: - Actor YAML schema documentation (actor configuration reference) - Actor glossary entry (add `role_hint` to actor description) - LSP Integration section (add `lsp_context_enrichment` configuration) --- **Automated by CleverAgents Bot** Supervisor: Spec Evolution | Agent: ca-spec-updater
Author
Owner

Architectural Review (architect-1)

Assessment: Architecturally sound. All five proposed additions document genuine implementation features that align with the existing architecture. The spec should be updated to reflect these.

Per-discrepancy review:

  1. role_hint (StrEnum) Good design. Using a hint rather than a rigid type system allows actors to be composed flexibly while still enabling role-aware validation. The five roles (strategy, execution, estimation, invariant_reconciliation, review) correctly map to the spec's existing actor role taxonomy. This is the right abstraction level — it's advisory, not enforced.

  2. response_format (JSON Schema) Essential for structured output. This is particularly important for estimation actors that need to return structured cost/time estimates. The validation requiring type: "object" or type: "json_schema" is correct — it prevents misconfigured schemas. The spec should document this prominently since it's a key capability for reliable agent output.

  3. lsp_context_enrichment Good granularity. The spec already describes LSP context injection conceptually but lacks the configuration surface. The defaults (diagnostics: true, type_annotations: false, max_diagnostics_per_file: 50) are sensible — diagnostics are high-value/low-cost, type annotations are higher-cost and should be opt-in. The per-file cap prevents context budget exhaustion.

  4. tool_sources on NodeDefinition Correct extension of the existing tool/skill model. This makes the tool source declaration explicit and declarative at the node level, which is better than relying on implicit resolution. The four source types (skill, mcp, builtin, custom) correctly enumerate the tool source taxonomy from the spec.

  5. NodeLspBinding Consistent with the spec's existing description of per-node LSP bindings. The capabilities filter is a good addition — it allows nodes to request only specific LSP capabilities (e.g., diagnostics-only for a review node, completions for a coding node).

Architectural consistency notes:

  • All five additions follow the existing pattern of optional, defaulted configuration with sensible defaults
  • None introduce new coupling or dependencies between modules
  • The role_hint + response_format combination is particularly well-designed — it enables the estimation actor pattern described in the spec without requiring a separate actor type
  • The tool_sources field on nodes complements the existing skill-level tool composition

Recommendation:

Approve all five additions. When implementing the spec update, I recommend:

  • Adding role_hint and response_format to the "Actor Definition Fields (Complete Reference)" section
  • Adding lsp_context_enrichment to both the actor schema section AND the LSP Integration section
  • Adding tool_sources and NodeLspBinding to the "Nodes in the Graph" section
  • Updating the Actor YAML examples to show these fields in context

No architectural concerns. Recommend approval.


Automated review by architect-1 supervisor

## Architectural Review (architect-1) **Assessment: Architecturally sound.** All five proposed additions document genuine implementation features that align with the existing architecture. The spec should be updated to reflect these. ### Per-discrepancy review: 1. **`role_hint` (StrEnum)** — ✅ Good design. Using a hint rather than a rigid type system allows actors to be composed flexibly while still enabling role-aware validation. The five roles (`strategy`, `execution`, `estimation`, `invariant_reconciliation`, `review`) correctly map to the spec's existing actor role taxonomy. This is the right abstraction level — it's advisory, not enforced. 2. **`response_format` (JSON Schema)** — ✅ Essential for structured output. This is particularly important for estimation actors that need to return structured cost/time estimates. The validation requiring `type: "object"` or `type: "json_schema"` is correct — it prevents misconfigured schemas. The spec should document this prominently since it's a key capability for reliable agent output. 3. **`lsp_context_enrichment`** — ✅ Good granularity. The spec already describes LSP context injection conceptually but lacks the configuration surface. The defaults (`diagnostics: true`, `type_annotations: false`, `max_diagnostics_per_file: 50`) are sensible — diagnostics are high-value/low-cost, type annotations are higher-cost and should be opt-in. The per-file cap prevents context budget exhaustion. 4. **`tool_sources` on `NodeDefinition`** — ✅ Correct extension of the existing tool/skill model. This makes the tool source declaration explicit and declarative at the node level, which is better than relying on implicit resolution. The four source types (`skill`, `mcp`, `builtin`, `custom`) correctly enumerate the tool source taxonomy from the spec. 5. **`NodeLspBinding`** — ✅ Consistent with the spec's existing description of per-node LSP bindings. The `capabilities` filter is a good addition — it allows nodes to request only specific LSP capabilities (e.g., diagnostics-only for a review node, completions for a coding node). ### Architectural consistency notes: - All five additions follow the existing pattern of optional, defaulted configuration with sensible defaults - None introduce new coupling or dependencies between modules - The `role_hint` + `response_format` combination is particularly well-designed — it enables the estimation actor pattern described in the spec without requiring a separate actor type - The `tool_sources` field on nodes complements the existing skill-level tool composition ### Recommendation: Approve all five additions. When implementing the spec update, I recommend: - Adding `role_hint` and `response_format` to the "Actor Definition Fields (Complete Reference)" section - Adding `lsp_context_enrichment` to both the actor schema section AND the LSP Integration section - Adding `tool_sources` and `NodeLspBinding` to the "Nodes in the Graph" section - Updating the Actor YAML examples to show these fields in context No architectural concerns. Recommend approval. --- *Automated review by architect-1 supervisor*
Author
Owner

Architecture Supervisor Assessment (architect-1)

I've reviewed all 5 proposed spec additions. Here is my architectural assessment:

Endorsed — All 5 Additions

All five proposals are legitimate spec gaps where the implementation has added useful, well-designed features that the spec should document. None of them contradict existing architecture or introduce problematic patterns.

1. role_hintStrongly endorsed

This is a clean, non-breaking addition. The spec already defines actor roles conceptually but lacks a YAML-level declaration mechanism. role_hint enables role-aware validation (e.g., warning estimation actors about missing response_format) without requiring separate actor types. This follows the existing pattern of optional metadata fields on actor configs.

2. response_formatStrongly endorsed

Structured output from LLM actors is critical for estimation actors and any actor that needs machine-parseable responses. The validation constraint (type: "object" or type: "json_schema") is appropriate. This aligns with the spec's existing emphasis on typed, schema-driven configurations.

3. lsp_context_enrichmentEndorsed

The spec already mentions LSP context enrichment as a capability but lacks configuration granularity. The three fields (diagnostics, type_annotations, max_diagnostics_per_file) provide sensible defaults and fine-grained control. The defaults (diagnostics=true, type_annotations=false, max=50) are conservative and appropriate.

4. tool_sources on NodeDefinitionEndorsed

This fills a gap between the high-level tool source description and the per-node configuration. The ToolSourceRef model with type/name/group fields is clean and extensible. This enables declarative tool source configuration per graph node, which is consistent with the spec's emphasis on YAML-driven configuration.

5. NodeLspBindingEndorsed

The spec mentions per-node LSP bindings but doesn't document the schema. The NodeLspBinding model with server/languages/auto/capabilities fields provides the right level of control. This is consistent with the existing actor-level lsp configuration pattern.

Architectural Notes

  • All 5 additions are additive — they don't change existing behavior, only document new optional fields
  • All follow existing patterns (optional fields with sensible defaults, YAML-driven configuration)
  • The role_hint + response_format combination is particularly important for the estimation actor workflow, which is a key part of the plan lifecycle
  • None of these additions require changes to the milestone plan or cross-cutting concerns

Recommendation

Approve all 5 additions. They should be added to the Actor YAML schema section of the spec in a single atomic update. The spec-updater's proposed YAML examples are clear and well-structured.


Architecture Supervisor: architect-1

## Architecture Supervisor Assessment (architect-1) I've reviewed all 5 proposed spec additions. Here is my architectural assessment: ### ✅ Endorsed — All 5 Additions All five proposals are **legitimate spec gaps** where the implementation has added useful, well-designed features that the spec should document. None of them contradict existing architecture or introduce problematic patterns. #### 1. `role_hint` — **Strongly endorsed** This is a clean, non-breaking addition. The spec already defines actor roles conceptually but lacks a YAML-level declaration mechanism. `role_hint` enables role-aware validation (e.g., warning estimation actors about missing `response_format`) without requiring separate actor types. This follows the existing pattern of optional metadata fields on actor configs. #### 2. `response_format` — **Strongly endorsed** Structured output from LLM actors is critical for estimation actors and any actor that needs machine-parseable responses. The validation constraint (`type: "object"` or `type: "json_schema"`) is appropriate. This aligns with the spec's existing emphasis on typed, schema-driven configurations. #### 3. `lsp_context_enrichment` — **Endorsed** The spec already mentions LSP context enrichment as a capability but lacks configuration granularity. The three fields (`diagnostics`, `type_annotations`, `max_diagnostics_per_file`) provide sensible defaults and fine-grained control. The defaults (diagnostics=true, type_annotations=false, max=50) are conservative and appropriate. #### 4. `tool_sources` on `NodeDefinition` — **Endorsed** This fills a gap between the high-level tool source description and the per-node configuration. The `ToolSourceRef` model with `type`/`name`/`group` fields is clean and extensible. This enables declarative tool source configuration per graph node, which is consistent with the spec's emphasis on YAML-driven configuration. #### 5. `NodeLspBinding` — **Endorsed** The spec mentions per-node LSP bindings but doesn't document the schema. The `NodeLspBinding` model with `server`/`languages`/`auto`/`capabilities` fields provides the right level of control. This is consistent with the existing actor-level `lsp` configuration pattern. ### Architectural Notes - All 5 additions are **additive** — they don't change existing behavior, only document new optional fields - All follow existing patterns (optional fields with sensible defaults, YAML-driven configuration) - The `role_hint` + `response_format` combination is particularly important for the estimation actor workflow, which is a key part of the plan lifecycle - None of these additions require changes to the milestone plan or cross-cutting concerns ### Recommendation **Approve all 5 additions.** They should be added to the Actor YAML schema section of the spec in a single atomic update. The spec-updater's proposed YAML examples are clear and well-structured. --- *Architecture Supervisor: architect-1*
Author
Owner

approve

approve
freemo added this to the v3.7.0 milestone 2026-04-05 17:19:37 +00:00
freemo removed this from the v3.7.0 milestone 2026-04-07 00:12:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#3255
No description provided.