Claude
Skills
Sign in
Back

agentic-ai-prompt-research

Included with Lifetime
$97 forever

```markdown

AI Agents

What this skill does

```markdown
---
name: agentic-ai-prompt-research
description: Research patterns and reconstructed architectures for agentic AI coding assistants, including system prompts, agent coordination, security classification, and memory hierarchies.
triggers:
  - "how do agentic coding assistants work"
  - "show me Claude Code prompt architecture"
  - "help me understand multi-agent coordination patterns"
  - "how does auto-approval security classification work"
  - "explain agent memory hierarchy"
  - "how do I build my own agentic coding tool"
  - "what patterns do production AI agents use"
  - "help me design a multi-agent system prompt"
---

# Agentic AI Prompt Research

> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.

A research repository documenting reconstructed prompt architectures, agent coordination patterns, and security mechanisms behind tools like Claude Code. All content is behavioral observation and approximation — not verbatim proprietary content.

---

## What This Project Covers

This repository catalogs **30+ documented prompt patterns** organized into categories:

| Category | Examples |
|---|---|
| Core Identity | Main system prompt, simple mode, default agent prompt |
| Orchestration | Coordinator prompt, teammate addendum |
| Specialized Agents | Verification, exploration, creation architect |
| Security & Permissions | Permission explainer, auto-mode classifier |
| Context Management | Compact service, away summary |
| Memory & Skills | Memory instruction, skill patterns, remember skill |
| Utility Patterns | Session search, tool use summary, prompt suggestion |

---

## Repository Structure

```
prompts/
  01_main_system_prompt.md       # Dynamic prompt assembly pipeline
  02_simple_mode.md              # Lightweight minimal variant
  03_default_agent_prompt.md     # Base instructions for all sub-agents
  04_cyber_risk_instruction.md   # Security boundary classification
  05_coordinator_system_prompt.md
  06_teammate_prompt_addendum.md
  07_verification_agent.md
  08_explore_agent.md
  09_agent_creation_architect.md
  10_statusline_setup_agent.md
  11_permission_explainer.md
  12_yolo_auto_mode_classifier.md
  13_tool_prompts.md
  14_tool_use_summary.md
  15_session_search.md
  16_memory_selection.md
  17_auto_mode_critique.md
  18_proactive_mode.md
  19_simplify_skill.md
  20_session_title.md
  21_compact_service.md
  22_away_summary.md
  23_chrome_browser_automation.md
  24_memory_instruction.md
  25_skillify.md
  26_stuck_skill.md
  27_remember_skill.md
  28_update_config_skill.md
  29_agent_summary.md
  30_prompt_suggestion.md
```

---

## Key Architectural Patterns

### 1. Dynamic Prompt Assembly Pipeline

The core insight: production agentic prompts are **not static strings** — they are assembled at runtime from modular sections with a cache boundary separating stable and dynamic content.

```
┌─────────────────────────────────────────┐
│         CACHEABLE PREFIX                │
│  (stable across sessions)               │
│  - Identity + safety instructions       │
│  - Permission + hook configuration      │
│  - Code style + error handling rules    │
│  - Tool preferences + usage patterns    │
│  - Tone, style, output rules            │
├─────────────────────────────────────────┤
│         CACHE BOUNDARY                  │
├─────────────────────────────────────────┤
│         DYNAMIC SUFFIX                  │
│  (changes per session/request)          │
│  - Available agents and skills          │
│  - Memory file contents                 │
│  - Environment context (OS, dir, git)   │
│  - Language + output preferences        │
│  - Active MCP server instructions       │
│  - Context window management directives │
└─────────────────────────────────────────┘
```

**Implementation pattern (Python):**

```python
from dataclasses import dataclass, field
from typing import Optional

@dataclass
class PromptSection:
    content: str
    cacheable: bool = True
    priority: int = 0

class AgentPromptBuilder:
    """
    Assembles a dynamic system prompt from modular sections.
    Mirrors the cacheable-prefix / dynamic-suffix split observed
    in production agentic tools.
    """

    def __init__(self):
        self._cacheable_sections: list[PromptSection] = []
        self._dynamic_sections: list[PromptSection] = []

    def add_identity(self, identity: str) -> "AgentPromptBuilder":
        self._cacheable_sections.append(
            PromptSection(content=identity, cacheable=True, priority=0)
        )
        return self

    def add_permissions(self, permissions: str) -> "AgentPromptBuilder":
        self._cacheable_sections.append(
            PromptSection(content=permissions, cacheable=True, priority=1)
        )
        return self

    def add_tool_descriptions(self, tools: list[str]) -> "AgentPromptBuilder":
        content = "\n".join(f"- {t}" for t in tools)
        self._cacheable_sections.append(
            PromptSection(content=f"## Available Tools\n{content}", cacheable=True, priority=2)
        )
        return self

    def add_memory(self, memory_content: str) -> "AgentPromptBuilder":
        """Dynamic — changes per session."""
        self._dynamic_sections.append(
            PromptSection(content=f"## Loaded Memory\n{memory_content}", cacheable=False)
        )
        return self

    def add_environment(self, cwd: str, git_branch: Optional[str], os_info: str) -> "AgentPromptBuilder":
        """Dynamic — changes per invocation."""
        env_block = f"""## Environment
- Working directory: {cwd}
- Git branch: {git_branch or 'unknown'}
- OS: {os_info}"""
        self._dynamic_sections.append(
            PromptSection(content=env_block, cacheable=False)
        )
        return self

    def build(self) -> str:
        stable = sorted(self._cacheable_sections, key=lambda s: s.priority)
        dynamic = self._dynamic_sections
        sections = [s.content for s in stable] + ["---"] + [s.content for s in dynamic]
        return "\n\n".join(sections)


# Usage
import os

prompt = (
    AgentPromptBuilder()
    .add_identity("You are an expert coding assistant. Be direct and precise.")
    .add_permissions("You may read and write files. Never delete without confirmation.")
    .add_tool_descriptions(["bash", "read_file", "write_file", "search"])
    .add_memory("User prefers TypeScript. Always use strict mode.")
    .add_environment(
        cwd=os.getcwd(),
        git_branch="main",
        os_info="linux"
    )
    .build()
)

print(prompt)
```

---

### 2. Multi-Stage Security Classifier

The auto-approval pattern uses **layered classification** — not a single yes/no gate:

```
Tool call received
       │
       ▼
┌─────────────────┐     SAFE     ┌──────────────┐
│  Base Classifier │────────────▶│  Auto-approve │
│  (fast, rules)   │             └──────────────┘
└────────┬────────┘
         │ AMBIGUOUS
         ▼
┌──────────────────────┐   SAFE  ┌──────────────┐
│  User Override Rules  │────────▶│  Auto-approve │
│  (extend/restrict)    │         └──────────────┘
└──────────┬───────────┘
           │ STILL AMBIGUOUS
           ▼
┌──────────────────────┐   SAFE  ┌──────────────┐
│  Extended Reasoning   │────────▶│  Auto-approve │
│  (slow, deep analyze) │         └──────────────┘
└──────────┬───────────┘
           │ UNSAFE / UNCERTAIN
           ▼
    ┌─────────────┐
    │  Ask user   │
    └─────────────┘
```

**Implementation pattern:**

```python
from enum import Enum
from typing import Callable
import re

class ClassificationResult(Enum):
    SAFE = "safe"
    UNSAFE = "unsafe"
    AMBIGUOUS = "ambiguous"

@dataclass
class ToolCall:
    name: str
    args: dict
    raw_command: str = ""

class SecurityClassifier:
    """
    Multi-stage tool call classifier.
    Pattern: base rules → user overrides → extended reasoning → ask.
    """

    # Patterns observed as universally safe in read-only / query operations
    SAFE_PATTERNS = [
        r"^(ls|pwd|echo|cat|head|tail|grep|find|git (l

Related in AI Agents