Gait session tracking

From automateyournetwork/netclaw · View interactive version

Gait session tracking is an AI agent skill from the GitHub repository automateyournetwork/netclaw. GAIT session lifecycle management - branch creation, turn recording, audit logging for every NetClaw operation. Use when starting a new NetClaw session, recording a health check or config change, pinning a pre-change baseline, or viewing the audit trail for a troubleshooting session.

How to use this skill

Skill file

GAIT Session Tracking

This skill is mandatory. Every NetClaw session MUST begin with gait_branch and end with gait_log.

How to Call the Tools

The GAIT MCP server provides the lifecycle tools below (discover tools/list for the complete installed inventory). Call them via mcp-call:

Check Repository Status

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_status '{}'

Returns current branch, uncommitted changes, and repository state.

Initialize a New GAIT Repository

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_init '{"path":"/absolute/path/to/project"}'

Creates a new GAIT repository if one does not already exist. Supply the actual absolute project path; do not run against the filesystem root. Run once during initial setup, then verify gait_status names the intended root.

Create a New Branch (SESSION START)

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_branch '{"name":"health-check-r1-2026-02-21"}'

Creating a branch does not switch to it. Call gait_checkout with the same name and verify gait_status before recording turns. Every session begins here. Use a descriptive branch name that includes the action type, target device(s), and date. Examples:

Switch to an Existing Branch

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_checkout '{"name":"health-check-r1-2026-02-21"}'

Use this to resume a previous session or switch context between parallel investigations.

Record an AI Turn (PRIMARY RECORDING TOOL)

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"User asked to check CPU on R1","assistant_text":"Ran show processes cpu sorted. CPU 5-min avg: 12%. Status: HEALTHY.","artifacts":[{"path":"show_proc_cpu_r1.txt","content":"Sanitized evidence reference; raw evidence retained locally."}]}'

Record a turn after every significant action. Each turn captures:

View Commit History (SESSION END)

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_log '{}'

Every session ends here. Display the full audit log before concluding. This provides the user with a complete record of everything that happened.

Show Commit Details

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_show '{"commit":"HEAD"}'

Inspect a specific commit to see its full content. Use HEAD, HEAD~1, or a commit hash.

Pin Important Commits

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_pin '{"commit":"HEAD","last":false,"note":"pre-change-baseline"}'

Mark critical moments in a session so they can be easily found later. Common pin labels:

Summarize and Squash Turns

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"Session summary","assistant_text":"Summarize findings, changes, verification and remaining gaps.","note":"session-summary"}'

Do not squash immutable operational audit history. Record an additive summary using gait_record_turn instead. The server exposes squashing for other use cases; its availability is not authorization to rewrite this project's audit trail.

Mandatory Session Lifecycle

Every NetClaw session follows this exact lifecycle:

1. Session Start -- Create Branch

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_branch '{"name":"ACTION-TYPE-TARGET-DATE"}'
python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_checkout '{"name":"ACTION-TYPE-TARGET-DATE"}'
python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_status '{}'

2. During Session -- Record Every Turn

After each meaningful action (show command, config change, API call, verification), record a turn:

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"WHAT_WAS_ASKED","assistant_text":"WHAT_DATA_COLLECTED_AND_WHAT_CHANGED_AND_VERIFICATION_RESULT","artifacts":[]}'

Record format guidelines:

1. What data was collected (commands run, API responses)

2. What changed (config applied, ticket created, NetBox updated)

3. Verification result (HEALTHY/WARNING/CRITICAL, pass/fail, before/after diff)

3. Session End -- Display Log

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_log '{}'

Always show the session log to the user so they have a complete record.

Recording Examples by Skill Type

Health Check Turn

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"Run full health check on R1","assistant_text":"Collected: show version, show processes cpu sorted, show processes memory sorted, show ip interface brief, show interfaces, show ntp associations, show logging. Results: CPU 12% HEALTHY, Memory 45% HEALTHY, Interfaces 4/5 up WARNING (Gi2 down), NTP synced HEALTHY, no critical log patterns. Overall: WARNING.","artifacts":[{"path":"health-report-r1.txt","content":"Sanitized evidence reference; raw evidence retained locally."}]}'

Configuration Change Turn

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"Apply ACL update to block 192.168.50.0/24 on R1 Gi1","assistant_text":"Pre-change: captured running-config. Applied: ip access-list extended BLOCK-LIST, permit/deny entries. Post-change: verified ACL in show access-lists, tested with ping from blocked subnet -- dropped as expected. Change verified successfully.","artifacts":[{"path":"pre-change-config-r1.txt","content":"Sanitized evidence reference; raw evidence retained locally."},{"path":"post-change-config-r1.txt","content":"Sanitized evidence reference; raw evidence retained locally."},{"path":"acl-diff.txt","content":"Sanitized evidence reference; raw evidence retained locally."}]}'

Troubleshooting Turn

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"Investigate OSPF adjacency failure between R1 and R3","assistant_text":"Checked show ip ospf neighbor on R1 -- R3 missing. Checked show ip ospf interface on both -- area mismatch: R1 area 0, R3 area 1 on shared link. Root cause identified: area misconfiguration on R3 Gi0/1.","artifacts":[{"path":"ospf-neighbor-r1.txt","content":"Sanitized evidence reference; raw evidence retained locally."},{"path":"ospf-interface-r1.txt","content":"Sanitized evidence reference; raw evidence retained locally."},{"path":"ospf-interface-r3.txt","content":"Sanitized evidence reference; raw evidence retained locally."}]}'

NetBox Reconciliation Turn

python3 $MCP_CALL "python3 -u $GAIT_MCP_SCRIPT" gait_record_turn '{"user_text":"Reconcile R1 interfaces against NetBox","assistant_text":"Live state: 5 interfaces discovered via show ip interface brief. NetBox state: 4 interfaces documented. Drift detected: Gi5 exists on device but missing from NetBox. Gi2 documented in NetBox but admin-down on device. Reconciliation report generated.","artifacts":[{"path":"reconcile-report-r1.json","content":"Sanitized evidence reference; raw evidence retained locally."}]}'

Integration with ALL Other Skills

GAIT session tracking is used by every other NetClaw skill for audit compliance:

When to Use

Always. Every NetClaw session. No exceptions. This is the audit backbone of the system.

Failure Behavior

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.