# Foundry v0.3.0 - Table of Contents

> Instruments for reading an Ash/Phoenix project: manifest, lint rules, Spark introspection, scenario extraction, and the project context map.

## Pages

- [Foundry](readme.md)

## Modules

- [Foundry](Foundry.md): Foundry keeps the contexts that define your domain
and business logic.
- [Foundry.Annotations](Foundry.Annotations.md): Registers standard Foundry annotation module attributes as persistent.
- [Foundry.Compliance.CheckResult](Foundry.Compliance.CheckResult.md): The typed output for `mix foundry.compliance.check --json`.
Reports the implementation and test coverage status for each declared RG-* requirement.
- [Foundry.Compliance.CheckResult.Requirement](Foundry.Compliance.CheckResult.Requirement.md): The status of a single RG-* compliance requirement.
- [Foundry.Compliance.CheckResult.Summary](Foundry.Compliance.CheckResult.Summary.md): Aggregate counts across all requirements.
- [Foundry.Config](Foundry.Config.md): Ash domain for Foundry's internal resources (Manifest).
Used only when loading and validating project manifests.
- [Foundry.Context](Foundry.Context.md): Ash domain over the instruments: project status, module context, the system
graph, lint runs, and spec-kit documents.
- [Foundry.Context.AllContext](Foundry.Context.AllContext.md): The typed output for `mix foundry.context.all --json`.
A map of domain name strings to lists of ModuleContext structs.
- [Foundry.Context.Cache](Foundry.Context.Cache.md): ETS-backed cache for module context data.
- [Foundry.Context.Compact](Foundry.Context.Compact.md): Generic recursive compact serialization that filters empty values from maps and structs.
- [Foundry.Context.EdgeEntry](Foundry.Context.EdgeEntry.md): Represents a directed edge between two nodes in the project context graph.
- [Foundry.Context.GraphBuilder](Foundry.Context.GraphBuilder.md): Assembles the complete project graph by collecting all nodes and deriving edges
between them based on structural and behavioral relationships.
- [Foundry.Context.Introspector](Foundry.Context.Introspector.md): Core Spark DSL introspection logic for `mix foundry.context` and
`mix foundry.context.all`.
- [Foundry.Context.LLMFormatter](Foundry.Context.LLMFormatter.md): Formats project context for LLM consumption using compact text notation.
- [Foundry.Context.LockFile](Foundry.Context.LockFile.md): Manages the context lock file (.foundry/context.lock) which tracks whether
the cached project context is fresh.
- [Foundry.Context.ModuleContext](Foundry.Context.ModuleContext.md): The typed output struct for `mix foundry.context <Module> --json`.
- [Foundry.Context.ModuleDiscovery](Foundry.Context.ModuleDiscovery.md): Discovers a target project's modules by scanning its compiled BEAM files.
- [Foundry.Context.NodeBuilder](Foundry.Context.NodeBuilder.md): Builds a NodeEntry from SparkMeta.ModuleInfo and project manifest.

- [Foundry.Context.NodeEntry](Foundry.Context.NodeEntry.md): The core typed output struct for per-module context queries.
Mirrors the ModuleContext schema but with extended metadata.
- [Foundry.Context.PendingMigrations](Foundry.Context.PendingMigrations.md): Determines which modules have pending Ash migrations by running
`mix ash.codegen --check` once per project invocation.
- [Foundry.Context.ProjectContext](Foundry.Context.ProjectContext.md): Provides convenient access to project context (nodes, edges) without running mix tasks.
- [Foundry.Context.ProjectMap](Foundry.Context.ProjectMap.md): Assembles and compacts the complete project context map.

- [Foundry.Context.RouterIntrospector](Foundry.Context.RouterIntrospector.md): Introspects Phoenix router modules to extract LiveView route metadata.
- [Foundry.Context.ScenarioCache](Foundry.Context.ScenarioCache.md): Caches the latest scenario extraction report and tells subscribers when it
changes.
- [Foundry.Context.ScenarioExtractor](Foundry.Context.ScenarioExtractor.md): Extracts Studio scenarios from executable test source.
- [Foundry.Context.SessionState](Foundry.Context.SessionState.md): Captures system map state at the start of an editing session.
Used by the studio to render preview mode during active proposals.
- [Foundry.Context.SpecKitIndexBuilder](Foundry.Context.SpecKitIndexBuilder.md): Builds the spec-kit index by scanning ADRs, runbooks, findings, regulations, and other
documentation files. Extracts summaries, tags, and token counts.
- [Foundry.DepChecker](Foundry.DepChecker.md): Checks system dependencies required for Foundry.

- [Foundry.Diagram.SystemMap](Foundry.Diagram.SystemMap.md): The typed output for `mix foundry.diagram.generate --json`.
A graph of nodes (modules) and edges (relationships), clustered by domain.
Consumed by the Phase 2 System Map D3 renderer.
- [Foundry.Diagram.SystemMap.Cluster](Foundry.Diagram.SystemMap.Cluster.md): A named cluster of nodes — corresponds to one domain.
- [Foundry.Diagram.SystemMap.Edge](Foundry.Diagram.SystemMap.Edge.md): A directed edge between two nodes. Represents a relationship, rule application, or Transfer step dependency.
- [Foundry.Diagram.SystemMap.Node](Foundry.Diagram.SystemMap.Node.md): A node in the system map graph. Corresponds to one Ash resource, Transfer, Rule, etc.
- [Foundry.FileSystem](Foundry.FileSystem.md): Validated file read boundary for all project file access in channels and controllers.
- [Foundry.Lint.LintReport](Foundry.Lint.LintReport.md): The typed output for `mix foundry.lint.all --json`.
Aggregates all violations from all lint rules across all modules.
- [Foundry.Lint.LintReport.Violation](Foundry.Lint.LintReport.Violation.md): A single lint violation from any lint rule.
- [Foundry.Lint.Run](Foundry.Lint.Run.md): Ash resource wrapping the output of `mix foundry.lint.all`.
- [Foundry.Lint.Runner](Foundry.Lint.Runner.md): High-level orchestrator for the lint suite.
- [Foundry.LintRules.AdapterVersionRule](Foundry.LintRules.AdapterVersionRule.md)
- [Foundry.LintRules.ArchivalRule](Foundry.LintRules.ArchivalRule.md)
- [Foundry.LintRules.AshAiStepRule](Foundry.LintRules.AshAiStepRule.md): Agent steps must declare confidence thresholds, tools, and telemetry (INV-014..017).
- [Foundry.LintRules.DescriptionRule](Foundry.LintRules.DescriptionRule.md)
- [Foundry.LintRules.GraphqlMutationRule](Foundry.LintRules.GraphqlMutationRule.md): Sensitive resources with GraphQL mutations must have explicit authorization policies.
- [Foundry.LintRules.IdempotencyRule](Foundry.LintRules.IdempotencyRule.md)
- [Foundry.LintRules.LiveViewStateCoverageRule](Foundry.LintRules.LiveViewStateCoverageRule.md)
- [Foundry.LintRules.ManifestValidator](Foundry.LintRules.ManifestValidator.md): Validates the manifest keyword list directly (not per-module).
Does not implement SparkLint.Rule — it is run as a separate pass.

- [Foundry.LintRules.ObanTriggerRule](Foundry.LintRules.ObanTriggerRule.md): INV-011 extension: Sensitive resources with Oban queues must have paper_trail.
- [Foundry.LintRules.PaperTrailRule](Foundry.LintRules.PaperTrailRule.md)
- [Foundry.LintRules.Registry](Foundry.LintRules.Registry.md): Explicit registry of all active lint rules.
Adding a new Foundry.LintRules.* module requires adding it here.
Accidental registration is worse than a deliberate omission.

- [Foundry.LintRules.RunbookRule](Foundry.LintRules.RunbookRule.md)
- [Foundry.LintRules.VersionRule](Foundry.LintRules.VersionRule.md)
- [Foundry.Manifest](Foundry.Manifest.md): The project manifest resource. Validates and provides typed access to the
`.foundry/manifest.exs` configuration file for a target project.
- [Foundry.Manifest.ApprovalSla](Foundry.Manifest.ApprovalSla.md): 
- [Foundry.Manifest.ApproverConfig](Foundry.Manifest.ApproverConfig.md): 
- [Foundry.Manifest.Calculations.LibraryEnabled](Foundry.Manifest.Calculations.LibraryEnabled.md): Module-based calculation for `Foundry.Manifest`.
Returns true if the given library atom is present in `conditional_libraries`.
- [Foundry.Manifest.CoverageWeights](Foundry.Manifest.CoverageWeights.md): 
- [Foundry.Manifest.DataRetention](Foundry.Manifest.DataRetention.md): 
- [Foundry.Manifest.NotificationConfig](Foundry.Manifest.NotificationConfig.md): 
- [Foundry.Manifest.NotificationTarget](Foundry.Manifest.NotificationTarget.md): 
- [Foundry.Manifest.Parser](Foundry.Manifest.Parser.md): Reads and parses .foundry/manifest.exs from a project root.
Returns the manifest as a keyword list.
Caches per {file_path, mtime} in ETS.

- [Foundry.Manifest.Reader](Foundry.Manifest.Reader.md): Loads and validates the project manifest from `.foundry/manifest.exs`.
Returns a validated Foundry.Manifest record or raises on error.

- [Foundry.Manifest.SensitiveExemption](Foundry.Manifest.SensitiveExemption.md): 
- [Foundry.Manifest.Validations.CldrBackendPresent](Foundry.Manifest.Validations.CldrBackendPresent.md): Validates CLDR backend exists when :ash_money is in conditional_libraries.
- [Foundry.Manifest.Validations.RequiredApprovers](Foundry.Manifest.Validations.RequiredApprovers.md): Validates approvers.sensitive_lead and approvers.compliance_officer are present.
- [Foundry.Manifest.Validations.ValidCoverageWeights](Foundry.Manifest.Validations.ValidCoverageWeights.md): Validates coverage_weights values sum to 1.0 ± 0.001.
- [Foundry.Manifest.Validations.ValidSensitiveExemptions](Foundry.Manifest.Validations.ValidSensitiveExemptions.md): Validates sensitive_resource_exemptions reference modules in sensitive_resources.
- [Foundry.MixLock](Foundry.MixLock.md): Helpers for reading resolved dependency versions from `mix.lock`.
- [Foundry.PageMetadata](Foundry.PageMetadata.md): Shared page metadata inference for LiveView modules.
- [Foundry.Project.Graph](Foundry.Project.Graph.md): Ash resource wrapping the full project context graph from `mix foundry.project.context`.
- [Foundry.Project.Module](Foundry.Project.Module.md): Ash resource wrapping the output of `mix foundry.context <Module>`.
- [Foundry.Project.Status](Foundry.Project.Status.md): Ash resource wrapping the output of `mix foundry.project.status`.
- [Foundry.SparkMeta](Foundry.SparkMeta.md): Foundry-specific facade over the generic `spark_meta` analysis pipeline.

- [Foundry.SparkMeta.Action](Foundry.SparkMeta.Action.md): Structured representation of an Ash resource action.
- [Foundry.SparkMeta.Analyzers.LiveViewActions](Foundry.SparkMeta.Analyzers.LiveViewActions.md): Scans LiveView module source to infer Ash action calls.

- [Foundry.SparkMeta.Analyzers.PageMetadata](Foundry.SparkMeta.Analyzers.PageMetadata.md): Extracts page-related metadata from LiveView modules.
- [Foundry.SparkMeta.Attribute](Foundry.SparkMeta.Attribute.md): Structured representation of an Ash resource attribute.
- [Foundry.SparkMeta.AuthStrategy](Foundry.SparkMeta.AuthStrategy.md): Structured representation of an AshAuthentication strategy.
- [Foundry.SparkMeta.ModuleInfo](Foundry.SparkMeta.ModuleInfo.md): Output struct from `Foundry.SparkMeta.walk/1`.
- [Foundry.SparkMeta.MoneyAttr](Foundry.SparkMeta.MoneyAttr.md): Structured representation of a monetary attribute.
- [Foundry.SparkMeta.Relationship](Foundry.SparkMeta.Relationship.md): Structured representation of an Ash resource relationship.
- [Foundry.SparkMeta.SideEffectEntry](Foundry.SparkMeta.SideEffectEntry.md): Structured representation of a side effect.

- [Foundry.SparkMeta.StepEntry](Foundry.SparkMeta.StepEntry.md): Structured representation of a Reactor step.

- [Foundry.SpecKit.Document](Foundry.SpecKit.Document.md): Ash resource representing a spec-kit document (ADR, runbook, finding, regulation, or usage rule).
- [Foundry.SpecKit.SessionMemory](Foundry.SpecKit.SessionMemory.md): Extracts durable session findings from assistant responses and persists them as
canonical spec-kit artifacts under `docs/findings/`.
- [Foundry.Status](Foundry.Status.md): Runtime health picture composed from all Phase 1 data.
- [Foundry.Status.StackVersions](Foundry.Status.StackVersions.md): Extracts resolved stack dependency versions from mix.lock.

- [Foundry.TestScenario](Foundry.TestScenario.md): Lightweight test-side annotations for Studio scenario extraction.
- [Foundry.TestScenario.AshTracer](Foundry.TestScenario.AshTracer.md): Ash.Tracer implementation for Foundry scenario tracing.
- [Foundry.TestScenario.LiveViewHook](Foundry.TestScenario.LiveViewHook.md): Phoenix LiveView on_mount hook that registers the LiveView channel PID
with its associated test process PID during test execution.
- [Foundry.TestScenario.LiveViewRegistry](Foundry.TestScenario.LiveViewRegistry.md): ETS-backed registry mapping LiveView channel PIDs to test process PIDs.
- [Foundry.Verifiers.ComplianceResourceRequiresArchival](Foundry.Verifiers.ComplianceResourceRequiresArchival.md): Spark compile-time verifier: any Ash.Resource referenced in manifest.compliance_requirements
must use AshArchival.Resource.
- [Foundry.Verifiers.ReactorWithSideEffectsRequiresIdempotency](Foundry.Verifiers.ReactorWithSideEffectsRequiresIdempotency.md): Spark compile-time verifier: any Reactor with side-effecting step types
(:create, :update, :destroy, :action, :run) must define @idempotency_key.
- [Foundry.Verifiers.SensitiveResourceRequiresPaperTrail](Foundry.Verifiers.SensitiveResourceRequiresPaperTrail.md): Spark compile-time verifier: any Ash.Resource listed in manifest.sensitive_resources
must use AshPaperTrail.Resource.
- [Foundry.Versions.VersionManifest](Foundry.Versions.VersionManifest.md): The typed output for `mix foundry.versions.check --json`.
Current dependency versions read from mix.exs.

## Mix Tasks

- [mix foundry.compliance.check](Mix.Tasks.Foundry.Compliance.Check.md): Reads all regulation files in `docs/regulations/`, extracts RG-* requirements,
then verifies each one has at least one `implementation:` pointer to a module
or test, and that a corresponding ExUnit test exists tagged `:compliance`.
- [mix foundry.context](Mix.Tasks.Foundry.Context.md): Introspects a single compiled Ash/Reactor/Rule module and emits its full
context as a JSON object matching `Foundry.Context.ModuleContext`.
- [mix foundry.context.all](Mix.Tasks.Foundry.Context.All.md): Introspects every Foundry-relevant compiled module in the current project and
emits a JSON object mapping domain names to arrays of `ModuleContext` objects.
- [mix foundry.diagram.generate](Mix.Tasks.Foundry.Diagram.Generate.md): Builds the system map graph by calling `Foundry.Context.Introspector.build_all/1`,
projecting the result into `Foundry.Diagram.SystemMap` (nodes, edges, clusters),
and writing the output to `docs/diagrams/system_map.json`.
- [mix foundry.init](Mix.Tasks.Foundry.Init.md): Initialize a new Foundry project by scaffolding required directories and files.
- [mix foundry.lint.all](Mix.Tasks.Foundry.Lint.All.md): Runs the full Foundry lint suite against all compiled modules and the project
manifest. Emits a JSON report and exits non-zero if any `:error` severity
violations are found.
- [mix foundry.mcp.stdio](Mix.Tasks.Foundry.Mcp.Stdio.md): Foundry MCP stdio bridge for Codex and other CLI tools.
- [mix foundry.project.context](Mix.Tasks.Foundry.Project.Context.md): Generates project context for Foundry modules.
- [mix foundry.project.status](Mix.Tasks.Foundry.Project.Status.md): Outputs the current project health status as JSON.
- [mix foundry.scenarios.extract](Mix.Tasks.Foundry.Scenarios.Extract.md)
- [mix foundry.versions.check](Mix.Tasks.Foundry.Versions.Check.md): Reads `mix.exs` in the current project directory and emits the version of
every known Foundry-ecosystem dependency as a JSON object.

