Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I built self‑maintaining projects for my desktop AI companion: folder attach, one work‑log line, and a session‑scoped undo

Description and use

The author built a system where the AI companion automatically detects the project from the folder, logs a single work‑log line per turn, syncs todos, and supports session‑scoped undo of its own entries.

Problem

The assistant either remembered nothing about the current project or everything globally, causing notes from one project to bleed into another.

Outcome

The companion now automatically maintains a per‑project work log and todo list, supports deterministic undo of its own actions, and avoids cross‑project contamination.

Workflow

  • Detect project by matching the current working directory against stored roots, using strict boundary checks and longest‑match rule.
  • If a project is detected, set the session prompt to that project without changing the saved active project.
  • After each turn, append one work‑log line summarizing file changes (max 400 chars, first 5 filenames).
  • Sync the session checklist: add up to 5 new todos, close matching open todos, tag all entries with source {kind:"auto‑worklog",sessionId,turnId}.
  • If the turn has no file changes or checklist movement, write nothing (no‑work).
  • Maintain a file lock to prevent interleaved writes; skip the turn if the lock is held.
  • Keep the work‑log bounded to 100 entries, dropping the oldest.
  • Provide an optional background extraction pass (PROJECT_INLINE_CONSOLIDATION=on) that reads the session journal once it reaches 400 chars and extracts decisions and todos.
  • Implement /project undo to delete all entries whose source kind starts with "auto" and matches the current session id, reopening any auto‑closed todos.
  • Report the count of undone entries.

Evidence

I work across several folders in a day — Ankita itself, a demo site, a scratch repo — and every assistant I tried either remembered nothing about the project I was in, or remembered everything globally, so notes from one project bled into another.

Source

A project is a root path plus notes, decisions, todos, and a work log, stored in src/memory/projects.mjs (ProjectStore).

Source

After each turn, maintainTurn in src/memory/project-maintenance.mjs writes what the turn did into its project.

Source

/project undo calls removeAutoEntries with the current session id, and it deletes only entries whose source kind starts with auto and matches that session.

Source

  • Record date: 2026-11-01T19:59:02.068Z