Skip to content

pubwave/ai-memory-wiki

Repository files navigation

AI Memory Wiki

AI Memory Wiki is a Markdown-based project memory system for Codex, Claude Code, and Gemini CLI. It helps AI assistants recover context across coding sessions, maintain project state, record decisions, and reduce repeated explanations.

Goals

  • Keep each project memory isolated and maintainable.
  • Let AI assistants read a small set of high-value files at session start.
  • Update durable project memory after meaningful work.
  • Let Obsidian open the directory directly as a human-readable vault.
  • Require user confirmation before writing global cross-project rules.

Core Concepts

  • Source: real repositories, code, configuration, documentation, and coding sessions.
  • Wiki: the Markdown files in this directory.
  • Startup hooks: when enabled during installation, global SessionStart hooks inject the same startup context package used by /wiki-start when a session begins.

The real repository is always the highest-priority source of truth. If the wiki conflicts with code, trust the code and update the wiki during /wiki-update.

Install

After cloning or copying this repository to any directory, run:

./scripts/install-ai-memory-commands.sh

The script installs commands under:

~/.claude/commands/
~/.codex/skills/
~/.gemini/commands/

During install, the script asks for the preferred assistant response language. Use the arrow-key selector and press Enter to confirm. The default is English.

The installer also asks whether to enable automatic project context restore on tool startup. If enabled, it writes tool-specific hook scripts under ~/.ai-memory-wiki/hooks/ and configures SessionStart hooks in:

~/.claude/settings.json
~/.codex/hooks.json
~/.gemini/settings.json

The hooks use the same startup context package generated by scripts/wiki-start-context.sh and show Project context restored: [project name] when a project is resolved. Claude Code receives a stable full-context file path under ~/.ai-memory-wiki/context/ to avoid large hook-output truncation, plus a PreToolUse guard that blocks project tool use until that file is read. Codex and Gemini CLI receive the full context directly in additionalContext. If automatic restore is disabled, the installer removes AI Memory Wiki startup hooks.

After enabling startup hooks, Codex may require a one-time trust step: run /hooks, open SessionStart, and press t to trust the AI Memory Wiki hook if Review is greater than 0.

If Claude or Codex commands do not appear after install, restart the session. If Gemini CLI commands do not appear, run /commands reload.

If the AI Memory Wiki directory is moved, run ./scripts/install-ai-memory-commands.sh again from the new location to refresh paths.

Uninstall

./scripts/uninstall-ai-memory-commands.sh

Removes all installed commands, skills, custom commands, AI Memory Wiki startup hooks, and the generated startup hook script. Other tool settings are left untouched. In an interactive terminal, the script asks for confirmation before removing anything.

The uninstaller does not delete the AI Memory Wiki repository, project memory, plans, or assistant-config.md.

Commands

Claude Code:

/wiki-project-add [project]
/wiki-start [project]
/wiki-plan [project] [task]
/wiki-update [project]
/wiki-project-del [project]
/wiki-review [project]
/wiki-command-add <command-name> "<description>"

Codex (chat text or via /skills):

/wiki-project-add [project]
/wiki-start [project]
/wiki-plan [project] [task]
/wiki-update [project]
/wiki-project-del [project]
/wiki-review [project]
/wiki-command-add <command-name> "<description>"

Gemini CLI (run /commands reload if commands are not visible):

/wiki-project-add [project]
/wiki-start [project]
/wiki-plan [project] [task]
/wiki-update [project]
/wiki-project-del [project]
/wiki-review [project]
/wiki-command-add <command-name> "<description>"

Daily Workflow

Start a Session

/wiki-start

Restores project context for the current directory. If the directory has no project memory yet, the assistant will ask whether to create it with /wiki-project-add.

If automatic project context restore was enabled during installation, this context is injected at session start and /wiki-start is only needed to refresh context manually.

Plan a Task

/wiki-plan [project] [task]

Creates or updates a project-scoped task plan without editing implementation code. After /wiki-start has restored context, natural-language requests to save or update a task plan also trigger this behavior.

Update Memory

/wiki-update

Updates project memory after meaningful work: compresses the session into durable facts, refreshes ai-brief.md, active-context.md, and relevant plan files. After completing an AI coding task tied to a task plan, this runs automatically before the final response.

Add a Project

/wiki-project-add [project]
/wiki-project-add --related SharedKit,BackendAPI

Scans the current repository, creates project memory files under projects/<project>/, and registers the project in projects/index.md.

Delete Project Memory

/wiki-project-del [project]

Removes a project's memory directory and cleans up related references. If the project has relationships, the assistant shows them and asks for confirmation before deleting anything.

Review Wiki Health

/wiki-review [project]

Reviews wiki memory for stale summaries, duplicate content, contradictions, orphan pages, and oversized files.

Add a Command

/wiki-command-add <command-name> "<description>"

Adds a new AI Memory Wiki command for Claude Code, Codex, and Gemini CLI, and updates the installer.

Global Rules

global/ stores durable cross-project rules. When /wiki-update finds a candidate for a global rule, the assistant proposes the entry and waits for confirmation before writing.

Good global candidates: patterns reused across projects, long-term coding preferences, durable engineering decisions.

Obsidian Usage

The whole directory can be opened as an Obsidian vault. Recommended entry points: index.md, dashboard.md, active-context.md.

Maintenance

Periodically run /wiki-review to find stale summaries, duplicate content, contradictions, and orphan pages.

License

MIT License. See LICENSE.

About

Markdown-based AI memory wiki for Codex, Claude Code, and Gemini CLI,with project context restore, memory updates, and extensible command workflows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages