Skip to content

Add autonomous agent mode with ReAct-style iterative execution#31

Merged
joone merged 5 commits intomainfrom
copilot/transform-loz-to-autonomous-agent
Feb 16, 2026
Merged

Add autonomous agent mode with ReAct-style iterative execution#31
joone merged 5 commits intomainfrom
copilot/transform-loz-to-autonomous-agent

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 16, 2026

Transforms Loz from single-shot command execution to autonomous multi-step task completion. Agent iterates through plan → execute → feedback cycles until task complete or limits reached.

Architecture

Agent Loop (src/agent/loop.ts)

  • ReAct pattern: LLM generates action → execute → add result to context → repeat
  • Step limits (default: 20), timeout per command (30s), repeated failure detection (3x)

Protocol (src/agent/protocol.ts)

  • Strict JSON: {"action": "run"|"edit"|"done", ...}
  • Run: execute shell commands
  • Edit: apply unified diff patches
  • Done: complete with summary

Safety (src/agent/safety.ts)

  • Sandbox mode: restricts to working directory (default on)
  • Network isolation: requires --enable-network flag
  • Command validation: allowlist + denylist, blocks dangerous ops
  • Resource limits: 10KB output truncation, 30s timeouts

Context Management (src/agent/memory.ts)

  • Maintains conversation history with intelligent truncation
  • Groups actions/results by step for LLM context

CLI Usage

loz agent "Fix failing tests"
loz agent -v --max-steps 30 "Add input validation to auth"
loz agent --enable-network "Update dependencies and fix breaking changes"

Flags: --max-steps, --verbose, --sandbox, --enable-network

Example Session

$ loz agent "Fix TypeError in validateUser"

🤖 Starting agent mode...
📋 Goal: Fix TypeError in validateUser

[Step 1] Running: npm test
❌ TypeError: Cannot read property 'name' of undefined at validateUser

[Step 2] Editing: src/auth.ts
✅ Applied null check patch

[Step 3] Running: npm test  
✅ All 15 tests passing

📊 Completed in 3 steps

Testing

54 new tests covering protocol parsing, safety validation, context management, and integration. Zero security vulnerabilities (CodeQL scan clean).

Backward Compatibility

Existing commands (loz, loz "prompt", loz commit) unchanged. Agent mode is opt-in via agent subcommand.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 16, 2026 19:48
…tools

Co-authored-by: joone <1979160+joone@users.noreply.github.com>
Co-authored-by: joone <1979160+joone@users.noreply.github.com>
…lity

Co-authored-by: joone <1979160+joone@users.noreply.github.com>
Co-authored-by: joone <1979160+joone@users.noreply.github.com>
Copilot AI changed the title [WIP] Transform Loz into an autonomous CLI-based AI coding agent Add autonomous agent mode with ReAct-style iterative execution Feb 16, 2026
Copilot AI requested a review from joone February 16, 2026 19:58
@joone joone marked this pull request as ready for review February 16, 2026 20:13
@joone joone merged commit fbdaae1 into main Feb 16, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants