# How it works

Source: https://aunysillyme.dev/projects/shared-agent-memory/docs/how-it-works/

Generated from steps/steps.yaml. Change the registry, then run `npm run docs`.

## Collector

1. [Lock](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/01-lock.md): Acquire the collector lock.
2. [Load config](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/02-load-config.md): Load settings and keys from the environment.
3. [Discover](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/03-discover.md): Discover memory through source profiles.
4. [Read](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/04-read.md): Read source files without modifying them.
5. [Normalize](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/05-normalize.md): Normalize encoding and frontmatter.
6. [Chunk](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/06-chunk.md): Split text at headings or paragraphs.
7. [Fingerprint](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/07-fingerprint.md): Fingerprint each source file.
8. [Diff](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/08-diff.md): Find files changed since acknowledgment.
9. [Inventory](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/09-inventory.md): Build the full inventory for every AI.
10. [Reconcile](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/10-reconcile.md): Rebuild a source missing from the store.
11. [Pack](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/11-pack.md): Pack batches within the byte and chunk caps.
12. [Send](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/12-send.md): Send batches with the write key.
13. [Save](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/13-save.md): Save only acknowledged fingerprints.
14. [Log](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/14-log.md): Log counts only.

## Server

15. [Authorize write](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/15-authorize-write.md): Check the write key.
16. [Validate](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/16-validate.md): Validate the batch schema and limits.
17. [Scan](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/17-scan.md): Scan every chunk and path for secrets.
18. [Guard](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/18-guard.md): Guard empty inventories and mass deletion.
19. [Dedupe](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/19-dedupe.md): Dedupe exact chunk copies.
20. [Embed](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/20-embed.md): Embed new chunks.
21. [Link](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/21-link.md): Link copies held by different AIs.
22. [Privacy](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/22-privacy.md): Apply privacy tags.
23. [Write](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/23-write.md): Write the batch in one transaction.
24. [Remove](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/24-remove.md): Remove files missing from the inventory.
25. [Ack](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/25-ack.md): Reply with acknowledged files.

## Search

26. [Authorize read](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/26-authorize-read.md): Check the read key.
27. [Embed query](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/27-embed-query.md): Embed the search query.
28. [Filter](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/28-filter.md): Filter by scope and privacy tags.
29. [Rank](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/29-rank.md): Rank by cosine distance.
30. [Frame](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/30-frame.md): Frame each hit as stored data.

## Ops

31. [Freshness](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/31-freshness.md): Measure freshness for each device.
32. [Alert](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/32-alert.md): Report stale or unavailable collection.
33. [Rebuild](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/steps/33-rebuild.md): Rebuild the full store safely.
