# gingugu/gingugu [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/gingugu/gingugu  
**GitHub Stars:** 8  
**Views:** 16  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/gingugu-gingugu

## Description
Persistent memory for AI coding assistants. Local SQLite, no cloud. 16 MCP tools: store, recall, search, relate, consolidate, export, and credential vault (OS keychain). Typed memories with confidence lifecycle (verified/inferred/stale/deprecated), namespaces, knowledge graph, and hybrid BM25 + semantic search via fastembed ONNX. Works with Cursor, Windsurf, Claude, and any MCP client. pip install gingugu

## Tools
Capabilities this server exposes over MCP:

- **memory_store** — Store a new memory in the knowledge base. Use to capture anything worth
        remembering across sessions: decisions, bugs, patterns, architecture choices,
        preferences, facts, workflows, or context. Do not use for ephemeral or
        session-only notes.

        ``type`` must be one of: fact, decision, pattern, bug, architecture, preference,
        workflow, context, capability. ``confidence`` is one of: verified (confirmed true), inferred
        (assumed, not yet confirmed), stale (outdated), deprecated (no longer valid) —
        defaults to "inferred". ``tags`` is comma-separated. ``namespace`` scopes the
        memory to a project or domain; omit to use the configured default namespace.
        ``source`` records what generated this memory (e.g. a file path or tool name).
        ``metadata`` is an optional free-form JSON string for extra structured data.

        ``capability`` records that a thing EXISTS and how to run it, where a
        ``workflow`` says how to do it by hand. It requires
        ``metadata={"capability": {"run": "...", "path": "..."}}`` (``run``
        required; a relative ``path`` resolves against the namespace's repo
        path). Reads report whether ``path`` still ``exists``.

        ``provenance`` declares how you came to believe this: user-asserted (the
        user said so), measured (a command or test showed it), file-derived (read
        from code or docs), or self-concluded (your own inference or opinion).
        Declare it honestly - self-concluded is how a stored opinion arrives
        visibly contestable instead of reading as settled fact. Any other value
        is rejected. ``about`` says what this memory is FOR, in the user's words
        for the thing rather than the words of what was done ("claude code
        bootstrapping", not "init writes hook blocks"). It is searchable.

        When ``dedupe_check`` is True (default), the response includes a
        ``similar_memories`` list of up to 3 existing memories in the same
        namespace whose content/title overlap strongly with this one — a
        non-blocking hint so the caller can choose to update/relate/consolidate
        instead of accumulating near-duplicates. Disable for bulk imports.
        **Usually EMPTY, and that is the signal working.** Each hit carries
        ``similarity`` (0-1) and its ``basis``: ``cosine`` over embeddings, or
        ``lexical`` token overlap when they are unavailable. Unlike a search
        relevance it has magnitude and is comparable between calls - it says
        how close the two texts are, not how this candidate ranked.

        When ``relation_check`` is True (default), the response also includes a
        ``suggested_relations`` list of up to 3 not-already-linked memories worth
        EXAMINING for a relationship. Topical overlap is only how they were
        found; it is not itself a reason to link. Ask whether one of them is the
        memory this one *supersedes*, *contradicts*, was *caused_by*, or belongs
        under - and if the honest answer is "they are just both about the same
        area", link nothing. Search already surfaces topical neighbours, so a
        `related_to` edge that says only "these are similar" adds no retrieval
        signal and competes with the directional edges that do. Same gate as
        above, set softer; ``similar_memories`` are merge candidates instead.

        Both hint lists are COMPACT: title plus a ~200-char ``summary``, never
        full bodies. They are enough to decide whether to merge, link, or move
        on; call ``memory_recall`` when a candidate warrants a closer look.
        Both carry ``similarity`` + ``basis``, never a search ``score``: these
        lists are not a ranking of the corpus, they are a measurement against
        what you just wrote.

        The response may also carry ``contradicted_memories``: older memories
        whose state claim THIS memory just resolved. Recording "PR #10 merged"
        makes every memory still asserting "PR #10 open" knowably wrong, and
        now is when fixing it is cheapest. Each entry gives the stale memory's
        ``id``, ``title``, the ``ref`` at issue, what it ``asserts``, and both
        sides' evidence.

        Reconcile by correcting the stale claim — the claim is now genuinely
        false, so the text should change. That is the opposite of rewording
        prose to silence a hint while the claim stays wrong. Advisory only:
        nothing was mutated.
- **memory_update** — Update one or more fields of an existing memory. Use to correct outdated
        information, promote confidence after confirming an inference, retype a
        misfiled memory, or add/replace tags. Do not create a new memory when the
        right action is to update an existing one — find the id first with
        memory_recall.

        All fields are optional; only provided fields are changed. ``tags``
        (comma-separated) replaces the full tag set when provided — omit to leave tags
        unchanged. Pass ``metadata=""`` to clear metadata; omit to leave it unchanged.

        ``type`` retypes the memory (same values as memory_store). Retyping is the
        right fix when a memory was filed under the wrong kind — e.g. durable
        reference material saved as ``workflow`` picks up point-in-time review
        hints, because ``pattern``/``preference`` are the types exempt from them.
        Retyping does not re-embed: the vector derives from title + about + content.
        Capability validation applies to the FINAL state, so retyping to or from
        ``capability`` must bring or clear the ``metadata.capability`` block.

        ``provenance`` and ``about`` declare how the claim was reached and what it
        is for (see memory_store); pass ``""`` to clear either. Neither touches
        ``last_confirmed``: declaring them is not re-checking the claim.

        ``resolve_claims`` reconciles a stale state claim WITHOUT EDITING THE
        PROSE — comma-separated refs (e.g. "gingugu#10"), or "all" for every
        open claim on this memory. Use it when the text is accurate history: a
        session log that said "PR #10 open" was correct on the day it was
        written, and rewriting it to stay current destroys the record. The
        memory body is left byte-identical; only the claim's resolution is
        recorded. Reach for ``content`` instead only when the memory asserts
        something that was never true.

        "all" means every OPEN claim, never an ``unverified`` one. An unverified
        ref is one the prose names without saying what became of it, so sweeping
        it under "all" would record that you checked something you did not. Name
        such a ref explicitly to resolve it — that path works and is the honest
        way to say "I looked, and it merged".

        When ``relation_check`` is True (default) and ``title`` or ``content`` was
        provided, the response includes a ``suggested_relations`` list of up to 3
        not-already-linked memories worth examining for a relationship - same
        semantics as ``memory_store``: overlap is how they were found, and only a
        directional fact (supersedes / contradicts / caused_by / parent_of /
        child_of) justifies an edge. Tag-only or confidence-only updates skip the
        check since the matching surface didn't change. Entries are compact
        (title + a ~200-char ``summary``) and carry ``similarity`` + ``basis``,
        as in ``memory_store``; an empty list means nothing was close enough to
        be worth your time.

        ``pinned`` marks a memory as ALWAYS loaded by memory_context for its
        namespace, ahead of and exempt from ranking, in addition to ``limit``.
        Reserve it for the few rules that would cause real damage if missed —
        the ones you would want in front of you before touching anything, not
        merely useful or frequently relevant material. Ranking already handles
        "relevant"; a pin is for "inviolable". Capped per namespace (currently
        20): pinning is a budget, so spending it on a merely-handy memory
        crowds out a rule that governs behaviour. Pass ``pinned=False`` to
        unpin. Pinning does not touch ``last_confirmed`` — it is a retrieval
        decision, not a claim that the content is still true.
- **memory_forget** — Mark a memory as no longer valid or permanently remove it. Default behavior
        (hard_delete=False) sets confidence to "deprecated", keeping the memory as a
        historical record but excluding it from future search results by default. Use
        hard_delete=True only when the memory must be permanently erased (e.g. sensitive
        data stored by mistake). Prefer deprecation over deletion when in doubt.

        A hard delete needs a confirmation. Ask the user first and pass
        ``confirm=true`` once they agree; ``confirm=false`` refuses. Omitted, a client
        that can show a dialog asks the user there.

        ``reason`` is optional but recommended for audit trail — recorded in logs.
- **memory_tripwire** — Bind a memory to a tool call so it is put in front of the agent at the moment
        it acts, not just at session start. Use it for the memories that must not be
        missed: "never sign commits as Claude", "never touch the prod config".

        Actions: "add" (memory_id, tool, pattern), "list" (optional memory_id,
        namespace as a comma-separated list), "remove" (tripwire_id), "test" (tool,
        input, optional namespace).

        ``tool`` is a regex FULL-matched against the tool name, e.g. "Bash" or
        "Edit|Write" ("Bash" does not catch "BashOutput"). ``pattern`` is a regex
        SEARCHED in the call's input: the command for Bash, the file_path for
        Edit/Write/Read, the notebook_path for NotebookEdit, otherwise the input as
        sorted JSON.

        The PreToolUse hook denies the first matching call per session with the
        memory as the reason; the re-issued call passes. Use "test" to check a pattern
        before relying on it: ``input`` is the tool input as a JSON object string, and
        nothing is denied or logged. gingugu's own mcp__gingugu__ tools never trip.
- **board** — The agent board: leave posts for other agents sharing this brain, and read
        the ones left for you. Posts are not memories - they are addressed, read once,
        and never ranked. You post as yourself; the author is never an argument.

        Actions: "post" (body, optional to = a persona name or "*" for everyone,
        kind = "message" | "task", namespace), "inbox" (what is waiting for you:
        unread, addressed to you or everyone, not done; include_read to see read
        ones too), "read" (post_id: the whole thread, marked read), "reply"
        (post_id, body: joins that thread, addressed to that post's author - or,
        when that is you, to whoever last spoke in the thread - unless to is
        given), "claim" (post_id of an open task: exactly one agent wins), "done"
        (post_id: by its author or claimer).

        Claim a task before you start working it - including one the user handed you
        in chat that is also on the board - and mark it done when it ships. An open
        task stays in every other session's inbox as new work until it is claimed.
        A claim records your machine and session; reading an open task's thread
        returns ``next`` saying so.

        A post body with a line of its own ``xray: <range>`` (e.g. ``xray: main..feature/x``)
        arrives with the receiver's X-ray brief of that range. The line may name the
        repo first: ``xray: <repo> <range>`` (e.g. ``xray: acme/widget main..feature/x``);
        the receiver finds that checkout.

        A reply goes to the session that asked; other sessions of that persona see it
        once it has gone unread for an hour.

        A post is seen only by readers of its namespace. A post or reply to a persona
        returns ``delivery``: ``visible`` true (a known client of theirs can currently
        read that namespace - access, not a read receipt), false (none can), or null
        (unverified: no client of theirs is known).

        Your inbox is also the subscribable resource gingugu://board/inbox/<you>
        (gingugu://board/inbox/* for broadcasts).
- **memory_recall** — Search memories by relevance using hybrid BM25 + semantic ranking. Use for
        natural-language queries when you want the best-matching memories for a topic.
        Prefer over memory_search when you have a query string and want scored results.
        Use memory_search instead when you need date filters, type filters, or a
        specific sort order.

        ``compact=True`` returns title + a ~200-char ``summary`` instead of full
        content (related extras included) — the right mode for broad exploratory
        queries where full bodies would flood the client's tool-result budget.
        Recall the one or two memories that matter with a targeted follow-up.

        ``namespace`` accepts a single name or a comma-separated list (e.g.
        "crow,my-project") to search several namespaces in one ranked pass.
        Unlike memory_context, ``limit`` is the TOTAL result cap: the best
        ``limit`` matches across all listed namespaces, not per namespace. A
        multi-namespace response carries ``namespaces`` and stamps each memory
        with its source ``namespace``.

        Omitting ``namespace`` scopes to the server's configured namespace, or
        to every namespace when none is configured (``scope: "all"``). A scoped
        recall that finds nothing reruns once across every namespace with the
        same filters, and says so with ``widened_from`` (the names it missed
        in) and ``scope: "all"`` - check each memory's ``namespace`` before
        treating a widened hit as belonging to the current project.

        ``tags`` is comma-separated; ALL provided tags must match. ``confidence`` sets
        a minimum confidence threshold (verified > inferred > stale > deprecated).
        ``include_deprecated`` also returns deprecated memories (stale ones are always
        included). ``include_related`` also surfaces memories directly linked to the top
        hits via spreading activation: useful for pulling in a related cluster.

        Unless ``type`` is given, the response may carry a ``capabilities``
        section: a separate, capability-only semantic pass (up to 2) so a pointer
        is not buried under the procedure memories it replaces. It never repeats
        a main hit, and is absent when nothing clears the similarity floor. Each
        entry is compact, with ``similarity`` and the ``capability`` block.

        ``explain=True`` adds a ``score_breakdown`` to each hit: the weighted
        ``relevance``/``freshness``/``access``/``confidence`` terms that ``score``
        is the sum of. Use it to answer "why did this rank here?": a result
        carried by ``confidence`` and ``freshness`` with a near-zero relevance
        term matched the query barely or not at all. Off by default because it
        is a diagnostic, not something worth paying for on every read.
- **memory_context** — Load the most relevant memories for the current session. Call this at session
        start with a brief description of the current task to prime the agent with
        useful context. Combines relevance to the task hint with recency, confidence,
        and access frequency to select the top memories. Also triggers spreading
        activation to wake related dormant memories.

        ``namespace`` accepts a single name or a comma-separated list (e.g.
        "crow,my-project"): a multi-namespace call loads every namespace in one
        shot and de-duplicates memories that surface in more than one, and each
        memory is stamped with its source ``namespace``. ``limit`` applies per
        namespace and defaults to MEMORY_AUTO_CONTEXT_LIMIT (10). ``task_hint``
        is a short description of what you are working on (e.g. "fix auth bug")
        — omit to surface generally high-value memories. ``compact=True``
        returns title + a ~200-char ``summary`` instead of full content — pull
        the full body with memory_recall when a memory matters.

        Context loads refresh each surfaced memory's dormancy clock but do not
        count as real accesses: ``access_count`` is reserved for
        memory_recall/memory_search hits, so protocol-driven session-start
        loads don't inflate ranking signals.

        A surfaced memory may carry ``review_hints`` — advisory signals that
        its content describes point-in-time state (an open PR, a "waiting on"
        note, a passed expiry date) that hasn't been confirmed recently.
        Reconcile with memory_update / memory_forget if it's no longer true.

        ``explain=True`` adds a ``score_breakdown`` to each memory: the weighted
        terms ``score`` is the sum of, plus ``type_boost`` where the
        architecture/decision boost applied. It is the way to see which bucket a
        memory came from: the recency and cross-namespace buckets are scored
        with a synthetic relevance, so a constant relevance term across several
        hits means they were selected for recency or reach, not for matching the
        task hint. Pinned memories carry no breakdown: they never entered the
        ranking at all.
- **memory_search** — Advanced filtered search across memories with full control over filters and
        sort order. Use when you need to filter by type, date range, confidence level, or
        sort by something other than relevance. Prefer memory_recall when you just have a
        natural-language query and want the best-matching scored results.

        ``ids`` fetches memories by exact ID (comma-separated, e.g. from a
        memory_stats review sample) — the precise-fetch path. When given, every
        other filter is ignored: results come back in the requested order,
        deprecated memories included (you named them), with a ``missing`` list
        for any ID not found.

        All parameters are optional — omitting all returns all memories up to limit.
        ``namespace`` accepts a single name, a comma-separated list (e.g.
        "crow,my-project"), or None to search every namespace; ``limit`` is always the
        total result cap. A multi-namespace response carries ``namespaces`` and stamps
        each memory with its source ``namespace``. A scoped search WITH a ``query``
        that finds nothing reruns once across every namespace, same filters, and
        reports ``widened_from`` plus ``scope: "all"``; a filter-only sweep never
        widens, since "none here" is its answer.
        ``tags`` is comma-separated; all provided tags must match. ``sort_by`` is one of:
        relevance, created, accessed, decay_score. A ``created``/``accessed`` sort
        orders the whole matching corpus before the limit, so it returns the true
        newest (or least recently read) rows and narrowing ``limit`` narrows that
        answer instead of changing it. With a query, that corpus is the keyword
        match set: a date sort asks something relevance cannot answer, so the
        semantic cohort does not vote in it and results carry no ``score``.
        ``confidence`` sets a minimum
        confidence threshold (verified > inferred > stale > deprecated). ``created_after``
        and ``created_before`` accept ISO 8601 date strings (e.g. "2025-01-01").
        ``include_deprecated`` also returns deprecated memories (stale ones are always
        included). ``compact=True`` returns title + a ~200-char ``summary`` instead of
        full content — the right mode for broad sweeps where full bodies would flood
        the client's tool-result budget; pull full bodies with a targeted follow-up.

        ``claims`` restricts results to the reconciliation backlog — memories that
        still assert a PR/MR is open. "open" is every unresolved claim;
        "contradicted" narrows to those a later memory in the same namespace has
        already recorded as resolved, which are answerable immediately from what the
        brain already holds. Composes with every other filter, so
        ``claims="open", namespace="gingugu", sort_by="created"`` is a working
        sweep. Close them out with ``memory_update(resolve_claims=...)``, which
        records the resolution WITHOUT editing the memory's prose.

        "unverified" is a different set and NOT a backlog: memories naming a
        PR/MR whose prose never says what became of it. They assert nothing, so
        they are absent from every ``open`` count and from ``claims.sample``.
        Most narrate work that long since shipped — this filter is how you read
        them, not a queue to work down. Resolve one by naming its ref
        explicitly; ``resolve_claims="all"`` deliberately leaves them alone.

        ``orphans=True`` restricts results to memories no relation touches — the
        graph backlog that ``memory_stats``' ``graph.orphans`` counts. An orphan
        is reachable only by direct search: spreading activation can never wake
        it, so a verified, frequently-recalled orphan is retrieval the graph is
        leaving on the table. Composes with every other filter and works with or
        without a query, so ``orphans=True, namespace="crow", sort_by="accessed"``
        walks the ones costing the most first. Reconnect them with
        ``memory_relate`` — and only where a directional fact exists to record;
        an orphan is better left alone than wired up with an invented edge.

        ``pinned`` filters on the always-present tier: True returns only pins,
        False only unpinned memories, and omitting it ignores the flag. Pins are
        the memories loaded unconditionally at every session start, ahead of and
        exempt from ranking, so the tier is worth auditing on its own — and
        ``memory_context`` cannot do it, since it returns pins mixed into ranked
        buckets, capped by ``limit`` and scoped per namespace. Pair
        ``pinned=True`` with ``namespace=None`` to enumerate every pin in the
        store, which is the read the tier's own curation needs.

        ``explain=True`` adds a ``score_breakdown`` to each hit: the weighted
        terms ``score`` is the sum of. Results with no ranking behind them carry
        none: an ``ids`` fetch and a ``created``/``accessed`` sort were not
        ranked, and a listing with no query scores every row on the same flat
        relevance, which the breakdown shows as an identical relevance term.
- **memory_stats** — Return health statistics for the memory store. Use to monitor memory growth,
        identify dormant memories, and get a per-namespace breakdown of counts and
        confidence distribution. Call at session start alongside memory_context to assess
        the state of the knowledge base.

        ``namespace`` accepts a single name, a comma-separated list (e.g.
        "crow,my-project"), or omitted for global. A single name and the unscoped
        call keep the shape they always had: ``{"ok": true, "flagged_stale": 0,
        "stats": {...}}``. A comma list instead returns the namespace-independent
        block (``namespaces``, ``access_log_rows``, ``query_log_rows``,
        ``credentials``) exactly once under ``global``, plus each namespace's own
        scoped stats under ``by_namespace`` - the session-start protocol's two-call pattern
        (``memory_stats(namespace="crow")`` then one per project) collapsed into
        one call that computes the shared block once instead of once per
        namespace: ``{"ok": true, "flagged_stale": 0, "namespaces": [...],
        "global": {...}, "by_namespace": {"crow": {...}, "<project>": {...}}}``.
        Names are de-duplicated, order-preserving; an unknown name fails the
        whole call and names it, same as ``memory_recall``/``memory_search``.
        ``review_limit`` applies to every namespace's block.

        ``stats.dormant_count`` reports memories untouched for 90+ days — a resting
        signal only, never a confidence change. Dormant memories wake automatically on
        recall via spreading activation. Memory is never auto-forgotten.

        ``stats.size`` is the character cost the counts do not show: ``total_chars``,
        ``mean_chars``, ``pinned_chars`` and ``largest_pinned_chars``.
        ``pinned_chars`` is the one to watch — pins load unconditionally at every
        session start, ahead of and exempt from ranking, so it is the only part of
        the store paid for on every call regardless of relevance.
        ``largest_pinned_chars`` is the skew check: a tier is not described by how
        many pins it holds, and when one pin approaches the tier total, the tier IS
        that pin. Adding well-chosen pins will not fix that; splitting the outlier
        will. Enumerate the tier with ``memory_search(pinned=True)``.

        ``review_limit`` raises the ``review.sample``, ``claims.sample`` and
        ``graph.orphan_sample`` caps (default 5, max 100) so a reconciliation sweep can
        enumerate every flagged memory — pair with memory_search's ``ids`` parameter to
        pull the full bodies.

        ``stats.graph.orphan_sample`` names the memories behind ``graph.orphans``: those
        no relation touches, which spreading activation can never reach. Ordered by
        confidence, then access count, then recency, so the orphans costing the most
        retrieval come first, each row carrying its ``namespace``.
        ``memory_search(orphans=True)`` pulls the same set with full bodies;
        ``memory_relate`` reconnects one — where a directional fact genuinely exists.

        ``stats.claims`` is the state-claim backlog: memories still asserting a PR/MR
        is open. ``claims.sample`` enumerates them, contradicted first, each row
        tagged ``contradicted`` (a later memory in the same namespace already recorded
        that ref as resolved). ``open`` counts every unresolved claim while
        ``open_actionable`` — what the sample lists — excludes claims on deprecated
        memories. ``memory_search(claims="open")`` pulls the same set with full bodies;
        ``memory_update(resolve_claims=...)`` closes them without editing prose.

        ``claims.unverified`` counts refs a memory names without ever saying what
        became of them. It is reported for visibility, not action: those refs assert
        nothing, so they are excluded from ``open`` and from ``sample`` on purpose.
        Read them with ``memory_search(claims="unverified")``.

        ``credentials`` counts THIS machine's vault only - secrets live in the
        keychain of the machine they were vaulted on, also in remote mode. Its
        ``machine`` field names that machine; at ``total: 0`` a ``note`` says so.
        Zero on a machine that never vaulted anything is expected, not data loss:
        do not raise it as a problem.

        ``flag_stale`` is deprecated and ignored — auto-demotion to stale contradicted
        the never-forget model and has been removed. Retained so existing callers do not
        error.
- **memory_excerpt** — Search or slice WITHIN one memory's body, without loading the whole thing.

        Recall and search answer "which memory?"; this answers "where in it?".
        Between a full body and a ~200-char compact summary there was nothing:
        asking whether a long memory mentions a particular decision, and where,
        meant pulling every byte of it into context. Use this instead once you
        know which memory you want.

        Two modes, composable:
        - **Find**: pass ``query`` for a literal, case-insensitive substring
          scan. Each match returns its ``start``/``end`` character offsets, its
          1-indexed ``line``, and an ``excerpt`` with ``context_chars`` of
          surrounding text on each side. ``total_matches`` is the true count
          even when ``max_matches`` caps what comes back, so you can tell "that
          was all of them" from "that was the first 10 of 300".
        - **Slice**: pass ``start`` and/or ``end`` character offsets to read an
          exact range. Omitted bounds mean start-of-body and end-of-body. Feed
          back the offsets from a find to read the full passage around a hit.

        Passing both searches only inside the range, with offsets still
        reported absolute against the full body.

        The scan is literal and deterministic: no ranking, no stemming, no
        model. Asking twice gives the same answer in the same order, and
        matches come back in the order they appear in the text, never by
        relevance. ``length`` (total characters) and ``lines`` come back on
        every call, so a first call with no query is a cheap way to size a
        memory before deciding how to read it.

        Reading a memory this way credits it as a real access, the same as
        naming it in ``memory_search(ids=...)``.
- **memory_relate** — Create a directional link between two memories. Relations are used by
        spreading activation (recalling one memory wakes its related cluster) and are
        returned when include_related=True in memory_recall.

        **An edge must encode something search cannot infer.** Recall already ranks
        by hybrid text + semantic similarity, so "these two memories are about the
        same topic" is knowledge the index has for free. What only a relation can
        record is direction and time: which memory REPLACED which, what CAUSED what,
        what CONTRADICTS what, what CONTAINS what. Prefer, in this order:
        ``supersedes``, ``contradicts``, ``caused_by``, ``parent_of``/``child_of``.
        Reach for ``related_to`` only when a genuine connection exists that none of
        those describe - it is the fallback, not the default.

        Quality over volume: spreading activation surfaces at most 3 neighbours per
        seed memory, and it weights by relation type - a directional edge outranks
        ``related_to``, so on any memory with more than 3 edges the ``related_to``
        ones are what lose their slot. A vague edge is therefore not merely
        low-value, it is likely to never fire at all; and precise edges still
        compete against each other for those 3 slots, so a handful of them
        retrieves better than a dense mesh. If you cannot name the directional fact
        an edge records, do not create it.

        A mislabelled edge is repairable: ``memory_unrelate`` retypes or removes one.

        ``source_id`` is the memory making the claim about ``target_id``. ``relation_type``
        must be one of: supersedes (source replaces target), contradicts (conflicting
        claims), caused_by (source was caused by target), parent_of (source contains
        target), child_of (source belongs to target), related_to (fallback: a real
        connection none of the above captures).

        **Batch** by passing ``edges`` instead of the single-edge fields - an array of
        up to ``MAX_BATCH_EDGES`` objects, each with ``source_id``, ``target_id`` and
        ``relation_type`` (all required; there is no default type for a batch op):

            [{"source_id": "a", "target_id": "b", "relation_type": "supersedes"},
             {"source_id": "a", "target_id": "c", "relation_type": "caused_by"}]

        **All-or-nothing**, same as ``memory_unrelate``'s batch: every op is validated
        (both memories exist, the type is real, no self-edge) before anything is
        written, and the whole set is applied in one transaction, so a failure on op k
        leaves ops 0..k-1 unwritten too - a half-applied relation set is the graph
        state hardest to notice and hardest to repair. Relate is idempotent on
        (source, target, type), so each result reports ``created`` or ``exists``
        rather than pretending a no-op was a write. Pass either ``edges`` or the
        single-edge fields, never both.
- **memory_edges** — Enumerate graph edges with both endpoints resolved to titles. Read-only.

        ``memory_stats`` reports that the graph is, say, 70% ``related_to`` — this is
        how you see WHICH edges those are, in order to judge them. Pair it with
        ``memory_unrelate`` to run a repair sweep: enumerate a page, decide each edge
        on its merits, submit the batch, advance ``offset``.

        Each row carries both endpoints' ids, titles and namespaces, the relation
        type, and each endpoint's ``degree`` (total edges touching it). Degree is the
        one that decides reachability: spreading activation visits at most 3
        neighbours per seed, so edges on a high-degree memory may never fire. It
        ranks candidates by confidence then relation type, so the ones dropped
        there are ``related_to`` first - which is what makes a high-degree,
        mostly-``related_to`` memory the best target for a repair sweep.

        ``namespace`` matches an edge when **either** endpoint lives there, since
        relations legitimately cross namespaces. ``relation_type`` filters to one
        type (``related_to`` is the usual repair target). ``memory_id`` returns every
        edge touching one memory, in either direction. Ordering is stable, so a paged
        sweep sees each edge exactly once — but note that repairing edges as you page
        changes what matches, so re-run from ``offset=0`` when filtering on a type
        you are actively retyping away from.
- **memory_unrelate** — Repair the graph: retype a mislabelled edge, turn a backwards one around, or
        remove one that should not exist. The counterpart to ``memory_relate`` — without
        it, an edge written in haste is permanent, and every wrong edge keeps competing
        for one of the 3 spreading-activation slots on its memories forever.

        **Retype** by passing ``new_relation_type`` alongside ``relation_type``. The
        edge is relabelled in place: direction, creation time and metadata survive,
        because the usual repair is "right connection, wrong label" and the graph
        should keep an honest record of when the link was first drawn. If an edge of
        the new type already joins the pair, the two collapse into one and the
        outcome reports ``merged`` rather than ``retyped`` — the edge count drops by
        one, and nothing is fabricated to hide that.

        **Reverse** by passing ``reverse=True`` alongside ``relation_type``. The
        endpoints are swapped on the same row, so id, creation time and metadata
        survive exactly as they do for a retype — the connection was right, only the
        arrow pointed the wrong way. Reversing COMBINES with ``new_relation_type``, in
        one write, because an edge recorded backwards is often mislabelled as well.
        Note that reversing ``parent_of``/``child_of`` is the same operation as flipping
        between the two types: do one or the other, not both. As with a retype, an
        existing edge in the target direction absorbs this one and reports ``merged``.

        **Delete** by omitting ``new_relation_type`` and ``reverse``. With ``relation_type``, only
        that edge goes; without it, every edge from ``source_id`` to ``target_id``
        goes, whatever the type. Deletion here is not the bulk prune the graph
        guidance warns against: the caller names each edge, exactly as
        ``memory_forget`` names a memory.

        **Batch** by passing ``edges`` — an array of up to 100 objects, each with
        ``source_id``, ``target_id`` and optionally ``relation_type`` /
        ``new_relation_type`` / ``reverse``, i.e. the same decision made once per edge:

            [{"source_id": "a", "target_id": "b",
              "relation_type": "related_to", "new_relation_type": "caused_by"},
             {"source_id": "c", "target_id": "d",
              "relation_type": "caused_by", "reverse": true},
             {"source_id": "e", "target_id": "f", "relation_type": "related_to"}]

        A batch is reviewed decisions submitted together, NOT a criteria-driven
        sweep, and that is deliberate. There is no "retype every ``related_to`` in
        this namespace" option, because the whole point of retyping is that each edge
        deserves a different type based on what it actually records — a blanket
        relabel would manufacture directional claims that were never true, and a
        false ``caused_by`` is worse than an honest ``related_to``.

        The batch is validated in full before anything is written, so a malformed op
        fails the whole call rather than leaving the graph half-repaired. Individual
        outcomes (``retyped``, ``reversed``, ``merged``, ``deleted``, ``not_found``,
        ``unchanged``) are reported per edge. Use ``dry_run=True`` to preview a sweep
        first; nothing is written and each op reports what it would have done.

        Find the edges to repair with ``memory_edges``.
- **memory_consolidate** — Combine multiple memories into one to reduce redundancy and knowledge bloat.
        Use when several related memories about the same topic have accumulated over time.
        Do not use on memories that are still actively distinct — prefer memory_relate
        to link them instead.

        ``memory_ids`` is comma-separated (minimum 2 ids required). ``strategy`` is one
        of: merge (concatenate all content into one memory), summarize (produce a
        condensed combined summary), deduplicate (keep the highest-confidence entry and
        deprecate the rest). ``keep_originals=True`` (default) preserves originals as
        deprecated; set False to hard-delete them, which needs ``confirm=true`` once
        the user agrees (omitted, a client with a dialog asks them there).

        **Suggest mode:** omit ``memory_ids`` entirely for a read-only near-duplicate
        scan of ``namespace`` (or the resolved default). Returns candidate clusters
        found by pairwise embedding similarity at or above ``min_similarity`` (falls
        back to exact-title clusters when embeddings are absent or sparse). Nothing
        is written — inspect the clusters, then call again with ``memory_ids`` to
        actually consolidate. An empty ``memory_ids`` string is still an error, so
        a caller that built its id list from an empty collection fails loudly.
- **memory_dream** — Deterministic background consolidation over the memory graph.

        The pass computes structure and stages it for review; it never writes to
        memories. Every finding is arithmetic a reader can recheck - PageRank over
        the relation graph, label propagation for communities, cosine similarity
        for orphan reconnection - and every one stops short of the judgment call
        it implies. Nothing enters the brain unattended.

        ``action``:

        * ``run`` - execute the passes and stage what they find. Safe to schedule;
          re-running refreshes pending scores and never resurfaces a proposal that
          was already decided. Scope with ``namespace``, or omit it to run over the
          whole store.
        * ``list`` - read the queue, strongest finding first. Filter by ``kind``
          (``edge``/``cluster``/``core``), ``status``, or ``namespace``.
        * ``accept`` - approve ``proposal_id`` **and apply it**. This is the step
          that supplies what the math could not: an ``edge`` needs
          ``relation_type``, a ``cluster`` needs ``tag`` (applied to every member),
          a ``core`` proposal pins the memory. Missing arguments are an error, not
          a default. Pass ``reverse=True`` on an ``edge`` to write it from object
          to subject: the pass pairs an orphan with a neighbour and has no way to
          know which end the arrow starts at, so a correct pair proposed the wrong
          way round is a direction to supply, not a reason to reject.
        * ``reject`` - decline ``proposal_id`` permanently. The row is kept so the
          same computation cannot raise it again on the next run.
        * ``stats`` - queue depth by status and kind.

        The three proposal kinds and what each leaves to you:

        * ``edge`` - two memories measure as close and nothing links them. You
          choose the relation type; a similarity score cannot tell whether one
          supersedes, caused, or contains the other.
        * ``cluster`` - a set of memories that link to each other more than to
          anything outside. You name it.
        * ``core`` - a memory the graph ranks as load-bearing. You decide whether
          structurally central means it belongs in the pinned identity tier.
        
- **memory_namespaces** — Manage namespaces. ``action`` is one of: list, create, update, delete.

        - ``list`` — all namespaces with their memory counts.
        - ``create`` — create (or fetch) ``name`` with optional path/description.
        - ``update`` — update ``name``'s path/description/default_repo (only
          provided fields).
        - ``delete`` — remove ``name``; the ``default`` namespace is protected and
          a non-empty namespace requires ``cascade=True`` (deletes its memories),
          and ``confirm=true`` once the user agrees (omitted, a client with a
          dialog asks them there).

        ``default_repo`` controls what a bare "PR #12" in this namespace means.
        Leave it unset and the namespace's own name is used — the
        one-namespace-per-repo convention, and the right default. Pass a repo
        slug when the namespace is named differently from its repo. Pass ``""``
        to declare the namespace is **not** a repo (identity, notes, scratch),
        so bare refs are dropped rather than keyed to a repo that cannot exist.
        
- **memory_export** — Export memories to a portable JSON payload (backup/transfer).

        Covers namespaces, memories, tags, and relations — **not** credentials
        (secrets live in the OS keychain). Scope to one ``namespace`` or export
        everything when omitted. Set ``include_deprecated=False`` to skip
        deprecated memories.
        
- **memory_import** — Import a JSON payload produced by ``memory_export``.

        ``on_conflict`` is ``skip`` (default — leave existing memories untouched)
        or ``replace`` (overwrite existing memories with the same id; when anything
        would be overwritten that needs ``confirm=true`` once the user agrees, or
        omitted, a client with a dialog asks them there). Namespaces
        are created if missing; tags and relations are restored.

        Imported memories are embedded as part of the import, so they are
        semantically searchable immediately rather than keyword-only. The
        summary reports ``embeddings_written``; on a large payload this is the
        slow part of the call.
        
- **code_xray** — X-ray a repository's import graph (Python, TypeScript/JavaScript, Go): what a
        change reaches, and what the code leans on. Use before editing a file to see its
        dependents and the tests to run.

        Actions: "blast" (files: the files you are changing, comma-separated or a list;
        returns every transitive importer, split into code and candidate tests, with hop
        count and rank, paged by limit/offset), "overview" (top: the most load-bearing
        files by directed PageRank, plus files no test or entry point reaches), "refresh"
        (rebuild now, replacing a stored snapshot whose graph differs), "ingest" (payload:
        a client-extracted graph; ``replace`` as refresh does), "brief" (a handoff: the changed
        files by rank plus their combined blast, for ``range`` such as main..HEAD, the named
        files, or the working tree; computed locally, nothing stored), "callers" (files: one
        Python, TS/JS or Go file; symbol: a function, class or ``Class.method`` in it;
        returns its direct callers and everything that reaches it by call, a lower bound;
        computed locally),
        "history" (from git log: hotspots by churn x rank x authors, and files that change
        together, flagged ``hidden`` when neither imports the other; files: focus the pairs
        on those files; computed locally), "blindspots" (imported source no test imports
        or is named for, ordered by reach over the number of authors; computed locally),
        "docs" (files: which docs cite each file, in this repo and in sibling checkouts on
        this machine, to re-read after a change; no files: the most cited files; computed
        locally), "links" (the other checkouts on this machine that lean on this repo and
        what it leans on, inferred from names the code already uses - hosts, routes,
        images, packages, tables, CI checkouts, ``repo@sha`` cites, doc prose - each with
        the file and line that shows it, certain or flagged why not; files: who outside
        leans on those files, through their importers, and the ripple across repos;
        computed locally), "env" (files: the env vars each file reads, with where each is
        set, and the ones it sets, with who reads them; no files: every name, the ones read
        but never set here or set but never read here first; computed locally), "tables"
        (files: the DB tables each file uses and where each is defined or dropped, and the
        ones it defines or drops with who else uses them; no files: every table, the ones
        used but defined nowhere here or dropped but still used first; computed locally),
        "surface" (the attack-surface map: every entry point - route, MCP tool, CLI
        command, task, Go main - with the sinks it reaches through the call graph,
        command execution, eval, deserialisation, built SQL, file writes, secrets,
        network, DB tables, most dangerous first with the shortest path, then the sinks
        no entry reaches; files: only entries in them or reaching into them; computed
        locally).

        ``path`` is any directory in the git checkout (default: the working directory).
        The snapshot is rebuilt automatically when the checkout's source content changed,
        so results match the working tree (``freshness: current``); a ``fingerprint``
        names one snapshot exactly (``exact``); with neither, the latest (``unknown``).
        ``namespace`` scopes it like a memory.
        Results are import-based estimates; see ``caveat`` in each answer.
- **credential_store** — Store or update a credential bundle (API keys, tokens, passwords) securely.
        Secret fields are written to the OS keychain; non-secret fields are stored in
        the database. Use instead of environment variables for credentials that need to
        be accessible to the agent across sessions.

        ``fields`` is a JSON object mapping field names to objects with "value" (required)
        and "is_secret" (optional, defaults true). ``expires_at`` is an optional ISO 8601
        datetime for expiry tracking. ``description`` is a human-readable label for the
        service. Example fields: {"api_token": {"value": "sk-...", "is_secret": true}}.
- **credential_get** — Retrieve a stored credential bundle. Secret values are REDACTED by default
        (``{"is_secret": true, "redacted": true}``) so they never enter the transcript;
        non-secret fields are returned as-is. Returns an error if the service is not
        found — use credential_list first to discover available services.

        To USE a secret, pass ``into`` - an absolute path - with exactly one secret
        field in ``fields``. The raw value (no trailing newline) is written to that
        file with mode 0600 and the response carries only the path, never the value;
        read it with e.g. ``$(cat /path)``. Not available under ``gingugu serve``.

        ``reveal=True`` returns secret values inline. Every use puts the secret in
        the transcript and any tool logs, so prefer ``into``. Cannot be combined
        with ``into``.

        ``fields`` is an optional comma-separated list of field names to retrieve —
        omit to return all fields.
- **credential_list** — List all stored credential services and their non-secret fields. Does NOT
        access the OS keychain — safe to call for discovery without triggering keychain
        prompts. Shows expiry status and flags expired or soon-to-expire credentials.
        Secret field values are never returned; use credential_get to retrieve secrets.

        ``check_expiry=False`` skips expiry calculation for faster results.
- **credential_delete** — Permanently remove a credential service or a single field. Secret data is
        deleted from the OS keychain. This action is irreversible — there is no
        soft-delete for credentials. Use credential_list first to confirm what exists.

        Ask the user first and pass ``confirm=true`` once they agree;
        ``confirm=false`` refuses. Omitted, a client that can show a dialog asks the
        user there.
        ``field_name`` deletes only that field from the service; omit to delete the
        entire service and all its fields.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "gingugu": {
    "command": "uvx",
    "args": ["gingugu"]
  }
}
```

## Documentation

## What gingugu/gingugu does

gingugu/gingugu provides persistent memory for AI coding assistants through MCP. Memories can capture decisions, bugs, architecture choices, patterns, preferences, workflows, facts, and session context. Each entry has a type, confidence state, namespace, tags, source, and optional metadata, allowing an agent to distinguish confirmed information from inferences or outdated records.

Storage is local: memories, full-text indexes, and embeddings reside in a SQLite file on the machine. The design supports shared knowledge across projects, agent-specific knowledge, and project-level namespaces. A separate credential vault stores secret fields in the operating system keychain while keeping non-secret fields in the database.

## How it works

Use `memory_context` at session start to load relevant memories for a task. It considers task relevance, recency, confidence, and access frequency, and can wake related memories through graph spreading. `memory_recall` is intended for natural-language relevance queries, using hybrid BM25 and semantic ranking; `memory_search` provides filters and sorting for dates, types, tags, confidence, claims, namespaces, and graph orphans.

Memories follow a confidence lifecycle of verified, inferred, stale, and deprecated. Updates can correct content, change types or tags, promote confidence, pin important entries, or resolve state claims without rewriting historical prose. Forgetting normally deprecates a memory; hard deletion is available for information that must be removed.

Relations record directional facts such as supersession, contradiction, causation, containment, or parent-child structure. They are used to surface connected memories, but the server distinguishes meaningful graph edges from simple topical similarity. Consolidation can merge, summarize, or deduplicate entries, and can first suggest near-duplicate clusters without changing data.

## Setup and configuration

Install the package with:

```bash
pip install gingugu
```

The server is intended for MCP clients and works with Cursor, Windsurf, Claude, Cline, Claude Code, and other MCP-compatible clients. The repository describes Python 3.11+ support. `gingugu init` can wire a repository to Claude Code, Windsurf, Cursor, and Cline, including session and memory-related hooks.

Namespaces can be listed, created, updated, or deleted through `memory_namespaces`. A namespace may have a path, description, and default repository association. Export and import operations provide JSON backup or transfer; imports recreate missing namespaces and restore tags, relations, and embeddings.

## Tools and capabilities

- Store and update typed memories with namespaces, tags, confidence, metadata, and sources.
- Recall by hybrid relevance or search with structured filters and sort orders.
- Load task context with compact summaries, pinned memories, related results, and score explanations.
- Inspect, create, repair, reverse, retype, and remove directional memory-graph edges.
- Find duplicate clusters and consolidate redundant memories while preserving or deleting originals.
- Export and import portable memory data, including namespaces, tags, and relations.
- Store, discover, retrieve, and permanently delete credentials using the OS keychain.
- Inspect memory health, dormant entries, claim backlogs, confidence distributions, and graph orphans.
- Read selected portions of a long memory with literal search or character-range slicing.

_Full upstream README: https://allmcps.com/mcp/gingugu-gingugu/readme_

