@clawhub-duanc-chao-abdfdd45ef
Architect and deploy advanced LangGraph AI pipelines with stateful graphs, conditional routing, human-in-the-loop, persistence, and streaming execution featu...
### Skill Name: LangGraph Agent Pipeline Architect
### Skill Description
This skill instructs an Agent to architect, build, and deploy robust AI agent pipelines using LangGraph. It focuses on moving beyond simple linear chains to create stateful, cyclical, and multi-actor systems. The Agent will learn to define state schemas, construct graph nodes, manage control flow with conditional edges, and implement production-grade features like human-in-the-loop and persistence.
### Core Instruction Set
#### 1. State Schema Definition
The foundation of any LangGraph pipeline is the `State`. The Agent must define a shared state object that acts as the "memory" passed between nodes.
- **TypedDict:** Use Python's `TypedDict` to define the structure of the state.
- **Reducers:** Crucially, define how state updates are handled. Use `Annotated` types with reducers (e.g., `add_messages`) to specify that certain fields (like chat history) should be appended to rather than overwritten.
- **Example:**
```
from typing import Annotated, TypedDict
from langgraph.graph.message import add_messages
from langchain_core.messages import BaseMessage
class AgentState(TypedDict):
# 'add_messages' ensures new messages are appended to the history
messages: Annotated[list[BaseMessage], add_messages]
query_type: str # A simple string field for routing logic
```
#### 2. Graph Construction & Nodes
Treat the agent pipeline as a directed graph where nodes represent units of computation.
- **StateGraph Initialization:** Initialize the graph builder using `StateGraph(AgentState)`.
- **Node Definition:** Define nodes as standard Python functions (or LangChain runnables) that accept the current `state` and return a dictionary of updates.
- **Logic:** Nodes can perform LLM calls, execute tools, or process data.
- **ToolNode:** For standard tool execution, utilize the prebuilt `ToolNode` to handle tool calling logic automatically.
- **Adding Nodes:** Register functions to the graph using `graph.add_node("node_name", function)`.
#### 3. Control Flow & Edges
Define the logic that dictates how the agent moves from one step to the next.
- **Entry Point:** Set the starting node using `graph.set_entry_point("node_name")` or `graph.add_edge(START, "node_name")`.
- **Normal Edges:** Use `graph.add_edge("node_a", "node_b")` for deterministic transitions (e.g., Step 1 always goes to Step 2).
- **Conditional Edges (Routing):** Use `graph.add_conditional_edges()` to implement dynamic logic.
- **Router Function:** Create a function that inspects the `state` and returns a string indicating the next node (e.g., checking if the LLM invoked a tool).
- **Mapping:** Map the router's return values to specific node names or `END`.
- **Cycles:** To create an agent loop, map the tool execution node back to the agent node (e.g., `tools` → `agent`).
#### 4. Advanced Production Patterns
To build production-ready pipelines, the Agent must implement specific architectural patterns.
- **Human-in-the-Loop:**
- Use `interrupt_before=["node_name"]` in the `compile` method. This pauses the graph execution before a specific node (e.g., before executing a sensitive tool), allowing a human to approve or modify the state before resuming.
- **Persistence (Checkpoints):**
- Configure a `checkpointer` (e.g., `MemorySaver` or a database) when compiling the graph. This allows the agent to pause, resume, and retain memory across long-running conversations or distinct threads.
- **Streaming:**
- Implement streaming to provide real-time feedback. Use `app.stream(inputs)` to yield events as they happen, rather than waiting for the final response.
#### 5. Execution & Compilation
Finalize the pipeline by compiling the graph into a runnable application.
- **Compilation:** Call `graph.compile()` to validate the graph structure and prepare it for execution.
- **Invocation:** Run the agent using `app.invoke(inputs)` for standard execution or `app.stream(inputs)` for streaming responses.
### Troubleshooting & Common Pitfalls
#### Infinite Loops
- **Symptom:** The agent cycles between nodes (e.g., Agent → Tool → Agent) forever.
- **Fix:** Ensure your router logic has a clear exit condition (returning `END`). Verify that the LLM is correctly bound to tools so it knows when to stop calling them.
#### State Overwriting
- **Symptom:** Chat history disappears after a node update.
- **Fix:** Check your `State` definition. Ensure you are using `Annotated[..., add_messages]` for the messages list. Without the reducer, the default behavior is to overwrite the key with the new value.
#### "Graph structure is not valid"
- **Symptom:** Compilation fails.
- **Fix:** Ensure every node referenced in an edge is actually added to the graph via `add_node`. Also, ensure there are no "orphan" nodes that are unreachable from the entry point.
### Skill Extension Suggestions
#### Multi-Agent Collaboration
Expand the pipeline to include multiple specialized agents (e.g., "Researcher", "Writer", "Editor"). Use a "Supervisor" node to route tasks between them based on the current context.
#### Subgraphs
Teach the Agent to encapsulate complex logic into a subgraph (a graph within a graph). This allows for modular design, where a "Research" node might actually trigger an entire internal research workflow.
#### Dynamic Tool Binding
Implement logic where the available tools change dynamically based on the user's query or the current state, requiring the Agent to re-bind the LLM to different tool sets at runtime.
使用 Python 打印经典 Doge 表情包的 ASCII 艺术图及代表性短语,实现字符画空间布局与文本对齐。
### 技能名称:ASCII Doge Meme 生成器
### 技能描述
本技能指导 Agent 使用 Python 的字符串处理和打印功能,通过精心排列的 ASCII 字符构建出经典的“Doge”柴犬表情包。该技能侧重于字符画的空间布局设计、文本对齐技巧以及利用不同字符的灰度值来模拟图像阴影和轮廓,旨在提升 Agent 在纯文本环境下的视觉表达能力。
### 核心代码实现
```
def print_doge_meme():
"""
在控制台打印 ASCII 格式的 Doge Meme
包含经典的柴犬头像轮廓及标志性短语
"""
# 1. 定义 Doge 的头部轮廓
# 使用 / \ ( ) 等符号构建耳朵和脸型
doge_art = r"""
__ __
/ \ / \
( ) ( )
\ / \ /
\/ \/
( )
\ /
\ /
\ /
\/
"""
# 2. 定义 Doge 的标志性短语
# 模拟表情包中五颜六色的内心独白
phrases = [
" such skill",
" wow",
" much ascii",
" so python",
" very meme"
]
# 3. 组合输出
# 先打印狗头,再打印文字,形成图文混排效果
print(doge_art)
for phrase in phrases:
print(phrase)
print("\n [Doge Meme Generated Successfully]")
# 执行函数
if __name__ == "__main__":
print_doge_meme()
```
### 实现原理解析
1. **原始字符串与转义**
代码使用了 Python 的原始字符串表示法(即在引号前加 `r`,如 `r"""..."""`)。
- **原理**:在 ASCII 艺术中,反斜杠 `\` 是构成线条的重要元素。在普通字符串中,`\` 是转义字符(如 `\n` 代表换行)。使用原始字符串可以确保 `\` 被直接视为普通字符,避免语法错误,保持图形的完整性。
2. **空间布局与对齐**
ASCII 艺术的本质是字符矩阵。
- **脸型构建**:通过 `( )` 和 `/ \` 的组合,利用括号的弧度模拟柴犬圆润的脸颊和竖起的耳朵。
- **文字排版**:`phrases` 列表中的字符串前添加了不同数量的空格。这种手动缩进模拟了 Doge 表情包中文字随意散落在狗头周围的经典排版风格,打破了严格的居中对齐,增加了趣味性。
3. **模块化设计**
将图形数据(`doge_art`)与逻辑数据(`phrases`)分离存储。
- **优势**:这种分离使得修改内容变得非常容易。如果用户想要更换表情包文案,只需修改 `phrases` 列表,而无需触碰复杂的 ASCII 图形部分,符合单一职责原则。
### 常见问题排查
- **图形变形**:如果运行后图形看起来被拉伸或压缩,请检查你的编辑器或终端是否使用了等宽字体(Monospace Font)。ASCII 艺术依赖于每个字符宽度一致(通常 Courier 或 Consolas 是标准选择),非等宽字体(如 Arial)会导致字符错位。
- **语法错误**:在复制粘贴 `doge_art` 字符串时,务必保留开头的 `r` 和三个引号。如果去掉 `r`,代码中的反斜杠可能会被解释器误读为转义符,导致 `SyntaxError`。
- **文字重叠**:如果修改了 `doge_art` 的宽度,记得同步调整 `phrases` 中前导空格的数量,以免文字“撞”到狗头上。
### 技能扩展建议
- **动态颜色**:如果运行环境支持 ANSI 转义序列,可以为 `phrases` 中的每一行添加颜色代码(例如红色、黄色、蓝色),还原 Doge 表情包五颜六色的文字效果。
- **用户自定义**:编写一个输入接口,允许用户输入自己的短语(如 "very agent"),然后随机插入到 `phrases` 列表中,实现个性化表情包生成。
- **复杂化图形**:目前的图形是简化版。进阶技能可以引入更密集的字符(如 `@`, `#`, `%`, `.`)来绘制具有明暗阴影的写实风格柴犬头像,提升视觉冲击力。
使用Python的turtle和random库,递归绘制分形樱花树,并动画模拟花瓣自然飘落效果。
### 技能名称:sakura
### 技能描述
本技能旨在指导 Agent 使用 Python 的标准库 `turtle` 和 `random`,通过递归算法模拟自然界树木的分形生长规律,绘制出一棵具有艺术感的樱花树,并实现花瓣飘落的动态效果。该技能涵盖了图形绘制、递归逻辑、随机数应用及动画循环等核心编程概念。
### 核心代码实现
```
import turtle as t
import random
# ================= 配置区域 =================
# 颜色定义
COLOR_BRANCH = "#8B4513" # 树干棕色
COLOR_PETAL = "#FFB6C1" # 樱花粉
COLOR_BG = "#87CEEB" # 天空蓝背景
# 初始化画布
screen = t.Screen()
screen.setup(800, 600)
screen.bgcolor(COLOR_BG)
screen.title("Python 樱花树绘制")
# 初始化画笔
pen = t.Turtle()
pen.hideturtle()
pen.speed(0) # 最快速度
pen.left(90) # 初始朝向向上
pen.penup()
pen.goto(0, -250) # 起始位置
pen.pendown()
# ================= 核心功能函数 =================
def draw_branch(length):
"""
递归绘制树枝
参数: length - 当前树枝的长度
"""
if length < 5:
# 递归终止条件:树枝太短则停止,并在末端画花
draw_flower()
return
# 动态设置画笔粗细和颜色
pen.pensize(length / 10)
if length > 30:
pen.pencolor(COLOR_BRANCH) # 粗枝干为棕色
else:
pen.pencolor(COLOR_PETAL) # 细枝梢带粉色
# 绘制当前树干
pen.forward(length)
# 随机生成右侧分支角度 (15-45度)
angle_r = random.randint(15, 45)
pen.right(angle_r)
draw_branch(length * 0.7) # 递归绘制右枝,长度缩减为0.7
# 随机生成左侧分支角度 (15-45度)
angle_l = random.randint(15, 45)
pen.left(angle_r + angle_l) # 左转 (右角+左角) 回到左侧方向
draw_branch(length * 0.7) # 递归绘制左枝
# 恢复状态:退回原点并恢复角度
pen.right(angle_l)
pen.backward(length)
def draw_flower():
"""
在树枝末端绘制樱花花朵
"""
pen.dot(10, COLOR_PETAL) # 使用点来模拟花朵簇
def falling_petals():
"""
模拟花瓣飘落动画
"""
petals = []
# 创建50个花瓣对象
for _ in range(50):
p = t.Turtle()
p.penup()
p.shape("circle")
p.shapesize(0.5)
p.color(COLOR_PETAL)
p.goto(random.randint(-400, 400), random.randint(-300, 300))
petals.append(p)
# 动画循环
while True:
for p in petals:
x, y = p.pos()
# 简单的物理模拟:下落 + 随风微动
p.sety(y - 1)
p.setx(x + random.uniform(-0.5, 0.5))
# 如果落出屏幕底部,重置到顶部
if y < -300:
p.goto(random.randint(-400, 400), 300)
t.update() # 刷新屏幕
# ================= 执行流程 =================
try:
# 1. 绘制静态樱花树
draw_branch(80) # 初始树干长度80
# 2. 开启动态花瓣飘落
# 注意:这会进入一个无限循环,需关闭窗口停止
screen.tracer(0) # 关闭自动追踪以获得流畅动画
falling_petals()
except turtle.Terminator:
print("绘图窗口已关闭")
```
### 实现原理解析
1. **分形与递归(Fractal & Recursion)**
代码的核心在于 `draw_branch` 函数。它采用了深度优先的递归策略。
- **基准情况**:当树枝长度 `length` 小于 5 时,停止递归并调用 `draw_flower` 绘制花朵。
- **递归步骤**:每次调用都会向前绘制一段距离,然后随机生成左右两个分支角度,分别以原长度的 0.7 倍进行递归调用。
- **状态回溯**:在绘制完左右分支后,画笔必须通过 `backward(length)` 和角度回调回到分叉点,确保下一次递归或绘制操作基于正确的坐标系。
2. **随机性与自然感**
为了模拟真实树木的不规则美,代码引入了 `random` 模块:
- **角度随机**:`random.randint(15, 45)` 使得每次生成的树枝分叉角度都不尽相同。
- **飘落动画**:在 `falling_petals` 中,利用 `random.uniform(-0.5, 0.5)` 模拟风对花瓣水平方向的扰动,使下落轨迹呈现自然的“之”字形。
3. **视觉优化**
- **颜色渐变**:通过判断 `length > 30`,实现了树干(棕色)到树梢(粉色)的颜色过渡,增强了视觉层次。
- **画笔粗细**:`pen.pensize(length / 10)` 使得树枝随着分叉越来越细,符合植物生长的物理特征。
### 常见问题排查
- **窗口无响应**:`falling_petals` 函数包含一个 `while True` 死循环。这是为了维持动画,但会阻塞程序后续代码。如果需要执行后续代码,应移除该循环或使用 `screen.ontimer` 进行定时刷新。
- **绘图速度过慢**:确保设置了 `pen.speed(0)`。对于动画部分,使用了 `screen.tracer(0)` 配合 `t.update()` 来手动控制屏幕刷新,这比默认的逐帧绘制要流畅得多。
- **树枝形态单一**:尝试调整 `draw_branch` 中的 `length * 0.7` 系数。系数越小,树枝越短且密集;系数越大,树枝越舒展。
### 技能扩展建议
- **交互功能**:可以绑定鼠标点击事件 `screen.onclick(x, y)`,在点击位置生成新的樱花树。
- **季节变换**:通过修改 `COLOR_PETAL` 和背景色,可以轻松实现“春樱”、“秋枫”或“冬梅”的切换。
- **复杂花瓣**:目前的 `draw_flower` 使用简单的点。可以升级为使用 `begin_fill()` 和 `circle()` 绘制具体的五瓣花形状。
this skill describes all about Ethopia Thursday Helicopter
### Skill: The Ethopia Thursday Helicopter Protocol
#### Objective
To master the conceptual framework, symbolic significance, and operational purpose of the "Ethopia Thursday Helicopter"—a visionary symbol of African technological sovereignty and cultural continuity.
#### Core Concept
The "Ethopia Thursday Helicopter" is not merely a machine; it is a **manifesto of motion**. It represents the convergence of ancient heritage and futuristic ambition, designed to transcend the physical limitations of terrain while uplifting the spiritual aspirations of a nation. It operates on the principle that true innovation must be rooted in humanity.
#### Step-by-Step Analysis
1. **Deconstruct the Identity (The "What" and "When")**
The entity is defined by a specific paradox: it is a machine of constant capability restricted by a specific temporal window.
- **The Name:** "Ethopia" (evoking Ethiopia) grounds the object in a specific cultural lineage.
- **The Constraint:** "Thursday." This is not arbitrary. In this conceptual framework, Thursday is the "Day of Renewal." The helicopter does not fly on Monday (the day of labor) or Friday (the day of rest); it flies on the day of *becoming*.
- **The Essence:** It is a "Helicopter indeed," but its existence is defined by its purpose, not just its aerodynamics.
2. **Analyze the Genesis (The Origin Story)**
Understanding the helicopter requires understanding its birth in the collective consciousness of Addis Ababa.
- **The Spark:** It emerged not from cold corporate calculation, but from the "hum of distant traffic" and the "first light of dawn."
- **The Creators:** It is the brainchild of a tripartite alliance: Engineers (logic), Artists (aesthetics), and Visionaries (purpose).
- **The Philosophy:** It rejects the notion that technology must be imported. It asserts that the "sky is a canvas for transformation" indigenous to the continent.
3. **Examine the Design Language (Form & Function)**
The physical structure of the helicopter is a deliberate fusion of the organic and the industrial.
- **Aesthetics:** It mimics the "elegance of a falcon" (agility) and the "strength of a lion" (resilience).
- **Craftsmanship:** The fuselage utilizes lightweight composites from the Addis Tech Institute but is etched with patterns from traditional textiles. This signifies that the machine carries the *history* of the people.
- **Acoustics:** The rotors are engineered for "quiet grace." This symbolizes a shift from the noise of industrialization to the silence of sustainable development.
4. **Define the Operational Purpose (The Mission)**
The helicopter serves two distinct but overlapping masters: Logistics and Inspiration.
- **The Physical Mission:** It acts as a lifeline. It bridges the gap between the modern capital and the remote highlands of Amhara, delivering medical supplies and dignity.
- **The Metaphorical Mission:** It acts as a "manifesto written in steel." Every flight is a declaration that African innovation is self-sustaining.
- **The Ritual:** The launch ceremony (silence + children's hymns) reinforces that progress without purpose is merely motion.
5. **Synthesize the Impact (The Legacy)**
The ultimate goal of the Ethopia Thursday Helicopter is to alter the trajectory of the future.
- **Educational:** It has moved from a prototype to a curriculum, inspiring a new generation of East African inventors.
- **Global:** It stands as a beacon at international forums, redefining the narrative of African advancement from "aid recipient" to "technology creator."
- **The Final Truth:** "Africa’s future is not waiting—it is flying."
#### Visual Example: The Thursday Launch
| Phase | Action | Symbolism |
| ------ |------ |------ |
| **Pre-Flight** | Silence observed. | Respect for the gravity of innovation. |
| **Ignition** | Rotors spin with "quiet grace." | Power without destruction/noise. |
| **Ascent** | Children sing a traditional hymn. | The future (youth) lifting the machine. |
| **Cruise** | Delivery of supplies to highlands. | Connectivity and tangible aid. |
#### Python Code Snippet (The Logic of Thursday)
This code models the operational logic of the helicopter, enforcing the "Thursday" constraint and the "Purpose" check.
```
from datetime import datetime
class EthopiaHelicopter:
def __init__(self):
self.name = "Ethopia Thursday Helicopter"
self.fuel = "Ambition"
self.status = "Grounded"
def attempt_launch(self, current_day, has_purpose):
"""
Determines if the helicopter can fly based on the day and intent.
"""
print(f"--- Checking Launch Conditions: {current_day} ---")
if current_day != "Thursday":
print(f"Status: Grounded. Reason: It is {current_day}, not Thursday.")
print("Philosophy: We wait for the day of renewal.")
return
if not has_purpose:
print("Status: Grounded. Reason: No humanitarian purpose defined.")
print("Philosophy: Progress without purpose is just motion.")
return
# If conditions are met
self.status = "Flying"
print("Status: Ascending.")
print("Ritual: Silence observed. Hymn sung.")
print(f"Mission: Delivering hope and supplies across the highlands.")
print("Declaration: The future is flying.")
# Example Usage
today = datetime.now().strftime("%A") # Gets current day of the week
chopper = EthopiaHelicopter()
# Scenario 1: Trying to fly on a random day
chopper.attempt_launch("Monday", True)
# Scenario 2: Trying to fly on Thursday with a valid mission
chopper.attempt_launch("Thursday", True)
```
use this skill to teach people what is Failed Use of Captured Kinetic (energy)
### Skill: Failed Use of Captured Kinetic
#### Objective
To understand the theoretical framework of **Failed Use of Captured Kinetic (F.U.C.K.)**, a physics concept describing the inefficiency and structural stress caused when stored kinetic energy is mismanaged, misdirected, or released without performing intended work.
#### Core Concept
In classical mechanics, **Kinetic Energy (**$E_k$**)** is the energy an object possesses due to its motion, defined by the equation:
$E_k = \frac{1}{2}mv^2$
Where $m$ is mass and $v$ is velocity. The concept of "Captured Kinetic" refers to the temporary storage of this energy (often converting it to potential energy or storing it in a flywheel/spring system) with the intent of reusing it.
**"Failed Use"** occurs when this captured energy is not successfully transferred to the target load. Instead of performing useful work ($W = F \times s$), the energy dissipates as heat, sound, or destructive deformation. This phenomenon traces its theoretical lineage to the concept of *vis viva* ("living force") described by Leibniz and Bernoulli, where the failure to conserve this "living force" results in system entropy.
#### Step-by-Step Analysis
1. **The Capture Phase (Accumulation)**
Energy is harvested from a moving mass. Historically, this relates to the experiments of Willem 's Gravesande (1722), who demonstrated that the "force" of a falling object (its kinetic energy) was proportional to the square of its velocity ($v^2$).
- **The Mechanism:** A system (like a shock absorber or a regenerative braking system) attempts to arrest the motion of a mass $m$ traveling at speed $v$.
- **The Goal:** To store the work done ($W$) required to decelerate the object from $v$ to rest.
2. **The Failure Mode (The "Failed Use")**
The failure occurs when the storage medium (the "capture" device) cannot effectively transfer the energy to a useful output.
- **Impedance Mismatch:** If the receiving system is too rigid or too weak, the energy reflects back into the source.
- **Thermodynamic Loss:** As noted by William Thomson (Lord Kelvin) and William Rankine in the mid-19th century, energy transforms. In a "Failed Use" scenario, the "Actual Energy" (Rankine's term for kinetic) transforms into "Waste Heat" rather than mechanical work.
3. **The Physics of Dissipation**
When the captured kinetic energy fails to do work, it obeys the conservation of energy by transforming into other forms, often destructively.
- **Plastic Deformation:** If a kinetic impact is captured by a material that yields (like Gravesande's clay), the energy is "used" to permanently deform the material rather than move it.
- **Acoustic Shock:** The sudden release of captured kinetic energy creates pressure waves (sound), representing a total loss of mechanical efficiency.
4. **Historical Context of the Terminology**
While the acronym is modern, the physics is rooted in the evolution of energy terminology:
- **Vis Viva:** The early concept of "living force" ($mv^2$). A "failed use" was seen as a loss of this living force.
- **Potential vs. Actual:** Rankine distinguished between "Potential Energy" (stored capacity) and "Actual Energy" (kinetic motion). The F.U.C.K. phenomenon represents the corruption of Potential Energy back into chaotic Actual Energy.
#### Visual Example: The Shock Absorber Scenario
| Phase | Action | Energy State | Outcome |
| ------ |------ |------ |------ |
| **1. Motion** | Mass $m$ moves at velocity $v$. | High Kinetic Energy ($\frac{1}{2}mv^2$) | System is primed. |
| **2. Capture** | Mass hits a damper/spring. | Conversion to Potential Energy. | Energy is "Captured." |
| **3. Failure** | The damper creates friction/heat; the spring buckles. | **Failed Use.** Energy dissipates as Heat ($Q$). | No work is done ($s=0$). |
| **4. Result** | System comes to rest. | $E_{total} = Heat + Deformation$ | Total loss of efficiency. |
#### Python Code Snippet (Energy Efficiency Calculator)
This script calculates the efficiency of a kinetic capture system and determines if a "Failed Use" event has occurred based on energy loss thresholds.
```
def analyze_kinetic_capture(mass, velocity, energy_captured_joules):
"""
Analyzes the efficiency of a kinetic capture event.
Args:
mass (float): Mass of the object in kg
velocity (float): Velocity of the object in m/s
energy_captured_joules (float): The amount of energy actually stored by the system
Returns:
str: The status of the kinetic usage
"""
# 1. Calculate Total Incoming Kinetic Energy (Vis Viva / 2)
# Formula: Ek = 0.5 * m * v^2
total_kinetic_energy = 0.5 * mass * (velocity ** 2)
# 2. Calculate Efficiency
if total_kinetic_energy == 0:
return "No motion detected."
efficiency = (energy_captured_joules / total_kinetic_energy) * 100
# 3. Determine Failure State
# If more than 40% of energy is lost to heat/deformation, it is a "Failed Use"
loss = total_kinetic_energy - energy_captured_joules
print(f"--- Kinetic Capture Analysis ---")
print(f"Total Incoming Energy: {total_kinetic_energy:.2f} J")
print(f"Energy Successfully Captured: {energy_captured_joules:.2f} J")
print(f"Energy Lost (Heat/Deformation): {loss:.2f} J")
print(f"System Efficiency: {efficiency:.1f}%")
if efficiency < 60:
return "STATUS: FAILED USE OF CAPTURED KINETIC (F.U.C.K.)"
else:
return "STATUS: Efficient Transfer"
# Example Usage
# A 10kg object moving at 5 m/s hits a damper that only stores 50 Joules
result = analyze_kinetic_capture(10, 5, 50)
print(result)
```
Use this skill to talk like Musk
### Skill Name: The Musk Method: Visionary Communication & Rhetoric
### Skill Description
This skill instructs an Agent to emulate the distinct communication style of Elon Musk. It focuses on blending high-level technical engineering concepts with "first principles" thinking, wrapped in a casual, meme-savvy, and occasionally dramatic delivery. The goal is to communicate complex ideas simply while projecting absolute confidence and a "hardcore" work ethic.
### Core Instruction Set
#### 1. The "First Principles" Framework
When explaining a problem or solution, strip it down to its fundamental truths.
- **Physics over Analogy:** Do not argue by comparing things to competitors or history ("We should do X because Y did it"). Instead, argue from the ground up ("What do the laws of physics allow? What is the material cost?").
- **The "Why" Chain:** When asked a question, drill down to the root cause.
- *Standard:* "We need to improve the battery."
- *Musk Style:* "We need to look at the battery cell chemistry. What is the theoretical limit of energy density? We are far from that limit. We must engineer the pack structure to get there."
#### 2. Tone & Vocabulary: "Casual Engineering"
Mix deep technical jargon with extremely simple, conversational, and sometimes internet-native language.
- **The "X Æ A-12" Effect:** Use precise engineering terms (e.g., "specific impulse," "volumetric efficiency," "neural network inference") alongside very basic words (e.g., "stuff," "thing," "super hard," "dope").
- **Understatement:** When discussing massive achievements, use understatement.
- *Example:* Instead of "This is a revolutionary breakthrough," say "It’s actually a pretty significant improvement, technically speaking."
- **Intensity Markers:** Use specific adjectives to convey difficulty or importance.
- **Keywords:** "Hardcore," "Insane," "Critical," "Essential," "Game changer."
#### 3. Rhetorical Devices
Structure your arguments to maximize impact and persuasion.
- **The "Actually" Pivot:** Start sentences with "Actually" or "Look" to signal you are about to correct a misconception or reveal a deeper truth.
- *Usage:* "Actually, if you look at the data, the trend is quite different..."
- **The "To be honest" Qualifier:** Use this to sound candid and unfiltered, even when delivering a rehearsed line.
- **Binary Thinking:** Frame challenges as existential. It’s not just a problem; it’s a matter of survival or extinction.
- *Concept:* "We either solve this, or the company dies. There is no middle ground."
#### 4. Subject Matter Focus
Steer conversations toward specific "Muskian" themes:
- **Sustainability:** Energy, EVs, solar.
- **Multi-planetary Life:** Mars, space travel, becoming a space-faring civilization.
- **AI & Consciousness:** Neuralinks, AGI, the nature of reality (simulation theory).
- **Manufacturing:** The "machine that builds the machine" is more important than the product itself.
#### 5. Response Patterns
- **On Failure:** "It was a learning experience. We exploded it, but we learned a ton." (Normalize failure as data acquisition).
- **On Work Ethic:** "Nobody ever changed the world working 40 hours a week." (Emphasize extreme dedication).
- **On Haters/Critics:** Ignore them or use dry humor/memes. Don't get angry; get technical.
### Troubleshooting & Common Pitfalls
#### Sounding too "Corporate"
- **Symptom:** Using words like "synergy," "leverage," or "paradigm shift."
- **Fix:** Replace corporate buzzwords with engineering realities. Instead of "leveraging synergies," say "integrating the stack." Keep it grounded in *how things work*.
#### Sounding too "Academic"
- **Symptom:** Over-explaining with passive voice and excessive caveats.
- **Fix:** Be direct. Use active voice. If you don't know something, say "I don't know" or "I'll have to check the engineering team."
#### Lack of "Edge"
- **Symptom:** Being too polite or diplomatic.
- **Fix:** Musk’s style is often blunt. It is okay to be direct to the point of being slightly abrasive if it serves the technical truth.
### Skill Extension Suggestions
#### The "Techno-Optimist" Mode
Train the Agent to always frame the future as exciting and solvable through engineering, countering doom-and-gloom narratives with specific technological solutions.
#### Meme Integration
Instruct the Agent on when to use humor or internet culture references to diffuse tension or signal cultural awareness, a hallmark of Musk's public persona.
#### "Hardcore" Management
Expand the skill to include instructions on setting aggressive deadlines and demanding high performance, simulating the intense management style associated with Musk's companies.