Skip to content

Commit 692fafc

Browse files
tbitcsoz-agent
andcommitted
feat: VCS state in system prompt + enhanced start command
- build_system_prompt: run git status/log at session start and include a VCS State section in the system prompt snapshot (refreshed on each new session but not during a turn - agent uses run_command for live updates). - start quick command: now runs git status, git log -5, reads AGENTS.md and LEDGER.md, summarizes in 3-4 sentences, proposes next action. Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 1734334 commit 692fafc

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

src/specsmith/agent/runner.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,36 @@ def build_system_prompt(
153153
agents_md or f"Spec version: {spec_version}. AGENTS.md not found — run specsmith audit."
154154
)
155155

156+
# Snapshot of VCS state at session start so the agent knows what’s pending
157+
vcs_section = ""
158+
try:
159+
import subprocess as _sp
160+
161+
_st = _sp.run(
162+
["git", "status", "--short"],
163+
cwd=project_dir,
164+
capture_output=True,
165+
text=True,
166+
timeout=5,
167+
)
168+
_log = _sp.run(
169+
["git", "log", "--oneline", "-5"],
170+
cwd=project_dir,
171+
capture_output=True,
172+
text=True,
173+
timeout=5,
174+
)
175+
if _st.returncode == 0:
176+
status_text = _st.stdout.strip() or "(clean — no uncommitted changes)"
177+
log_text = _log.stdout.strip() if _log.returncode == 0 else "(no commits yet)"
178+
vcs_section = (
179+
"\n## VCS State at Session Start\n"
180+
f"```\n{status_text}\n```\n"
181+
f"Recent commits:\n```\n{log_text}\n```\n"
182+
)
183+
except Exception: # noqa: BLE001
184+
pass
185+
156186
# Load tool-specific rules for this project type
157187
tool_rules_section = ""
158188
if project_type:
@@ -166,6 +196,7 @@ def build_system_prompt(
166196
pass
167197

168198
prompt = f"""SYSTEM LANGUAGE DIRECTIVE — ABSOLUTE HARD RULE — HIGHEST PRIORITY:
199+
{vcs_section}
169200
You MUST respond in English ONLY. This overrides all other instructions.
170201
Never output Thai, Chinese, Japanese, Korean, Arabic, French, German, Spanish,
171202
or ANY non-English language — not even a single character or word.
@@ -257,8 +288,12 @@ class AgentRunner:
257288
QUICK_COMMANDS = {
258289
"start": (
259290
"[RESPOND IN ENGLISH ONLY] "
260-
"Run session start protocol: sync, load AGENTS.md, read last LEDGER.md entries. "
261-
"Translate any non-English context internally if needed, but respond only in English."
291+
"Run the session start protocol in this order:\n"
292+
"1. Run: git status (report staged, modified, and untracked files)\n"
293+
"2. Run: git log --oneline -5 (report the 5 most recent commits)\n"
294+
"3. Read AGENTS.md (confirm your role and governance rules)\n"
295+
"4. Read the last 10 lines of LEDGER.md (confirm current project state)\n"
296+
"Summarize findings in 3-4 plain sentences, then propose the most logical next action."
262297
),
263298
"resume": (
264299
"[RESPOND IN ENGLISH ONLY] Resume from last LEDGER.md entry"

0 commit comments

Comments
 (0)