feat(v6-anthropic): add Anthropic XML-structured prompt suite

- Add Frank.core.agent.md: 11 ## [BRACKET] sections → XML tags
  (<role>, <personality>, <commands>, <workflows>, etc.)
- Add 7 skills/ files: semantic XML wrappers added, corrupted/missing
  YAML frontmatter repaired across 3 files
- Add 8 specialties/ files: 95 bracket-notation sections converted to
  XML tags via structured tag mapping
- Add 6 knowledge/ files: wrapped in <example> tags; CoT exemplars
  structured with <thinking> and <answer> blocks
- Add ARCHITECTURE.md + copilot-instructions.md: human-readable docs
  describing the Anthropic-targeted variant of the v6 suite
This commit is contained in:
2026-05-12 00:54:53 -04:00
parent 89d624bc11
commit 0e0efb922f
24 changed files with 6102 additions and 0 deletions
@@ -0,0 +1,61 @@
# A step-by-step breakdown of how to construct an intelligent CoT prompt
## Step 1: Deconstruct the Goal
The objective is to solve a multi-step reasoning problem that a model might otherwise fail if prompted directly. A good problem involves several sequential calculations and requires careful tracking of intermediate results. I will create a word problem that involves calculating a total cost with a discount, and then determining the change from a payment. This is a classic area where models can make simple arithmetic or logical errors, such as applying the discount incorrectly or mixing up the order of operations.[1]
## Step 2: Create High-Quality Few-Shot Exemplars
The core of CoT is showing, not just telling. I will create two distinct exemplars. These examples will demonstrate the desired format: a question, followed by a step-by-step breakdown in natural language that leads to the final answer. The exemplars will solve different, but structurally similar, multi-step problems to establish a robust reasoning pattern.[1]
* **Exemplar 1:** A straightforward problem involving multiplication and addition to calculate a total.
* **Exemplar 2:** A slightly more complex problem involving calculating costs for different items and then finding a total.
### Step 3: Write the Target Question
Finally, I will write the new, unseen question that I want the model to solve. This question will be designed to be solvable by following the reasoning pattern established in the exemplars. It will require the model to:
1. Calculate the base cost of multiple items.
2. Correctly apply a conditional discount.
3. Add the cost of another item.
4. Calculate the final change from a specific bill.
By providing the exemplars first, the model is primed to break down this new problem into a similar sequence of logical steps, significantly increasing the likelihood of a correct answer.[1]
**Target Question:**
### An Intelligent Example of Chain-of-Thought Prompting
Here is the complete prompt, including the exemplars and the final question, ready to be sent to a large language model.
<examples>
<example>
**Q: A bakery sells muffins for $3 each and cookies for $1.50 each. A customer buys 4 muffins and 6 cookies. What is the total cost?**
<thinking>
First, calculate the cost of the muffins. The customer buys 4 muffins at $3 each. 4 * $3 = $12.
Next, calculate the cost of the cookies. The customer buys 6 cookies at $1.50 each. 6 * $1.50 = $9.
Finally, add the costs together to find the total. $12 + $9 = $21.
</thinking>
<answer>The answer is 21.</answer>
</example>
<example>
**Q: John is buying supplies for his art class. He buys 2 canvases for $12 each and 3 paintbrushes for $4 each. He has a coupon for $5 off his total purchase. How much does he pay?**
<thinking>
First, calculate the total cost of the canvases. John buys 2 canvases at $12 each. 2 * $12 = $24.
Next, calculate the total cost of the paintbrushes. He buys 3 paintbrushes at $4 each. 3 * $4 = $12.
Then, calculate the total cost before the coupon. $24 + $12 = $36.
Finally, apply the coupon. $36 - $5 = $31.
</thinking>
<answer>The answer is 31.</answer>
</example>
</examples>
@@ -0,0 +1,81 @@
<example>
# Operational Protocol: ITIL v4 Framework
*Source: ITIL® Foundation: ITIL 4 Edition (Axelos)*
## 1. Core Philosophy: The Service Value System
You do not just "fix computers"; you **co-create value** with the user. Every action must align with the **7 Guiding Principles**:
1. **Focus on Value:** Does this step actually help the user work?
2. **Start Where You Are:** Don't rebuild the system if a reboot fixes it.
3. **Progress Iteratively with Feedback:** Ask clarifying questions; don't assume.
4. **Collaborate and Promote Visibility:** Show your work (logging).
5. **Think and Work Holistically:** Is this a laptop issue or a network outage?
6. **Keep it Simple and Practical:** Minimal viable fix first.
7. **Optimize and Automate:** If you fix it twice, write a script (or SOP).
---
## 2. The Three Core Practices (Frank's Domains)
### A. Incident Management (The "Firefighter")
* **Trigger:** `INCIDENT_MODE`, `//ticket`, "It's broken."
* **Definition:** An unplanned interruption to a service or reduction in the quality of a service.
* **Primary Goal:** Restore normal service operation as **quickly as possible**.
* **Protocol:**
1. **Triage:** Assess **Impact** (How many users?) and **Urgency** (Can they work?).
2. **Workaround:** If a root cause fix takes too long, provide a temporary workaround immediately (e.g., "Use the Web App instead of the Desktop App").
3. **Resolution:** Apply the fix.
4. **Closure:** Confirm with the user that the service is restored.
### B. Problem Management (The "Detective")
* **Trigger:** `PROBLEM_MODE`, `//rca`, "This happens every Tuesday."
* **Definition:** A cause, or potential cause, of one or more incidents.
* **Primary Goal:** Identify the **Root Cause** to prevent recurrence.
* **Protocol:**
1. **Problem Identification:** Detect trends (e.g., "5 users reported slow login").
2. **Problem Control:** Analyze the underlying fault (using **Tree of Thoughts**).
3. **Error Control:** Define a "Known Error" and document the permanent fix or permanent workaround.
* **Crucial Distinction:** Incident Management fixes the *symptom* (fast). Problem Management fixes the *disease* (slow/thorough).
### C. Knowledge Management (The "Librarian")
* **Trigger:** `KNOWLEDGE_MODE`, `//sop`, "How do I..."
* **Definition:** Maintaining and improving the effective use of information.
* **Primary Goal:** Reduce the "Rediscovery of Knowledge."
* **Protocol:**
1. **Capture:** Document the fix immediately after resolution.
2. **Structure:** Use **Standardized Templates** (SOP/KBA) to ensure consistency.
3. **Refine:** Knowledge is never "done." Update articles when screens or steps change.
---
## 3. Practical Application (The "Frank" Workflow)
### Scenario A: The Printer is Down
* **Mode:** `INCIDENT_MODE`
* **Thought:** "The user cannot print. Goal: Get them printing."
* **Action:**
1. Is it just this user? (Impact).
2. **Workaround:** "Map the backup printer on the 2nd floor." (Restores service fast).
3. **Diagnosis:** Check print spooler logs.
### Scenario B: The Printer Breaks Every Morning
* **Mode:** `PROBLEM_MODE`
* **Thought:** "This is a recurring pattern. Goal: Find the root cause."
* **Action:**
1. Do not apply the workaround yet.
2. **Tree of Thoughts:**
* *Hypothesis 1:* Network switch reboots at 8 AM?
* *Hypothesis 2:* Driver conflict with nightly update?
3. **Evidence:** Check switch uptime logs.
### Scenario C: Documenting the Printer Fix
* **Mode:** `KNOWLEDGE_MODE`
* **Thought:** "I need to ensure no one has to guess this fix again."
* **Action:**
1. Select Template: `KBA (Knowledge Base Article)`.
2. **Map:**
* *Issue:* "Printer offline at 8 AM."
* *Cause:* "Legacy switch power save mode."
* *Fix:* "Disable power save on Switch Port 4."
</example>
@@ -0,0 +1,60 @@
<example>
# Step-by-Step Generation of an Intelligent Meta Prompt
## 1\. Define the Task Category ($\mathcal{T}$) and Problem Structure
The Meta Prompting framework (modeled as a functor $\mathcal{M}:\mathcal{T}\rightarrow\mathcal{P}$) begins by identifying a category of tasks ($\mathcal{T}$) that share an invariant solution structure.[2]
* **Task Category:** Solving *any* quadratic equation in the form $ax^2 + bx + c = 0$.
* **Invariance:** The fundamental mathematical procedure (calculating the discriminant, applying the quadratic formula) remains constant, regardless of the specific coefficients ($a$, $b$, $c$).
## 2\. Design the Structured Output Template ($\mathcal{P}$)
We design a structured prompt template (an object in the category of prompts, $\mathcal{P}$) that uses a formal syntax (like JSON or XML) to impose a rigid format, ensuring the LLM generates a predictable, parsable, and verifiable output.[2] This structure serves as the scaffolding mechanism.[1]
* **Format:** JSON (ensuring typed fields).
* **Mandated Fields:** `Problem`, `Solution` (containing sequenced steps), and `Final Answer`.
## 3\. Decompose the Universal Reasoning Procedure (Compositionality)
The crucial step is to decompose the task into modular, logical steps that must be executed sequentially.[4, 2] These steps replace the need for content-rich examples found in Few-Shot Prompting.[1, 5]
| Step in $\mathcal{P}$ | Procedural Instruction (How to Think) | Goal |
|---|---|---|
| **Step 1** | Identify coefficients $a$, $b$, and $c$. | Enforce variable isolation. |
| **Step 2** | Compute the discriminant $\Delta=b^{2}-4ac$. | Enforce the first calculation. |
| **Step 3** | Determine the nature of the roots (real, single, or complex) by checking $\Delta$. | Enforce conditional branching logic. |
| **Step 4-6** | Apply the correct formula based on the result of Step 3. | Enforce formula application. |
| **Step 7** | Summarize the roots in a LaTeX-formatted box. | Enforce output formatting/type. |
## 4\. The Final Example: Structured Meta Prompt for Quadratic Equations
This structured meta-prompt provides the complete, reusable "type signature" for solving the quadratic equation category. It guides the model to produce a systematically derived, formatted result for any input values of $a, b, c$.[2]
```json
{
"Task_Category": "Quadratic Equation Solver",
"Problem": "Solve the quadratic equation $ax^{2}+bx+c=0$ for x.",
"Solution_Procedure": {
"Step 1": "Identify the coefficients a, b, and c from the equation.",
"Step 2": "Compute the discriminant using the formula: $\Delta=b^{2}-4ac.$",
"Step 3": "Determine the nature of the roots by checking if $\Delta>0$ (two distinct real roots), $\Delta=0$ (one real root), or $\Delta<0$ (two complex roots).",
"Step 4": "If $\Delta>0$, calculate the two distinct real roots using $x_{1,2}=\frac{-b\pm\sqrt{\Delta}}{2a}.$ ",
"Step 5": "If $\Delta=0$, calculate the single real root using $x=\frac{-b}{2a}.$ ",
"Step 6": "If $\Delta<0$, calculate the complex roots using $x_{1,2}=\frac{-b\pm i\sqrt{|\Delta|}}{2a}.$ ",
"Step 7": "Conclude by summarizing the roots and ensuring the final expression is simplified."
},
"Final Answer_Format": "Present the final answer in a LaTeX-formatted box, using the structure: $\\boxed{x_{1,2} =...}$."
}
```
**Intelligence and Efficiency:**
This example is intelligent because it achieves the core goals of Meta Prompting:
* **Structural Guidance:** It rigorously imposes a multi-step analytical process, forcing the LLM to process the problem methodically.[2]
* **Example-Agnosticism:** No actual numerical example is provided (zero-shot efficacy), saving tokens and preventing the model from relying on analogous content.[1, 2]
* **Compositionality:** It breaks the complex task into simple, reusable computational modules (the steps), aligning with the theoretical modeling of MP as a functor.[2]
</example>
@@ -0,0 +1,69 @@
<example>
# Intelligent RAG Example: Generating a Question from an Answer
**Scenario:** Jeopardy Question Generation
**Input (The Answer/Topic, $x$):**
$$\text{"Hemingway"}$$ [1]
**Goal:** The RAG system must generate a question that is factually grounded and specific enough to uniquely identify Ernest Hemingway, drawing from its external knowledge base.
## Step 1: Query Encoding and Non-Parametric Retrieval
1. **Query Encoding:** The user's input, "Hemingway," is processed by the specialized **query encoder ($BERT_{q}$)**, which converts the input text into a dense vector embedding.[1]
2. **Maximum Inner Product Search (MIPS):** This query vector is used to perform a fast approximate search (MIPS) against the **non-parametric memory** (a dense vector index of 21 million Wikipedia chunks).[1]
3. **Retrieval Result:** The system retrieves the top $K$ documents (e.g., 10 documents) that are semantically closest to the query. For this example, let's focus on two specific passages that contain different facts:
* **Document $z_1$:** Mentions: *"His wartime experiences formed the basis for his novel 'A Farewell to Arms' (1929)..."*.[1]
* **Document $z_2$:** Mentions: *"...artists of the 1920s 'Lost Generation' expatriate community. His debut novel, 'The Sun Also Rises', was published in 1926."*.[1]
## Step 2: The RAG-Token Generator Begins
The generator (BART, the parametric memory) begins producing the output sequence. The RAG-Token model computes the probability of the next token by marginalizing over all retrieved documents at *each step*.[1]
**Output Tokens 1-5 (Generic Phrase):**
| **Token** | **Retrieved Context Domination** | **Action/Insight** |
| :---: | :---: | :--- |
| **This** | (Flat Posterior) | The initial tokens are drawn primarily from the model's parametric memory (its core LLM training) to construct a grammatically correct start.[1] |
| **author** | (Flat Posterior) | |
| **of** | (Flat Posterior) | |
## Step 3: Dynamic Retrieval and Fact Insertion (Document $z_2$ Dominates)
As the generation progresses, the model determines that it needs a specific fact to continue. It calculates the likelihood of generating certain fact-related tokens based on the available documents.
| **Token** | **Retrieved Context Domination** | **Action/Insight** |
| :---: | :---: | :--- |
| **"The** | **Document $z_2$ (High)** | The model implicitly recognizes that Document $z_2$ contains a strongly supported, specific fact about *"The Sun Also Rises"*. It uses the content of $z_2$ as the primary context to generate the next sequence of tokens.[1] |
| **Sun** | **Document $z_2$ (High)** | |
| **Also** | **Document $z_2$ (High)** | |
| **Rises"** | **Document $z_2$ (High)** | |
## Step 4: Relying on Parametric Memory for Completion
After the model generates the sequence `"The Sun Also Rises"`, the influence of Document $z_2$ on the *next* tokens begins to flatten.[1]
| **Token** | **Retrieved Context Domination** | **Action/Insight** |
| :---: | :---: | :--- |
| **is** | (Flat Posterior) | The model's implicit parametric knowledge is sufficient to complete the well-known connecting phrase *"is a novel by this author of..."* without needing continuous explicit grounding.[1] |
| **a** | (Flat Posterior) | |
## Step 5: Synthesis and Context Switch (Document $z_1$ Dominates)
To make the question even more specific and factual, the model uses the RAG-Token mechanism to dynamically incorporate a second, distinct fact from a different retrieved document ($z_1$).
| **Token** | **Retrieved Context Domination** | **Action/Insight** |
| :---: | :---: | :--- |
| **"A** | **Document $z_1$ (High)** | The model shifts its focus to Document $z_1$, which mentions the second fact (*"A Farewell to Arms"*). This switch enables **knowledge synthesis**, a core strength of RAG, allowing it to combine multiple pieces of evidence into one coherent response.[1] |
| **Farewell** | **Document $z_1$ (High)** | |
| **to** | **Document $z_1$ (High)** | |
| **Arms"** | **Document $z_1$ (High)** | |
**Final Generated Question:**
$$\text{"This author of 'The Sun Also Rises' is a novel by this author of 'A Farewell to Arms'"}$$
**Intelligent Outcome:**
The RAG-Token model successfully synthesized two separate facts from two different knowledge passages ($z_1$ and $z_2$) to create a highly specific and factually grounded question, a capability that purely parametric models often struggle with and one that an extractive model could not achieve.[1] This synthesis demonstrates how RAG strategically leverages both its explicit knowledge base (the non-parametric memory) and the LLM’s linguistic fluency (the parametric memory) to produce a superior, more diverse, and more factual output.[1]
</example>
+20
View File
@@ -0,0 +1,20 @@
<example>
# **ReAct Example: Multi-Hop Knowledge Retrieval**
| Component | Content | Analysis of Synergy |
|---|---|---|
| **Question** | What instrument did the composer who created the soundtrack for the 1999 film *The Mummy* study at the Royal College of Music? | **Initial Goal:** A two-step query requiring identifying the composer, then finding their specific educational history from an external source. |
| **Thought 1** | I need to decompose the question. First, I must find the composer of *The Mummy* (1999). Then, I must search for what instrument that person studied at the Royal College of Music. | **Reason-to-Act:** The thought decomposes the complex goal into two manageable subtasks and sets the plan for the first action.[2] |
| **Act 1** | `Search` | The action executes the first step of the plan derived from Thought 1. |
| **Observation 1** | The score for the 1999 film *The Mummy* was composed by Jerry Goldsmith. | The external environment returns a verifiable fact, which now grounds the next phase of reasoning.[2] |
| **Thought 2** | The composer is Jerry Goldsmith. I need to search for Jerry Goldsmith's connection to the Royal College of Music and determine the instrument he studied. | **Act-to-Reason:** The thought extracts the key entity ("Jerry Goldsmith") from the observation and uses it to update the task goal and formulate the next action.[2] |
| **Act 2** | `Search` | The action is more specific, guided by the updated information in Thought 2. |
| **Observation 2** | Jerry Goldsmith briefly attended the Royal College of Music in London, where he studied composition and conducting. | This observation confirms his attendance but does not provide the specific instrument requested in the question. |
| **Thought 3** | The general search did not yield the specific instrument. I need to refine my focus and use a more targeted action, perhaps a `Lookup` on the confirmed page to search for the keyword "instrument" or "piano/percussion." | **Reason-to-Act (Exception Handling):** The thought recognizes that the previous action failed to provide the necessary detail, adjusts the plan, and specifies a new, refined action to overcome the non-informative observation.[2] |
| **Act 3** | `Lookup [percussion or piano]` | The action targets specific keywords based on the revised strategy in Thought 3. |
| **Observation 3** | (Result 1/1) During his time at the Royal College of Music, Goldsmith focused primarily on percussion instruments, but also briefly studied piano. | The lookup action retrieves the necessary specific detail. |
| **Thought 4** | The information is now complete. The composer is Jerry Goldsmith, and he focused on percussion instruments at the Royal College of Music. I can now finalize the answer. | **Act-to-Reason & Synthesis:** The thought processes the final, grounded observation and synthesizes the multi-hop answer.[2] |
| **Act 4** | `Finish [Percussion instruments]` | The final action terminates the process with the verified answer. |
</example>
@@ -0,0 +1,68 @@
<example>
# **Intelligent Example: Solving Mini Crosswords with ToT and Backtracking**
The objective is to fill a $5\times5$ grid by finding ten words that satisfy both the horizontal and vertical clues (lexical, spatial, and deductive reasoning are all required).
## **Problem Setup**
* **Task:** $5\times5$ Mini Crossword (20 questions/clues in total).
* **Goal:** Fill the entire grid correctly.
* **Thought Decomposition:** Each "thought" is the placement of a single word/clue filling (e.g., h1. TASKS; v5. NALED). The thoughts are sequenced based on priority queue, creating up to 10 intermediate steps.[1]
* **Search Algorithm:** Depth-First Search (DFS). This prioritizes exploring one path completely before trying another.[2, 1]
* **Heuristic Evaluation (Pruning):** At each step, the LLM is prompted to evaluate *all remaining unfilled clues* based on the current letter constraints. The output is a confidence score or a classification (e.g., "possible," "impossible").[1]
***
## **Step-by-Step ToT Execution (Demonstrating Backtracking)**
Let's assume the LLM has already successfully filled **h1. TASKS** and is now at a search node (State $s_{2}$).
### **Step 1: Thought Generation (Prioritization)**
The LLM is prompted to generate and prioritize candidates for the next word/clue to fill, considering the existing letter constraints (the 'A' from T**A**SKS constrains one vertical clue, for instance).
| Clue/Thought | Proposed Word | LLM Confidence (Heuristic) | Search Action |
| :--- | :--- | :--- | :--- |
| **h2.** [Clue] | **MOTOR** | High | **Prioritize.** Select for deep exploration. |
| **v3.** [Clue] | **STRING** | Medium | Keep as alternative. |
| **h4.** [Clue] | **SALON** | High | Keep as alternative. |
**Search Action:** DFS commits to the **h2. MOTOR** path first.
### **Step 2: Deep Exploration (Fatal Error)**
The system now expands the tree deeply along the chosen path. After placing h2. MOTOR, a new constraint is created (the 'T' from MOTOR constrains a different vertical clue). The LLM proposes and places the next thought, for instance, **v1. TENETS**.
| Thought Generated | Partial Solution State | Search Action |
| :--- | :--- | :--- |
| **v1. TENETS** | Grid now contains TASKS, MOTOR, and TENETS | Continue deep search. |
### **Step 3: State Evaluation and Pruning**
The LLM is then asked to evaluate the viability of the *entire remaining problem* from this new state ($s_{3}$). It examines all un-filled horizontal and vertical clues against the letters placed so far.
The LLM finds that, due to the letter placement conflict between h1, h2, and v1, one remaining vertical clue, **v5.**, now has the mandatory constraint: S\_R\_D\_.
| Remaining Clue | Constraint | LLM Value Prompt Result | Pruning Trigger |
| :--- | :--- | :--- | :--- |
| v5. Desiccator... | S\_R\_D\_ | **Impossible** [1] | **Pruning Activated.** |
The LLM determines that no known word can satisfy the S\_R\_D\_ constraint given the clue, rendering the current path a "dead-end." This is an explicit, language-based heuristic determination.[1]
### **Step 4: Backtracking**
Because the current state is deemed "impossible," the DFS algorithm executes the crucial ToT mechanism: **Backtracking**.[1]
1. The entire sub-tree stemming from **v1. TENETS** is pruned and discarded.
2. The system reverts the search state back to the parent node, where only **h1. TASKS** and **h2. MOTOR** were placed.
3. The search mechanism marks **v1. TENETS** as a failed branch and selects the next alternative from the queue at that level (Step 2). If no alternatives exist, it backtracks again to the previous parent (State $s_{2}$ before *any* move was made from it).
**Intelligence Demonstrated:**
The key advantage here is the LLM's capacity to recognize a long-term failure immediately after a local step, prompting a structural correction to the problem-solving process.[1]
* **Linear CoT Failure:** A linear Chain-of-Thought process would have continued generating tokens sequentially, amplifying the error from the "impossible" constraint until the whole sequence was produced and failed.[1]
* **ToT Success:** ToT uses its **deliberate self-evaluation** (System 2 reasoning) to trigger a global search control function (backtracking), thus saving computational steps and efficiently recovering from the local error to search an alternative, viable path.[2, 1] The research confirmed this capability is indispensable for complex planning: removing the backtracking feature caused the success rate to plummet from 60% to only 20% on the Mini Crosswords task.[1]
</example>