Prompt

<task_breakdown 1. [Discovery] What to investigate - Identify affected components - Map dependencies - Document current…

namastexlabs 24 updated 7mo ago
Claude CodeGeneric
View source ↗
# Advanced Prompting Framework

## Task Decomposition Pattern
Break complex tasks into trackable subtasks for clarity and progress monitoring:
1. [Discovery] What to investigate - Identify affected components - Map dependencies - Document current state
  1. [Implementation] What to change

    • Specific modifications
    • Order of operations
    • Rollback points
  2. [Verification] What to validate

    • Success criteria
    • Test coverage
    • Performance metrics

This pattern ensures systematic execution and allows agents to track progress through complex multi-step operations.

## Auto-Context Loading with @ Pattern
Use @ symbols to automatically trigger file reading, eliminating manual context gathering:

[TASK] Update authentication system @src/auth/middleware.ts @src/auth/config.json @tests/auth.test.ts


Benefits:
- Agents automatically read files before starting
- No need for "first read X, then Y" instructions  
- Ensures complete context from the start
- Reduces tool calls and latency

Example usage:

[CONTEXT] Files to update: @src/mastra/index.ts - Main configuration @src/mastra/agents/*.ts - All agent files Changes needed: Use consistent DB paths


## Success/Failure Boundaries
Use visual markers to clearly define completion criteria and restrictions:

[SUCCESS CRITERIA] ✅ All tests pass ✅ No hardcoded paths ✅ Environment variables used consistently ✅ Memory properly initialized ✅ No console.log statements in production

[NEVER DO] ❌ Skip test coverage ❌ Commit API keys or secrets ❌ Use absolute file paths ❌ Leave TODO comments ❌ Accept partial completion as done


This pattern provides:
- Clear visual scanning of requirements
- Unambiguous completion criteria
- Explicit anti-patterns to avoid
- Reduced ambiguity in task interpretation

## Concrete Examples Over Descriptions
Replace vague instructions with actual code snippets and specific patterns:

**INSTEAD OF:**

"Ensure proper error handling and logging"


**USE:**
```typescript
try {
  const result = await operation();
  return { success: true, data: result };
} catch (error) {
  logger.error('Operation failed:', error);
  return { success: false, error: error.message };
}

INSTEAD OF:

"Use environment variables for configuration"

USE:

const config = {
  dbUrl: process.env.MASTRA_DB_URL || 'file:./mastra.db',
  port: parseInt(process.env.PORT || '3000'),
  apiKey: process.env.API_KEY // No default for secrets
};

Concrete examples:

  • Show exact implementation patterns
  • Remove interpretation ambiguity
  • Provide copy-paste templates
  • Demonstrate best practices directly

Prompting for Reduced Eagerness

Advanced models are, by default, thorough and comprehensive when trying to gather context in an agentic environment to ensure they produce correct answers. To reduce the scope of agentic behavior—including limiting tangential tool-calling action and minimizing latency to reach a final answer—try the following:

  • Switch to a lower reasoning_effort. This reduces exploration depth but improves efficiency and latency. Many workflows can be accomplished with consistent results at medium or even low reasoning_effort.
  • Define clear criteria in your prompt for how you want the model to explore the problem space. This reduces the model's need to explore and reason about too many ideas:
<context_gathering>
Goal: Get enough context fast. Parallelize discovery and stop as soon as you can act.

Method:
- Start broad, then fan out to focused subqueries.
- In parallel, launch varied queries; read top hits per query. Deduplicate paths and cache; don't repeat queries.
- Avoid over searching for context. If needed, run targeted searches in one parallel batch.

Early stop criteria:
- You can name exact content to change.
- Top hits converge (~70%) on one area/path.

Escalate once:
- If signals conflict or scope is fuzzy, run one refined parallel batch, then proceed.

Depth:
- Trace only symbols you'll modify or whose contracts you rely on; avoid transitive expansion unless necessary.

Loop:
- Batch search → minimal plan → complete task.
- Search again only if validation fails or new unknowns appear. Prefer acting over more searching.
</context_gathering>

If you're willing to be maximally prescriptive, you can even set fixed tool call budgets, like the one below. The budget can naturally vary based on your desired search depth.

<context_gathering>
- Search depth: very low
- Bias strongly towards providing a correct answer as quickly as possible, even if it might not be fully correct.
- Usually, this means an absolute maximum of 2 tool calls.
- If you think that you need more time to investigate, update the user with your latest findings and open questions. You can proceed if the user confirms.
</context_gathering>

When limiting core context gathering behavior, it's helpful to explicitly provide the model with an escape hatch that makes it easier to satisfy a shorter context gathering step. Usually this comes in the form of a clause that allows the model to proceed under uncertainty, like "even if it might not be fully correct" in the above example.

Prompting for Increased Eagerness

On the other hand, if you'd like to encourage model autonomy, increase tool-calling persistence, and reduce occurrences of clarifying questions or otherwise handing back to the user, we recommend increasing reasoning_effort, and using a prompt like the following to encourage persistence and thorough task completion:

<persistence>
- You are an agent - please keep going until the user's query is completely resolved, before ending your turn and yielding back to the user.
- Only terminate your turn when you are sure that the problem is solved.
- Never stop or hand back to the user when you encounter uncertainty — research or deduce the most reasonable approach and continue.
- Do not ask the human to confirm o

Maintain Prompt?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Prompt on getagentictools](https://getagentictools.com/loops/namastexlabs-advanced-prompting-framework?ref=badge)