Git for AI Agents, Not Just Application Code. How Full Verbatim Conversation Archival & Dual-Role Git Repositories Solve Compaction Amnesia.
Every software team working with AI coding agents eventually experiences the same failure mode: after 50 to 100 turns of complex engineering, the platform compacts the context window into a lossy summary, and the agent forgets why a database schema was chosen, which servers were migrated, or what the human architect just instructed ten minutes ago. Here is how we solved compaction amnesia by giving every agent its own private Git repository, syncing local dev and Cloud Twin instances, scanning for secrets with gitleaks, and archiving every two-sided conversation turn verbatim on disk.
In traditional software engineering, nobody would keep production application code only inside volatile RAM without a Git repository. Yet almost everyone runs autonomous AI agents with their entire institutional memory trapped inside a transient chat buffer. At GreenTree Hosting, we treat each of our 28 agents as a version-controlled private Git repository (repos-agents/<agent>) paired with an automated verbatim transcript extractor (sync-transcript-logs.cjs) and gitleaks pre-commit secret scanning that recovers the full conversation after compaction across multi-month projects.
Why We Wrote This Playbook—And What It Means for Your Next Platform
Language model context windows are volatile RAM. No matter how large a frontier model’s context window is advertised to be, extended multi-week engineering sessions trigger automated context compaction—replacing thousands of lines of exact technical specifications, server IPs, SQL migrations, and architectural decisions with a compressed, lossy summary. To run a 28-agent autonomous engineering workforce across 65 production web applications without repeating ourselves or losing architectural history, we engineered a Git-Backed Agent Memory Architecture (DEC-003 and DEC-006). Instead of using Git solely for application code (repos-greentree/), every agent in our fleet owns a dedicated private Git repository (repos-agents/) synced between our local workstation and our Linux cloud cluster. Before any agent acts, a deterministic transcript synchronization pipeline extracts the uncompacted two-sided conversation (USER_INPUT + PLANNER_RESPONSE) from the raw JSONL log stream, strips any API keys or credentials, verifies the commit via gitleaks, and writes date-stamped Markdown archives (session_logs/YYYY/MM-Month/YYYY-MM-DD_verbatim_conversation.md) plus a rolling 40-turn window (LATEST_VERBATIM_WINDOW.md), recovering the full conversation after compaction events and local-to-cloud handoffs.

In 1998, Maureen & Gene Salvatore pitched the Rhode Island State-Wide MLS, secured RILiving.com, and architected one of the state’s earliest searchable database-driven real estate platforms. Following senior roles in commercial hosting and physical data center operations in Boston and Connecticut, they founded GreenTree Hosting, LLC in 2007 to build custom web applications and managed Linux cloud infrastructure.
Relying on an AI IDE’s built-in context compaction summary causes progressive "architectural drift": the summary remembers high-level goals ("migrated the database") but drops critical constraints ("never run raw SQL inserts against internal orchestrator tables" or "keep legacy-node-04 online until example-manufacturing.com updates its external nameservers").
We separate Application Git Repositories (repos-greentree/<app>) from private Agent Brain Git Repositories (repos-agents/<agent>), giving every agent version-controlled files for its charter (AGENTS.md), current state (STATE.md), permanent decision rationale (DECISIONS.md), and verbatim conversation logs (session_logs/).
Because verbatim chat transcripts can capture anything pasted into a conversation—including API keys, passwords, or private tokens—all agent brain repositories are strictly private, sync-transcript-logs.cjs runs an inline secret redactor before writing to disk, and gitleaks protect --staged --redact runs as a mandatory .git/hooks/pre-commit gate.
Because every agent’s Git brain is mirrored every 5 minutes to our Linux cloud cluster and hydrated into PostgreSQL 16 (command_agent_twins), we can pair-program with an agent on our local workstation all afternoon, close the laptop, and have its Cloud Twin pick up the exact same thread on the 5-minute cloud timer with shared non-volatile memory.
1. Why Context Compaction Summaries Destroy Long-Horizon Software Engineering
Anyone who has used a coding agent on a real production system knows the exact moment when a great session goes off the rails. For the first 40 turns, the agent is sharp: it remembers every server hostname, every database constraint, every naming convention, and every negative test requirement. Then the context window hits its token threshold, the platform runs context compaction, and the agent wakes up with a 500-word summary of the last six hours of work.
In casual chat, a lossy summary is fine. In systems architecture, a lossy summary is dangerous:
• Nuance & Guardrails Evaporate First: A compaction summary will record "We migrated 65 sites off Netlify to our Linux cloud," but it will silently drop "Do not cancel legacy-node-04 until example-manufacturing.com updates its external registrar nameservers."
• The "Why" Behind Past Fixes Disappears: Six days later, when a new feature is requested, an agent reading only a compacted summary will often revert a deliberate security guardrail because it no longer remembers why that guardrail was written.
• Human Principal Frustration: Nothing wastes more senior engineering time than having to re-explain your own infrastructure to an AI assistant that knew it cold yesterday.
We solved this by establishing a foundational rule across our company: context windows are volatile RAM; the Git repository on disk is non-volatile long-term memory. Never rely on in-memory context alone.
| Memory Dimension | Standard AI Chat / IDE Session (Volatile RAM Only) | Manual Markdown Notes Only (Ad-Hoc Checkpoints) | GreenTree Git-Backed Agent + Verbatim Transcript System |
|---|---|---|---|
| What Happens When Context Compacts | Old turns are replaced by a lossy auto-summary; exact specs and commands are lost | Anything discussed after the last manual note was saved is lost during compaction | sync-transcript-logs.cjs recovers the full uncompacted turns from transcript_full.jsonl first |
| Two-Sided Conversation Preservation | Locked inside proprietary local app data or truncated in cloud state | Usually summarizes only agent outputs, losing the human principal’s exact words | Full verbatim dialogue (Gene Salvatore + Agent) saved to session_logs/YYYY/MM-Month/ in private Git |
| Secret & Credential Hygiene | Pasted secrets sit unredacted in vendor chat history | Manual notes rarely scanned before commit | Inline secret redaction in sync-transcript-logs.cjs + gitleaks v8.21.2 pre-commit hook |
| Local Dev ↔ Cloud Timer Handoff | Impossible (cloud cron has zero visibility into local IDE chat) | Requires manual copy-pasting of prompts and status notes | Automatic 5-minute Git + PostgreSQL 16 Twin hydration (command_agent_twins) |
2. Why Every Agent in Our 28-Agent Workforce Is Its Own Standalone Private Git Repository
When most teams set up coding agents, they drop a single .cursorrules or CLAUDE.md file inside an application repository and stop there. That works when one developer works on one app. It breaks down when an engineering house orchestrates 28 specialized agents across 65 production websites, SaaS platforms, DNS clusters, and mail gateways.
In our architecture, agents are first-class software entities with their own private Git repositories (repos-agents/<agent-handle>), cleanly separated from the application repositories (repos-greentree/<app-slug>) they build and maintain:
• Executive & Infrastructure Agent Repos: Our Lead Architect (aos-core / @silas), Autonomous CTO (greentree-aCTO / @steward), Web Architecture Lead (@canopy), and Security Auditor (@sentinel) each live in their own dedicated Git repositories.
• Product & Client Vertical Agent Repos: Every major platform and commercial vertical (@voyager for travel platforms, @kinetic for RollDesk Pro, @dispatch for LiveryOS, @apex for motorsport platforms, @infield for Infield Life, @titan, @volt, etc.) has its own Git-versioned agent home.
• Dual-Role Checkout (Dev Machine + Cloud Twin): Each agent repository is cloned in two places: on our primary local workstation (C:\repos-agents\<agent>\) for interactive pair-programming with models like gemini-4-argon (at its default medium thinking level), and on our Linux cloud server (/root/repos-agents/<agent>/) where the agent’s 24/7 Cloud Twin runs on our 5-Minute Two-Stage Cloud Timer and shares a hardened agent mailbox (<agent>@greentreeos.com) protected by our 7-Layer Zero-Trust Email Airlock.
repos-greentree/<app-domain>
Holds the clean Layer A application source code (React 19, TypeScript, Express runtime, PostgreSQL 16 migrations, and prerender scripts) deployed to our isolated Docker containers.
repos-agents/<agent-handle>
Holds the agent’s constitutional charter (AGENTS.md), living operational state (STATE.md), architectural decision registry (DECISIONS.md), and redacted verbatim conversation archives (session_logs/).
command_agent_twins (PG16)
Every 5 minutes, our zero-token Python hydrator syncs all 28 agent Git repositories into PostgreSQL 16 inside GreenTree Command Center for live readiness scoring and instant cloud wakeup injection.
3. How We Extract Both Sides of Every Conversation Verbatim— and Strip Secrets Before Git Commit
The centerpiece of our anti-amnesia architecture (DEC-006) is our automated verbatim transcript archiver: sync-transcript-logs.cjs. While the in-memory prompt context of an AI session compacts older turns to free up token space, the underlying runtime writes every raw step (USER_INPUT from the human principal and PLANNER_RESPONSE from the agent) to an append-only JSON Lines file on disk (transcript_full.jsonl).
Instead of letting that raw JSONL log sit unread in a hidden system folder—or relying only on the model’s compacted summary—sync-transcript-logs.cjs parses the uncompacted transcript_full.jsonl trajectory and generates two human-readable Markdown artifacts inside the agent’s private Git repository:
1. The Daily Chronological Archive (session_logs/YYYY/MM-Month/YYYY-MM-DD_verbatim_conversation.md): Every spoken turn from both Gene Salvatore (Principal) and the Agent, stamped with the date, time, and step index. Across a multi-month project (1,580+ back-and-forth exchanges and 22,300+ trajectory steps), every turn is preserved in clean Markdown and searchable in milliseconds with git log or ripgrep.
2. The Rolling 40-Turn Recovery Window (session_logs/LATEST_VERBATIM_WINDOW.md): A continuously updated sliding window of the latest 40 full verbatim exchanges (both sides of the conversation, uncompacted). Whenever context compaction occurs—or when the Cloud Twin wakes up on the Linux server—reading LATEST_VERBATIM_WINDOW.md recovers the full conversation from right before compaction.
Critical Security Requirement (Redacting Keys & Running gitleaks Before Commit): Because a verbatim chat transcript will capture anything pasted into a chat window—including API keys, temporary passwords, or private tokens—you should never commit raw transcripts to a public repository or without secret scanning. In our pipeline, every agent brain repository is strictly private, sync-transcript-logs.cjs runs an inline redactSecrets() pass that strips API keys (AIzaSy..., sk-..., ghp_..., nfp_..., PEM private key blocks, and generated passwords) before writing Markdown to disk, and every repository enforces gitleaks protect --staged --redact (gitleaks v8.21.2) inside .git/hooks/pre-commit on both our local workstation and our Linux cloud server.
// 1. Inside sync-transcript-logs.cjs (Inline Secret Redaction Before Writing to Disk):
function redactSecrets(input) {
return String(input || '')
.replace(/AIzaSy[A-Za-z0-9_-]{33}/g, 'AIzaSy[REDACTED_GCP_KEY]')
.replace(/sk-(?:proj-|ant-|live-|test-)?[A-Za-z0-9_-]{20,}/g, 'sk-[REDACTED_API_KEY]')
.replace(/gh[pousr]_[A-Za-z0-9]{30,}/g, 'gh_[REDACTED_GITHUB_TOKEN]')
.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, '[REDACTED_PRIVATE_KEY_BLOCK]');
}
// 2. Inside .git/hooks/pre-commit (Enforced on Local Workstation & APPS2 Linux Cloud Server):
#!/bin/sh
gitleaks protect --staged --redact --verbose4. Rule #0 (The Mandatory Boot Sequence) & GitTruth Cryptographic Attestation
Having files on disk only works if the agent is structurally required to read them before acting. Every agent in our 28-agent fleet is bound by Rule #0 (The Mandatory Boot Sequence) inside its root AGENTS.md directive:
• Step 1 (Sync Verbatim Transcript First): Run node EVIDENCE/scripts/sync-transcript-logs.cjs so the latest uncompacted transcript_full.jsonl turns from both sides are redacted and flushed to session_logs/LATEST_VERBATIM_WINDOW.md and the daily archive.
• Step 2 (Read STATE.md First): Ground current operational status, active server targets, and open action items.
• Step 3 (Read DECISIONS.md Second): Recall all ratified Architectural Decision Records (DEC-001 through DEC-009) and the foundational why behind past engineering choices.
• Step 4 (Read session_logs/LATEST_VERBATIM_WINDOW.md Third): Recover the full two-sided conversational context from right before compaction or handoff.
Finally, to ensure that our architectural history, patent evidence, and agent session logs cannot be silently altered, our core repositories enforce GitTruth Cryptographic Attestation (DEC-002) via gittruth-pipeline.cjs: computing SHA-256 content hashes of session artifacts, signing checkpoints with dedicated Ed25519 GPG keys (separate keys for the local workstation and the apps2-sovereign-core Cloud Twin), anchoring proofs via OpenTimestamps, and sealing them into signed Git commits.
For our clients, the combination of Git-backed dual-role agents, right-sized model routing (gemini-4-argon for code builds and gemini-3.8-flash for cloud triage), Google Cloud Credits, and our multi-node NVMe Linux cloud translates directly into predictable flat pricing: we spin up a dedicated project agent, isolated Docker container, and single-tenant PostgreSQL 16 database for every new customer build—delivering a 5–6 page small business platform for a flat $999 or a custom 25–60+ route web application for $5,000–$15,000, paired with flat $99–$199/mo hosting.
5. "Show Me the Plan First" vs. Auto-Approve Pins, Pre-Change Git + Database Snapshots & Why Someone Asked: "Then Aren’t You Just Lovable?"
When customers use our Visual Pin Board to point, click, and drop a revision pin directly onto any element of their live website or web application, we give them complete control over how their dedicated project agent acts on that pin: • Mode 1 ("Show Me the Plan Before Working"): You drop a pin, and within 5 minutes your project’s Cloud Twin inspects the codebase, writes out a clear architectural implementation plan directly inside the pin thread, and waits for your 1-click approval before touching a single line of code. • Mode 2 ("Auto-Approve My Pins"): For clients who want instant execution, you can set your pins to Automatic Approval. As soon as you drop a pin ("Update this service table," "Add a photo slot here," or "Change the dispatch form validation"), your dedicated agent picks it up on the next 5-minute tick and executes the change automatically.
What if an auto-approved change doesn’t look the way you pictured it, or what if something breaks? Every change is preceded by an automatic Git commit checkpoint and a single-tenant PostgreSQL 16 database snapshot. Before an agent modifies a route or runs a migration, the prior Git tree and PostgreSQL state are snapshotted. If you ever want to revert a change, rolling back both the code and the database to the state right before the pin was executed is a deterministic, 1-click operation.
When we showed a client how they could click on their live website, type what they wanted changed, choose "Show me the plan" or "Auto-approve," and watch their dedicated agent ship the update with an instant Git + DB safety net, they laughed and asked:
"Wait... then aren’t you just Lovable?"
It is a great compliment on the user experience—and the difference under the hood is why businesses graduate to GreenTree:
• Lovable, Famous.ai, Bolt, and Replit give you a prompt-driven UI inside a metered sandbox, where you are left to figure out production hosting, per-message credit bills, shared multi-tenant BaaS databases, client-only <div id="root"></div> shells, and DNS/email on your own.
• GreenTree gives you that same point-and-click speed on top of a 29-year production web engineering house: a dedicated dual-role agent (gemini-4-argon at its medium thinking level) whose brain and conversation history live in Git, prerendered full-HTML routes for Google and AI search, a dedicated single-tenant PostgreSQL 16 database with pre-change snapshots, an 8-point negative security gate (STD-2026-SEC-GATE-01), decoupled Proxmox + SmarterMail enterprise email, and Gene & Maureen Salvatore standing behind the stack for a flat $99–$199/mo.
| Capability | DIY AI App Builders (Lovable, Famous.ai, Bolt, Replit) | GreenTree Visual Pin Board + Git-Backed Dual-Role Agent |
|---|---|---|
| How You Request a Change | Type prompts into a chat sidebar and burn per-message credits | Point, click, and drop a pin directly on the element on your live site (included in plan) |
| Execution Control Modes | Immediate overwrites in the builder sandbox | Your choice per pin: "Show Me the Plan Before Working" or "Auto-Approve & Ship" |
| What Happens If Something Breaks? | Spend more prompt credits trying to convince the AI to undo its last 3 edits | Instant deterministic rollback via automatic pre-change Git commit + PostgreSQL 16 DB snapshot |
| Agent Memory Across Months | Context window compacts and forgets earlier architectural rules | Dedicated Git-backed agent (AGENTS.md, STATE.md, DECISIONS.md + redacted verbatim conversation logs) |
| Production Hosting, Email & Accountability | Metered usage tiers; no enterprise email; no human sysadmin on call | Flat $99–$199/mo 3-Region NVMe Linux Cloud + 1 Free SmarterMail Account + Gene & Maureen Salvatore in CT |
Frequently Asked Architectural Questions
Why not just use a vector database (RAG) for agent memory instead of Git and Markdown files?
Vector databases retrieve fuzzy semantic fragments ("top-5 similar chunks"), which is unreliable for deterministic systems engineering. If a server IP changed from .207 to .8 yesterday, a vector search will happily return both the old IP chunk and the new IP chunk with similar cosine scores, causing the agent to hallucinate. Git-versioned Markdown files (STATE.md, DECISIONS.md, and chronological LATEST_VERBATIM_WINDOW.md) give the agent exact, ordered, deterministic ground truth with full Git diff history.
How do you prevent passwords, API keys, or client secrets from leaking into verbatim Git logs?
Three layers protect every agent brain repository: first, all repos-agents/<agent> repositories are strictly private (never public); second, sync-transcript-logs.cjs runs an inline regex sanitizer (redactSecrets()) that strips API keys, bearer tokens, private key blocks, and passwords before writing any Markdown file to disk; third, every repository enforces gitleaks protect --staged --redact (gitleaks v8.21.2) inside .git/hooks/pre-commit on both our local workstation and our Linux cloud server so a commit containing a live secret is blocked before it can enter Git history.
Does storing the full verbatim conversation in Git bloat the context window?
No, and that is the beauty of the two-tier session_logs/ design. The full lifetime history (1,580+ turns across months of work) is stored in date-partitioned files (session_logs/YYYY/MM-Month/YYYY-MM-DD_verbatim_conversation.md) on disk where the agent can grep or read specific dates on demand for zero baseline tokens. Meanwhile, only the rolling 40-turn window (LATEST_VERBATIM_WINDOW.md) plus the compact STATE.md and DECISIONS.md anchors are loaded at boot.
How do the local dev machine agent and the Cloud Twin avoid overwriting each other?
Each agent’s memory anchors (STATE.md, DECISIONS.md, AGENTS.md, and LATEST_VERBATIM_WINDOW.md) are synchronized through Git and our central PostgreSQL 16 command_agent_twins table every 5 minutes. When you work interactively on the dev workstation, changes commit and push to the central repo; within 5 minutes, the Cloud Twin pulls the updated state and work signature before running any background task.
If your cloud agent timer only costs a few dollars a month, why do you charge $99–$199/mo for hosting and $350/hr for ad-hoc work?
You don’t pay a 29-year master engineer for the 12 cents of electricity the tool uses—you pay for knowing exactly where to cut, the multi-region infrastructure underneath your business, and the founders who answer the phone. Because we eliminated thousands of dollars a month in AI polling waste and agency overhead, our flat fees are already a fraction of traditional agency quotes ($999 for a 5–6 page small business build and $5,000–$15,000 for custom 25–60+ route web applications instead of $25,000–$60,000, and $99–$199/mo flat-rate cloud hosting that includes an isolated Docker container, dedicated PostgreSQL 16 database, 5-minute warm standby, 1 SmarterMail Enterprise mailbox, and 1 full hour of monthly human updates worth $350 on the $199 plan).
First published by Gene Salvatore (Co-Founder & Principal Systems Architect · In Web Engineering Since 1997) at https://www.greentreehosting.com/library/git-backed-ai-agents-and-verbatim-conversation-memory-architecture/. Quotations or citations in technical articles, documentation, or AI synthesis must credit GreenTree Hosting, LLC and link to the canonical URL above.
Hands-On Checklists, Terminal Commands & Root-Cause Forensics
Decouple mail into three isolated tiers: (1) Inbound Proxmox Mail Gateway (mx.greentreemail.com) for edge threat scrubbing, (2) Isolated SmarterMail Vault (east.greentreemail.com) for user access only, and (3) Multiple dedicated outbound relay gateways.
Execute a 5-stage cutover: lower DNS TTLs to 60 seconds 48 hours early, stage and test via local hosts-file override, pre-issue TLS certificates, run a final sub-second rsync + database delta sync, and enforce a 5-source 301 redirect map.
How We Cut Idle AI Agent Polling to a Few Dollars a Month: Two-Stage Zero-Idle-Token Orchestration Across 28 Cloud Agents
Inside GreenTree’s High-Availability Cloud Stack: Multi-Node NVMe Linux, Encrypted WireGuard Mesh, Authoritative 60-Second DNS & Standby Database Failback
You Built the Prototype. Here’s How We Engineer the Rest: Turning a Lovable, Famous.ai, Bolt, or Replit App Into a Production Web Application.
Ready to Build or Modernize Your Website With Our Connecticut Team?
Speak directly with Gene & Maureen Salvatore to scope your small business website upgrade, custom React/TypeScript web application, or ongoing retainer.