> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memloom.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Distill agent sessions into memories

> What `memloom import sessions` calls. Claude Code is the only supported agent today
and the default. Discovers local Claude Code transcripts (fixed to
`~/.claude/projects`; the client cannot pass an arbitrary path), then for
each session checks the ledger, redacts secret-shaped strings, chunks, distills with
the configured LLM into typed memories, embeds, and saves through the belief
pipeline. The response streams NDJSON: one `{"type":"item"}` event per session, then
a final `{"type":"done"}` event with the run totals and the cost line (extraction,
embedding, and classifier calls spent). A dry run makes zero LLM calls and writes
nothing.




## OpenAPI

````yaml /openapi.yaml post /import/sessions/stream
openapi: 3.1.0
info:
  title: memloom local API
  version: 0.1.0
  description: >
    The HTTP API served by the `memloom serve` daemon on your machine. The CLI,
    the MCP server,

    and the viewer all route through this API. The daemon is the single owner of
    the store, so

    every client shares one consistent view of your memories.


    No authentication: the daemon binds to `127.0.0.1` only and is reachable
    solely from your

    own machine. Browser clients on other localhost ports are allowed via CORS.
servers:
  - url: http://127.0.0.1:4319
    description: Local memloom daemon
security: []
paths:
  /import/sessions/stream:
    post:
      summary: Distill agent sessions into memories
      description: >
        What `memloom import sessions` calls. Claude Code is the only supported
        agent today

        and the default. Discovers local Claude Code transcripts (fixed to

        `~/.claude/projects`; the client cannot pass an arbitrary path), then
        for

        each session checks the ledger, redacts secret-shaped strings, chunks,
        distills with

        the configured LLM into typed memories, embeds, and saves through the
        belief

        pipeline. The response streams NDJSON: one `{"type":"item"}` event per
        session, then

        a final `{"type":"done"}` event with the run totals and the cost line
        (extraction,

        embedding, and classifier calls spent). A dry run makes zero LLM calls
        and writes

        nothing.
      operationId: importSessionsStream
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                agent:
                  type: string
                  description: >-
                    Which agent's sessions to import. Default and only supported
                    value today is claude-code.
                  example: claude-code
                days:
                  type: integer
                  description: Widen the day window (default 14).
                  example: 60
                maxSessions:
                  type: integer
                  description: Raise the session cap (default 20).
                  example: 100
                project:
                  type: string
                  description: >-
                    Only sessions whose project folder name contains this
                    substring.
                  example: myapp
                dryRun:
                  type: boolean
                  description: List what would be processed; no LLM calls, no writes.
                force:
                  type: boolean
                  description: >-
                    Ignore the ledger and reprocess every discovered session
                    from the start.
      responses:
        '200':
          description: NDJSON progress stream ending with a done (or error) event.
          content:
            application/x-ndjson:
              schema:
                type: string
                example: >
                  {"type":"item","path":"/home/me/.claude/projects/-home-me-app/3f2a....jsonl","project":"app","sessionId":"3f2a...","index":1,"total":3,"outcome":"imported","chunks":2,"saved":4,"merged":0,"versioned":1,"conflicts":0,"autoResolved":0,"dropped":0,"truncated":0,"redactions":1,"malformed":0}

                  {"type":"done","sessions":3,"skipped":{"sidecars":0,"active":0,"outsideWindow":2,"overCap":0,"upToDate":1},"saved":4,"merged":0,"versioned":1,"conflicts":0,"autoResolved":0,"dropped":0,"truncated":0,"redactions":1,"malformed":0,"calls":{"extraction":2,"embedding":2,"classifier":1},"dryRun":false}
        '400':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    ValidationError:
      description: The request body failed validation. `issues` names each offending field.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: invalid request body
              issues:
                type: array
                items:
                  type: object
                  properties:
                    path:
                      type: string
                      example: query
                    message:
                      type: string
                      example: query must be a non-empty string

````