# analysis

URL: /kida/api/analysis/
Section: analysis
Description: Kida Template Introspection API.

Static analysis of compiled templates for caching optimization,
validation, and tooling support.

Core Capabilities:
- Block enumeration: "What blocks does this template define?"
- Dependency analysis: "What context variables does this block need?"
- Purity inference: "Is this block deterministic?"
- Role classification: "Is this navigation, content, or sidebar?"
- Cache scope: "Can this be cached per-page or per-site?"

Design Principles:
1. Zero syntax changes — Templates work exactly as before
2. Zero author burden — Introspection is automatic, not annotated
3. Zero runtime impact — Analysis happens at compile time
4. Conservative claims — When uncertain, report "unknown"
5. Standalone-ready — API designed for Kida as independent package
6. Configurable — Memory/analysis trade-off controllable via Environment

Example:
    >>> from kida import Environment
    >>> env = Environment()
    >>> template = env.get_template("page.html")
    >>> meta = template.block_metadata()
    >>> nav = meta.get("nav")
    >>> if nav and nav.cache_scope == "site":
    ...     print(f"Nav can be cached site-wide, depends on: {nav.depends_on}")

Thread-Safety:
All analysis classes are stateless or use immutable results.
Safe for concurrent use across threads.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/analysis/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Findex.txt)

Module

#
`analysis`

Kida Template Introspection API.

Static analysis of compiled templates for caching optimization,
validation, and tooling support.

Core Capabilities:

- Block enumeration: "What blocks does this template define?"

- Dependency analysis: "What context variables does this block need?"

- Purity inference: "Is this block deterministic?"

- Role classification: "Is this navigation, content, or sidebar?"

- Cache scope: "Can this be cached per-page or per-site?"

Design Principles:

- Zero syntax changes — Templates work exactly as before

- Zero author burden — Introspection is automatic, not annotated

- Zero runtime impact — Analysis happens at compile time

- Conservative claims — When uncertain, report "unknown"

- Standalone-ready — API designed for Kida as independent package

- Configurable — Memory/analysis trade-off controllable via Environment

Example:

```
>>> from kida import Environment
>>> env = Environment()
>>> template = env.get_template("page.html")
>>> meta = template.block_metadata()
>>> nav = meta.get("nav")
>>> if nav and nav.cache_scope == "site":
...     print(f"Nav can be cached site-wide, depends on: {nav.depends_on}")
```

Thread-Safety:
All analysis classes are stateless or use immutable results.
Safe for concurrent use across threads.
