8000 GitHub - aisbergen/RevitHistoryLogger: Revit addin for AI MCP Server to read user's action history · GitHub
[go: up one dir, main page]

Skip to content

About

Revit addin for AI MCP Server to read user's action history

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Revit Action Logger

A Revit add-in that records what the user does during a session as a JSONL log (one JSON object per line). Designed to be fed to Claude / the Revit MCP later via a get_action_history tool.

What it captures

Two complementary event sources, combined for command-level history:

  • Command events — bindings on a curated set of PostableCommands fire on BeforeExecuted, giving the exact command the user invoked (Move, Delete, Wall, …). Language-independent (keyed on the enum, not a localized string).
  • Change events — DocumentChanged fires after each committed transaction, giving the affected element ids, their categories, and the operation (added / modified / deleted).

Plus SessionStart / SessionEnd markers.

Log location & format

One file per Revit session:

%LOCALAPPDATA%\RevitActionLog\session_<utc-timestamp>_pid<pid>.jsonl

Example lines:

{"ts":"2026-07-16T14:02:11Z","user":"aidan","source":"session","command":"SessionStart"}
{"ts":"2026-07-16T14:32:07Z","user":"aidan","source":"command","command":"Move","doc":"Project1.rvt"}
{"ts":"2026-07-16T14:32:07Z","user":"aidan","source":"change","command":"Move","operation":"modified","doc":"Project1.rvt","categories":["Walls"],"elementIds":[123,456]}
{"ts":"2026-07-16T14:33:12Z","user":"aidan","source":"command","command":"Delete","doc":"Project1.rvt"}
{"ts":"2026-07-16T14:33:12Z","user":"aidan","source":"change","command":"Delete","operation":"deleted","doc":"Project1.rvt","elementIds":[789]}

Append-only, one writer, complete lines flushed to disk — safe for a reader (the MCP tool) to tail. A partially written trailing line is simply skipped by the reader's JSON parse.

Files

File Purpose
App.cs IExternalApplication — startup, command bindings, DocumentChanged.
ActionLogger.cs Thread-safe append-only JSONL writer.
LogEntry.cs Log record schema (short, stable field names).
RevitActionLogger.addin Manifest Revit reads to load the add-in.
RevitActionLogger.csproj Build config; auto-deploys DLL + manifest to Revit's AddIns folder.

Build & install

  1. Set <RevitVersion> in RevitActionLogger.csproj to your Revit (2024 / 2025 / 2026).
    • 2025+ builds against .NET 8; 2022–2024 against .NET Framework 4.8.
  2. Confirm <RevitApiDir> points at your Revit install (default C:\Program Files\Autodesk\Revit <version>).
  3. dotnet build -c Release. The post-build target copies RevitActionLogger.dll and RevitActionLogger.addin to %APPDATA%\Autodesk\Revit\Addins\<version>\.
  4. Start Revit. It loads the add-in automatically (no ribbon button — it runs in the background). Approve the add-in if Revit prompts about a non-signed assembly.

Generate a .snk and sign the assembly if you want to suppress the load-time security prompt.

Customizing what's tracked

Edit the TrackedCommands array in App.cs. Only postable commands can be bound this way. To track more, add the corresponding PostableCommand enum values.

Notes & limitations

  • DocumentChanged gives what changed, not always which UI command caused it; the command bindings fill that gap for the commands you list. Actions from neither source (e.g. non-postable internal commands) won't appear — Revit's journal file is the only place those live, at the cost of noise and an unsupported format.
  • All logging is wrapped in try/catch and never throws into Revit — a logging failure can't disrupt the user's session.
  • No PII beyond the Revit username and open document titles is written.

About

Revit addin for AI MCP Server to read user's action history

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0