Skip to content

fix(cmdScan): replace filepath.Glob ** with WalkDir + EM state run 11 β€” closes #52#96

Merged
jpleva91 merged 10 commits intomainfrom
fix/glob-walk-52
Apr 1, 2026
Merged

fix(cmdScan): replace filepath.Glob ** with WalkDir + EM state run 11 β€” closes #52#96
jpleva91 merged 10 commits intomainfrom
fix/glob-walk-52

Conversation

@jpleva91
Copy link
Copy Markdown
Contributor

Summary

  • Fixes cmdScan() always reporting 0 Go files β€” filepath.Glob doesn't support ** recursive patterns in Go (POSIX glob only), so the pattern internal/**/*.go matched a literal dir named ** which never exists
  • Replaces with filepath.WalkDir to recursively collect .go files under internal/
  • Adds io/fs import required by the WalkDir callback's fs.DirEntry parameter
  • Closes stale PR chore(squad): EM state update β€” run 9 (2026-03-31)Β #94 (run 9 state was already committed to master at 832cb58)

Code change

// Before (always 0 β€” ** is not supported by filepath.Glob)
goEntries, _ := filepath.Glob(filepath.Join(dir, "internal", "**", "*.go"))

// After (recursive, correct)
var goEntries []string
filepath.WalkDir(filepath.Join(dir, "internal"), func(p string, d fs.DirEntry, err error) error {
    if err == nil && !d.IsDir() && strings.HasSuffix(p, ".go") {
        goEntries = append(goEntries, p)
    }
    return nil
})

Test plan

  • go build ./cmd/shellforge/ passes
  • go test ./... β€” 25/25 pass (governance, intent, normalizer)
  • shellforge scan in the repo root now correctly reports Go file count (was 0, now non-zero)

EM state

Run 11 β€” P2 bug sweep status:

πŸ€– Generated with Claude Code

jpleva91 and others added 7 commits March 31, 2026 08:34
closes #52

- filepath.Glob does not support ** recursive patterns in Go; goEntries was
  always nil (0 files) because the pattern looked for a literal dir named "**"
- Replace with filepath.WalkDir to collect .go files recursively under internal/
- Add io/fs import required by WalkDir callback signature
- EM state run 11: closed stale PR #94, P2 bug sweep 3/3 fixes now in open PRs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Provider interface abstracts LLM backends (Ollama, Anthropic).
OllamaProvider wraps existing ollama.Chat(). Agent loop accepts
optional Provider in LoopConfig β€” nil falls back to legacy path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements llm.Provider for Anthropic Messages API using stdlib HTTP.
Handles tool_use content blocks, tool_result responses, system prompt
extraction, and token tracking. Tests use httptest mock server.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When Provider returns structured ToolCalls, handle them directly:
normalize β†’ governance β†’ execute β†’ tool_result feedback. Bypasses
text-based intent parsing. Uses []llm.Message internally when
Provider is set. Ollama/legacy path unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
shellforge agent --provider anthropic 'prompt' runs the agent loop
against the Anthropic Messages API with native tool-use. Defaults
to Ollama for backwards compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When Anthropic responds with tool_use blocks, the assistant message
in conversation history must include structured tool_use content β€”
not just plain text. Added ToolCalls field to llm.Message and
reconstruct tool_use blocks in convertMessages().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jpleva91
Copy link
Copy Markdown
Contributor Author

Updated: Anthropic API provider + native tool-use

This PR now includes the API-driven swarm architecture work:

New commits:

  • 8790a99 β€” LLM Provider interface + Ollama implementation
  • f332ef0 β€” Anthropic API provider with native tool-use (stdlib HTTP, zero deps)
  • 12abca3 β€” Wire native tool-use into agent loop
  • 9f55835 β€” --provider anthropic CLI flag
  • efa140c β€” Fix tool_use block serialization in multi-turn conversations

Verified: 13 LLM tests + 4 agent loop tests pass. Live smoke test against Haiku successful.

jpleva91 and others added 3 commits March 31, 2026 23:44
ThinkingBudget field on AnthropicProvider caps thinking tokens per
call. Prevents runaway output spend on complex tasks. CLI flag:
--thinking-budget <tokens>. Thinking content blocks silently consumed
in response parsing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Every 5 tool calls, asks the model to self-score alignment with
original task (1-10). Below 7 β†’ steering message injected. Below 5
twice β†’ task killed. Prevents agents from burning tokens on
off-task work. 8 drift tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jpleva91 jpleva91 merged commit 10261aa into main Apr 1, 2026
4 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

1 participant