Skip to content
Back to skills

1024 State Tree Progress F26fd6cd

ASecurity

**Status**: Accepted **Date**: 2024-12-27

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
businesspythonnode

Works with

  • cli
  • mcp

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 1024-state-tree-progress_f26fd6cd --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1024 State Tree Progress F26fd6cd?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1024 State Tree Progress F26fd6cd
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1024-state-tree-progress-f26fd6cd/badge)](https://www.skillsdirectory.com/skills/tools-only-1024-state-tree-progress-f26fd6cd)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# ADR 009: Tree-based State for Progress Reporting

**Status**: Accepted
**Date**: 2024-12-27

## Context

The CLI needs to show progress during compilation:
- Which files are being processed
- What operations are running (LLM calls, extracts, refs, etc.)
- Support for future parallel execution of independent files
- Nested operations (e.g., extract filter contains an LLM call)

## Decision

Use a tree of mutable state objects that the compiler updates and the CLI reads.

```python
@dataclass
class OperationState:
    name: str
    status: Status  # pending, processing, done, failed
    detail: str | None
    parent: OperationState | None
    children: list[OperationState]

    def child(self, name: str) -> OperationState:
        """Create child with mutual attachment."""
        child = OperationState(name=name, parent=self)
        self.children.append(child)
        return child
```

Operations self-register by calling `parent.child()` and self-complete by calling `state.done()`.

## Alternatives Considered

1. **Event-based (start/end pairs)**: Requires matching start/end events, complex state reconstruction, error-prone for parallel execution
2. **Polling**: Doesn't fit async model well
3. **Callback per operation type**: Lots of callback parameters, not extensible to new operation types

## Rationale

1. **Simpler mental model**: State is always consistent, no event matching
2. **Parallel-friendly**: Multiple active operations are just tree nodes
3. **Generalizes**: Works for any operation type (LLM, extract, ref, MCP, future ops)
4. **Testable**: Assert on state at any point, not event sequences

## Consequences

- Tighter coupling between compiler and state structure
- Single consumer model (CLI reads state)
- CLI rendering is simple: walk tree, show non-done nodes
- Easy to add verbosity levels (show completed ops, more nesting)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.