# Use Cases

What to actually do with Fabric once it's installed. Pick one below, or scroll to see what compounds over time.

<Tabs>
  <Tab title="Replace grep">
    ## Stop grepping, start querying

    You don't need to know a codebase's exact filenames or literal strings to find what you need. `fabric_query` matches by name (with fuzzy correction) and walks structural edges from there; `fabric_text_search` covers exact literals and error strings when you do need raw text.

    ```text
    fabric_query({ name: "AuthService", depth: 2 })
    ```

    Returns ranked matches by structural fan-in, plus their call graph two hops out, real structure instead of a flat list of matching lines.
  </Tab>

  <Tab title="Learn + visualize">
    ## Orient on unfamiliar code, then look at it

    `fabric_explain` gives a full structural summary of one symbol: its callers, callees, tests, contracts, and any tech-debt markers attached to it. `fabric_visualize` opens an interactive 3D graph of the whole indexed codebase in your browser, useful the moment you want to see the shape of a system instead of reading it file by file.

    ```text
    fabric_explain({ symbol: "PaymentProcessor.charge" })
    fabric_visualize()
    ```
  </Tab>

  <Tab title="Rules & policies">
    ## Write a rule once, enforced every time

    `fabric_govern_add` adds a governance rule; `fabric_govern` checks a proposed change against every rule you've added, before it lands. This is how "don't let an agent touch this file without a human review" becomes something enforced instead of something written in a prompt and hoped for.

    ```text
    fabric_govern_add({ rule: "..." })
    fabric_govern({ change: proposedDiff })
    ```

    Returns `allowed: true/false`, the exact rule that matched, and records the check to the audit trail either way.
  </Tab>

  <Tab title="Share memory across agents">
    ## Carry context from one agent to another

    Each agent (Claude Code, Cursor, Codex) gets its own continuity chain by default, isolated. When you want two of them to share history on purpose, `cross_agent: true` widens the read to all your agents instead of merging everything automatically.

    ```text
    fractal_begin({ agent_id: "cursor", cross_agent: true })
    ```

    Isolated by default, shared when you say so, not an automatic merge.
  </Tab>

  <Tab title="Hydrate a new session">
    ## Start a session with zero prompt

    `fractal_begin` resolves continuity from your last closure receipt automatically, no prompt needed to re-explain what happened last time. Mid-session, after a context loss, `fractal_rehydrate` does the same recovery without starting over.

    ```text
    fractal_begin({ agent_id: "claude-code" })
    ```

    Returns the prior handoff summary if one exists, or an honest "genesis" if this is truly the first session, either way, you didn't have to write it yourself.
  </Tab>
</Tabs>

## What compounds over time

<Callout variant="tip">
  The five use cases above pay off immediately. This one pays off more the longer you use Fabric on a project.
</Callout>

Long builds move fast: hundreds of files change over days or weeks, and a code index that isn't kept current quietly becomes wrong. `fabric_staleness` checks whether the indexed graph still matches what's actually on disk; the background watcher reindexes on every edit so it doesn't have to be asked. The result is that an agent's understanding of your codebase stays as fresh on day thirty of a build as it was on day one, instead of slowly rotting while nobody notices.
