# foundry v0.1.3 - Table of Contents

> Foundry: A meta-framework for building governed AI applications

## 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.Audit](Foundry.Audit.md): Ash domain for Foundry audit resources.
- [Foundry.Audit.Event](Foundry.Audit.Event.md): An append-only audit log entry. Records all approval events, apply events,
and compliance-relevant state transitions for `:sensitive` and `:compliance`
proposals.
- [Foundry.Audit.Policies.FoundryBotOnly](Foundry.Audit.Policies.FoundryBotOnly.md): Policy check: only foundry_bot identity can create audit events.
- [Foundry.Audit.Validations.ComplianceAdrLinkPresent](Foundry.Audit.Validations.ComplianceAdrLinkPresent.md): Validates :compliance change events have adr_link.
- [Foundry.Audit.Validations.EmergencyOverrideNotes](Foundry.Audit.Validations.EmergencyOverrideNotes.md): Validates emergency_override events have notes.
- [Foundry.Chat](Foundry.Chat.md): Ash domain for the chat session store.
- [Foundry.Chat.ContextCache](Foundry.Chat.ContextCache.md): ETS-backed cache for expensive chat context assembly.
- [Foundry.Chat.FileSessionStore](Foundry.Chat.FileSessionStore.md): File-backed session store for Studio copilot sessions.
- [Foundry.Chat.MessageClassifier](Foundry.Chat.MessageClassifier.md): Classifies chat messages into mode (ask/change) and proposal commands.
- [Foundry.Chat.Retrieval](Foundry.Chat.Retrieval.md): Foundry-native retrieval and proposal orchestration for the Studio copilot.
- [Foundry.Chat.Session](Foundry.Chat.Session.md): Chat session resource backed by Mnesia disc_copies.
- [Foundry.Chat.SessionStore](Foundry.Chat.SessionStore.md): Behaviour for Studio copilot session persistence.
- [Foundry.ChatTrace](Foundry.ChatTrace.md): Normalizes structured provider events into a UI-friendly Studio copilot trace.

- [Foundry.ClaudeCodeProvider](Foundry.ClaudeCodeProvider.md): Spawns Claude Code CLI as a subprocess and streams LLM responses.
- [Foundry.CodexProvider](Foundry.CodexProvider.md): Spawns OpenAI Codex CLI as a subprocess and streams responses.
- [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 exposing Foundry project context as MCP tools.
- [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 all project modules by scanning the 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 broadcasts updates.

- [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.Copilot.ContextBuilder](Foundry.Copilot.ContextBuilder.md)
- [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.LMStudioProvider](Foundry.LMStudioProvider.md): Local OpenAI-compatible chat provider for LM Studio.
- [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.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.Mailer](Foundry.Mailer.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.PreviewServer](Foundry.PreviewServer.md): Manages a dev server subprocess for live preview of reference projects.
- [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.ProjectManager](Foundry.ProjectManager.md): Coordinates project selection, cloning, dependency installation, and runtime switching.

- [Foundry.Proposals](Foundry.Proposals.md): Ash domain for Foundry proposal resources.
- [Foundry.Proposals.ApprovalSlot](Foundry.Proposals.ApprovalSlot.md): Records a single approval event for a proposal.
Slots are immutable once filled — an approver cannot change their approval.
Revocation requires rejecting the proposal and creating a new one.
See: ADR-014 §Dual Approval Mechanics.
- [Foundry.Proposals.BlobHash](Foundry.Proposals.BlobHash.md): A git blob hash for a single file at the time a proposal was created.
Used for stale detection per ADR-009.
If the file's current blob hash at HEAD differs from this value, the proposal is STALE.
- [Foundry.Proposals.ImpactAnalysis](Foundry.Proposals.ImpactAnalysis.md): Deterministic impact analysis computed by Foundry.Copilot.ImpactAnalyzer.
Not LLM-generated — derived from static analysis of the diff and the project's
context graph. See: ADR-012 §Impact Tab.
- [Foundry.Proposals.LintResult](Foundry.Proposals.LintResult.md): Structured output from the pre-approval lint run.
Populated when a proposal transitions from DRAFT to PENDING_REVIEW.
A proposal with :error severity violations cannot advance past PENDING_REVIEW.
- [Foundry.Proposals.LintViolation](Foundry.Proposals.LintViolation.md): A single lint violation from the pre-approval lint run.
- [Foundry.Proposals.Policies.AuthorizedApply](Foundry.Proposals.Policies.AuthorizedApply.md): Policy check: Only authorized approvers can apply a proposal.

- [Foundry.Proposals.Policies.AuthorizedApprover](Foundry.Proposals.Policies.AuthorizedApprover.md): Policy check: Approver must be a named approver in the manifest with the correct role.

- [Foundry.Proposals.Policies.ProposalVisibility](Foundry.Proposals.Policies.ProposalVisibility.md): Policy check: DRAFT proposals are only visible to the requester.
PENDING_REVIEW and later are visible to all project users.

- [Foundry.Proposals.Proposal](Foundry.Proposals.Proposal.md): A proposed change to a target project's codebase. The central resource for
Foundry's governance model.
- [Foundry.Proposals.Proposal.Version](Foundry.Proposals.Proposal.Version.md): 
- [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.Studio](Foundry.Studio.md): Launch helpers for the local Foundry Studio runtime.
- [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.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.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.studio](Mix.Tasks.Foundry.Studio.md): Starts the Foundry Studio web runtime for the current target project.
- [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.

