Skip to content

[DOCS] Document memory git sync backend (memory.backend) #296

Closed

Description

@inference-gateway-maintainer

What needs documenting

The CLI's persistent memory now supports a configurable sync backend so the local memory directory (~/.infer/memory) can be backed by a git remote: pull on run start, commit + push on change. This shipped in inference-gateway/cli#707 (closes inference-gateway/cli#683) and is currently undocumented in the docs repo.

Today cli.md -> Persistent Memory -> Configuration (memory.yaml) only documents the local knobs (enabled, dir, max_chars) from the original memory feature (#679). The new backend block is missing entirely.

Affected page

  • cli.md, section Persistent Memory -> subsection Configuration (memory.yaml) (the table listing enabled / dir / max_chars and their INFER_MEMORY_* env vars). Add a new Sync backend subsection there.

What to add

Config surface (memory.yaml)

enabled: true
dir: '' # "" => ~/.infer/memory
max_chars: 4000
backend:
  type: local # local (default) | git
  git:
    repo: '[email protected]:my-org/agent-memory.git'
    branch: main
    commit_message: 'chore(memory): sync'
    timeout: 60 # seconds per git op
    sync:
      on_start: pull # pull (default) | off
      on_finish: push # push (default) | off

type: local is the default and a pure no-op - existing users see no change.

Keys and env vars

Key Default Environment variable Notes
backend.type local INFER_MEMORY_BACKEND_TYPE local (no-op) or git.
backend.git.repo '' INFER_MEMORY_BACKEND_GIT_REPO Remote URL. Required when type: git.
backend.git.branch main INFER_MEMORY_BACKEND_GIT_BRANCH Branch to track.
backend.git.commit_message chore(memory): sync INFER_MEMORY_BACKEND_GIT_COMMIT_MESSAGE Deterministic, non-LLM commit message.
backend.git.timeout 60 INFER_MEMORY_BACKEND_GIT_TIMEOUT Seconds per git op (prevents credential hangs).
backend.git.sync.on_start pull INFER_MEMORY_BACKEND_GIT_SYNC_ON_START pull or off.
backend.git.sync.on_finish push INFER_MEMORY_BACKEND_GIT_SYNC_ON_FINISH push or off.

Validation: when memory is enabled and type: git, repo is required; on_start must be pull/off; on_finish must be push/off.

Behavior worth calling out

  • SyncIn (run start): clones the repo if the memory dir is missing, else fast-forward / rebase pulls. An ls-remote probe decides clone vs. init-in-place (empty remote or pre-existing local memory).
  • SyncOut (on change only): commits + pushes only when git status --porcelain shows changes (the "if there were any changes" part), via a bounded push -> pull-rebase -> retry loop plus a per-host flock so concurrent runs (channels / scheduler / heartbeat) do not clobber each other.
  • Where it pushes from: in chat, the push happens via the Memory tool on write/delete (not a post-session hook, which would commit-storm per message); in headless infer agent, it pulls on start and pushes at run finish. Works across channels / scheduler / heartbeat subprocess runs.
  • Best-effort, never fatal: a failed clone/pull/push logs and continues; it never aborts the agent run.
  • Auth: uses the ambient git credential chain (ssh-agent / credential helper / GIT_*); the backend injects no ssh/env override. Document SSH vs gh auth vs token-in-URL. A warning is logged if the repo URL embeds credentials (they persist in .git/config) - SSH is preferred. The per-op timeout prevents hangs on an interactive credential prompt.

References

Activity

  1. added
    documentation
    on Jul 2, 2026
  2. edenreich commented on Jul 2, 2026

    @edenreich
    Contributor

    @claude Can you document it?

  3. added theissue type on Jul 2, 2026
  4. inference-gateway-maintainer commented on Jul 2, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Claude finished @edenreich's task in 6m 9s —— View job • docs/issue-296-20260702-1147 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-296-20260702-1147?quick_pull=1&title=Issue%20%23296%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23296%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Documenting the memory git sync backend

    • Read cli.md -> Persistent Memory section for current structure
    • Add a new Sync backend subsection (config surface, keys/env vars, behavior, auth)
    • Add a pointer to it from the Configuration (memory.yaml) subsection
    • Run format, lint:md, and build to verify (all pass)
    • Commit and open a PR

    Done. I documented the new memory.backend git sync feature in cli.md, under Persistent Memory.

    What I added - a new Sync backend subsection covering:

    • The backend config surface in memory.yaml (type: local | git), with type: local called out as the default no-op so existing users see no change.
    • A full keys table: backend.type, backend.git.repo, branch, commit_message, timeout, sync.on_start, sync.on_finish - with defaults and their INFER_MEMORY_BACKEND_* env vars.
    • Validation rules when type: git (repo required; on_start pull/off; on_finish push/off).
    • How it syncs: SyncIn on run start (clone vs. init-in-place via ls-remote probe), SyncOut on change only (git status --porcelain gate, bounded push -> pull-rebase -> retry loop, per-host flock), where the push happens (chat Memory tool on write/delete vs. headless infer agent at run finish), and best-effort / never-fatal semantics.
    • Authentication: the ambient git credential chain (SSH preferred vs. gh auth vs. token-in-URL), the credentials-in-URL warning, and the per-op timeout.

    I also added a one-line pointer to the new subsection from the existing Configuration (memory.yaml) subsection.

    Verification - bun run format:check, bun run lint:md, and bun run build all pass; the new prose is server-rendered into dist/cli/index.html and picked up by the local search index (consistent with the repo's SSR/SEO conventions).

    PR: #298 - docs: document memory git sync backend (memory.backend)
    | Branch: docs/issue-296-20260702-1147

  5. moved this from Todo to In progress in 2026on Jul 2, 2026
  6. moved this from In progress to QA in 2026on Jul 2, 2026
  7. inference-gateway-releaser commented on Jul 2, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.6.115 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  8. moved this from QA to Done in 2026on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions