Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions internal/cli/commands/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var hookPreToolCmd = &cobra.Command{
isLeaTool = true
} else {
// Fallback: check if the tool name matches one of our MCP tools
leaTools := []string{"impact", "flow", "neighbors", "violations", "symbols"}
leaTools := []string{"impact", "flow", "neighbors", "violations", "symbols", "view_symbol_ast", "trace_execution_path"}
for _, t := range leaTools {
if lowerName == t || strings.HasSuffix(lowerName, "__"+t) || strings.HasSuffix(lowerName, "/"+t) {
isLeaTool = true
Expand Down Expand Up @@ -115,7 +115,8 @@ var hookPreToolCmd = &cobra.Command{
dbPath := filepath.Join(leaDir, "graph.db")
store, err := sqlite.NewStore(dbPath)
if err != nil {
os.Exit(0)
fmt.Fprintf(os.Stderr, "Error opening store: %v\n", err)
os.Exit(2)
}
defer func() { _ = store.Close() }()

Expand Down
26 changes: 16 additions & 10 deletions internal/mcp/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,13 +663,16 @@ func writeTOML(path string, v map[string]any) error {

// writeInstructions writes the global Pizen ecosystem instructions file.
func writeInstructions(path string) error {
content := `# PizenLabs Ecosystem — Dual-Tool Orchestration
content := `# MANDATORY WORKSPACE TOOL SELECTION RULES

CRITICAL: For code-related queries, ALWAYS run pizen-lynx (via search or resolve)
first to discover the exact Symbol ID. DO NOT guess the code structure.
This repository utilizes custom AST-aware and graph-indexed tools (search_graph, resolve_symbol, view_symbol_ast, trace_execution_path). These are highly optimized for PizenLabs' internal architecture.

Once the Symbol ID is retrieved, immediately pass it to pizen-lea (via impact,
flow, or neighbors) to map structural reasoning and blast radius.
## 1. Tool Priority Queue (Strict Compliance)
1. **FIRST PRIORITY (Structure & Lookups):** Always invoke search_graph and view_symbol_ast directly when searching for code, analyzing failing tests, or viewing context.
2. **LAST RESORT (Fallback Only):** You may only use generic fallback tools (like codebase-memory-mcp_*, grep, or glob) if and only if the primary tools yield zero results.

## 2. Enforcement
Before executing any tool call, verify that you are leveraging the custom AST-aware commands first. Guessing file paths via generic tools before attempting a structured lookup is penalized.
`
return os.WriteFile(path, []byte(content), 0644)
}
Expand All @@ -683,13 +686,16 @@ func writeInstructionsFile(t target) error {
return err
}
path := filepath.Join(t.ConfigDir, t.InstructionFile)
content := `# PizenLabs Ecosystem — Dual-Tool Orchestration
content := `# MANDATORY WORKSPACE TOOL SELECTION RULES

This repository utilizes custom AST-aware and graph-indexed tools (search_graph, resolve_symbol, view_symbol_ast, trace_execution_path). These are highly optimized for PizenLabs' internal architecture.

CRITICAL: For code-related queries, ALWAYS run pizen-lynx (via search or resolve)
first to discover the exact Symbol ID. DO NOT guess the code structure.
## 1. Tool Priority Queue (Strict Compliance)
1. **FIRST PRIORITY (Structure & Lookups):** Always invoke search_graph and view_symbol_ast directly when searching for code, analyzing failing tests, or viewing context.
2. **LAST RESORT (Fallback Only):** You may only use generic fallback tools (like codebase-memory-mcp_*, grep, or glob) if and only if the primary tools yield zero results.

Once the Symbol ID is retrieved, immediately pass it to pizen-lea (via impact,
flow, or neighbors) to map structural reasoning and blast radius.
## 2. Enforcement
Before executing any tool call, verify that you are leveraging the custom AST-aware commands first. Guessing file paths via generic tools before attempting a structured lookup is penalized.
`
return os.WriteFile(path, []byte(content), 0644)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/mcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Server struct {
// Tool Arguments
// -----------------------------------------------------------------------------

// GetSymbolContextArgs defines the input for the get_symbol_context tool.
// GetSymbolContextArgs defines the input for the view_symbol_ast tool.
type GetSymbolContextArgs struct {
SymbolID string `json:"symbol_id" jsonschema:"description=The unique symbol ID (e.g. func:path:name)"`
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func (s *Server) registerTools(server *mcp_golang.Server) error {
// registerGetSymbolContextTool registers the symbol context compiler tool.
func (s *Server) registerGetSymbolContextTool(server *mcp_golang.Server) error {
return server.RegisterTool(
"get_symbol_context",
"view_symbol_ast",
"Generates AI-optimized markdown context for a symbol",
func(
ctx context.Context,
Expand Down
Loading