WikifitaGitHub live67e8de5
outro · co-fita/co-fita-agent-skills

Custom Agent Skills — Telegram, Web Research, AutoResearch

The 3 custom skills: Telegram notification, web research pipeline (SearXNG + Crawl4AI), Deli AutoResearch

Baixar raw

Custom Agent Skills — Telegram, Web Research, AutoResearch

The Co-Fita Hyper-Harness includes three custom agent skills that extend the base agent capabilities. Each skill follows the Open-Closed principle — open for extension, closed for modification — and integrates with the harness's plugin registry architecture.

Skill Overview

SkillPurposeIntegration Point
telegram-notify skillSend notifications to Alefita via TelegramGovernance, heartbeat, alerts
web-research-pipeline skillTwo-stage research: SearXNG discovery + Crawl4AI comprehensionOrchestrator Phase I (Ideation)
deli-autoresearch skillLong-horizon autonomous task protocolOrchestrator loop, state management

1. Telegram Notify Skill

Purpose

Send messages to Alefita's Telegram channel through the Co-Fita Hyper-Harness infrastructure. This skill implements the "outer loop" communication channel between the autonomous harness and the human leader (Líder Suprema).

Architecture

Agent needs to notify
     │
     ▼
 scripts/telegram_notify.py
 Uses harness_core/plugins.py TelegramGateway
 Reads ~/.hermes/.env for credentials
     │
     ▼
 Telegram Bot API → Alefita's channel

Prerequisites

The ~/.hermes/.env file must contain:

TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_HOME_CHANNEL=your_chat_id_here

Usage

# Simple notification
uv run python scripts/telegram_notify.py --message "Research iteration 3 complete"

# Error alert
uv run python scripts/telegram_notify.py --message "Harness stalled for >2h" --level error

# Chancela request
uv run python scripts/telegram_notify.py \
  --message "Proposal #42: Add LoRA adapter for biomedicine domain" \
  --level chancela \
  --title "Nova Proposta"

# Heartbeat from Deli_AutoResearch
uv run python scripts/telegram_notify.py \
  --message "Iteration 7/∞ | Findings: 23 | Stale: 0" \
  --level heartbeat

Message Levels

LevelEmojiUse Case
infoℹ️General notifications
warning⚠️Non-critical issues
error🚨Critical failures
chancela🏛️Approval requests
heartbeat💓Deli_AutoResearch heartbeat

Integration with Governance

The skill integrates with the governance system to:

  1. Notify when a proposal reaches AWAITING_CHANCELA status
  2. Notify when Congress is convened
  3. Send QuinquennialPlan progress updates
  4. Alert on harness failures captured by event_bus.py

Integration with Deli_AutoResearch

LayerFunction
Heartbeat (L1)Periodic liveness notifications
Stall Escalation (L2)When stale_count >= 4, flag for human attention
Progress ReportsAfter each successful iteration
Structural PivotNotify of new direction after forced pivot

2. Web Research Pipeline Skill

Purpose

A two-stage research skill combining SearXNG (meta-search discovery) with Crawl4AI (deep page reading). This skill supersedes basic search_web for depth-critical research.

Architecture

Agent Question
     │
     ▼
 SearXNG (localhost:8888)
 GET /search?q=...&format=json
 → [{title, url, snippet}, ...]
 Role: DISCOVERY
     │ top-N URLs
     ▼
 Crawl4AI (localhost:11235)
 POST /crawl → {markdown: {raw_markdown, fit_markdown}}
 Role: COMPREHENSION (reads SPAs, renders JS)
     │ clean markdown
     ▼
 Agent ingests full content for reasoning

SearXNG Component

Endpoint: GET http://localhost:8888/search

ParameterRequiredDescription
qYesSearch query
formatYesjson
categoriesNogeneral, science, it, news

Advantages over commercial APIs:

  • No API keys required
  • Zero telemetry
  • Unlimited queries
  • 70+ search engines aggregated

Usage:

uv run python .agents/skills/web_research_pipeline/scripts/searxng_search.py "query"
uv run python .agents/skills/web_research_pipeline/scripts/searxng_search.py "query" --n 10
uv run python .agents/skills/web_research_pipeline/scripts/searxng_search.py "query" --categories science,it

Crawl4AI Component

Endpoint: POST http://localhost:11235/crawl

FeatureCapability
JS RenderingFull Playwright headless browser
Output Formatfit_markdown (noise-filtered) or raw_markdown
SPAsHandles JavaScript-rendered single-page applications
MCP IntegrationExposes /mcp/sse endpoint

Critical Technical Detail:

The markdown field is NOT a plain string. It is a MarkdownGenerationResult dict:

result["markdown"] = {
    "raw_markdown": "# Full page...",
    "fit_markdown": "# Filtered content...",    # Recommended for LLMs
    "markdown_with_citations": "...",
    "references_markdown": "...",
}

Always prefer fit_markdown — it removes boilerplate navigation, ads, and footers.

Usage:

# Read a single URL
uv run python .agents/skills/web_research_pipeline/scripts/crawl4ai_read.py "https://example.com"

# Read with max chars limit
uv run python .agents/skills/web_research_pipeline/scripts/crawl4ai_read.py "https://example.com" --max-chars 5000

# Full pipeline: search + read
uv run python .agents/skills/web_research_pipeline/scripts/research_pipeline.py "transformer architecture 2026"

Extraction Strategies

StrategyCostSpeedBest For
Markdown (default)FreeFastGeneral page reading
JsonCssExtractionFreeVery fastSites with consistent HTML
LLMExtractionLocal GPUSlowUnstructured/complex content
PruningFilterFreeFastRemove boilerplate noise
BM25FilterFreeFastTopic-focused extraction

Integration with Orchestrator

The skill is registered as WebCrawlerRegistry.register("crawl4ai") in harness_core/plugins.py. The orchestrator's Phase I (Ideation) uses the pipeline:

  1. SearXNG discovers relevant URLs
  2. Crawl4AI reads full content of discovered URLs
  3. OpenCode (via ACP) synthesizes and generates hypotheses

3. Deli AutoResearch Skill

Purpose

A protocol framework for long-horizon autonomous tasks (days to weeks). It ships no executable code; instead it prescribes conventions for state persistence, stall detection, guardian layering, and behavioral constraints.

The Three Failure Modes

Failure ModeDescriptionCommon Cause
Cognitive LoopSuccessive iterations try similar directions with diminishing returnsContext accumulation
StallingAgent finishes work, outputs summary, waits for feedbackMissing scaffolding
Runtime FragilityContext compaction silently breaks the loopSession dependencies

Behavioral Constraints

  1. Zero Interaction — No prompting the user during a run; resolve ambiguity yourself
  2. Ready Means Execute — The purpose of preparation is execution; no "should I submit?" questions
  3. Callback Means Report-Alive — First action of every callback: update last_seen, check liveness
  4. Persist State to Files — All progress written to state/ files, not conversation memory
  5. Guardian/Worker Separation — Heartbeat patrol only does liveness-check, restart, nudge

State File Structure

{task}/state/
├── task_spec.md           # goal / milestones / success criteria
├── progress.json          # {iteration, total_findings, status, stale_count}
├── findings.jsonl         # accumulated findings (append-only)
├── directions_tried.json  # directions already tried
└── iteration_log.jsonl    # per-iteration summary

{task}/logs/
├── work.jsonl             # written by work agent; decisions tagged level=decision
├── orchestrator.jsonl     # written by orchestrator
└── heartbeat.jsonl        # written by heartbeat watchdog

Stall Detection and Pivoting

MechanismRule
Stall detection0 new findings or metric drop → stale_count + 1
Forced pivotstale_count >= 2 → change structural constraint
Human escalationstale_count >= 4 → flag for human attention
Direction diversityNew direction must differ from all tried
Round cap15 rounds or 30 minutes per session

Heartbeat Watchdog (Three Layers)

LayerFormDepends onRole
L0Resident shell guardNo sessionheartbeat stale > 2h → emergency patrol
L1Durable cron, hourlyLiving interactive sessioncheck last_seen, restart timeouts
L2Business loopEach its own sessionupdate own last_seen on callback

Validation Results

The framework has been validated on multiple task types:

PaperPagesCitationsSelf-rated
Autonomous Research Agents592288.0/10
Continual Learning653268.0/10
Long-Horizon Decision-Making553848.0/10
Self-Play (285B RL experiment)752178.6/10

Longest continuous run: 72 hours with 6 directional human inputs — zero operational intervention.

Engineering Constraints

  1. At most 5 large files per iteration; no single file over 300 lines
  2. State injected via files, not conversation history
  3. Validation must run between iterations
  4. Citation-like content verified every 20 entries
  5. Prefer diversity over digging one direction deeper
  6. Unresolvable external failures escalate; never abandon silently

Skill Integration Architecture

All three skills integrate via the Open-Closed principle:

┌─────────────────────────────────────────────────┐
│              PLUGIN REGISTRY                     │
│                                                  │
│  NotificationGateway ← telegram_notify           │
│  WebCrawlerRegistry  ← web_research_pipeline     │
│  LearningBackend     ← deli_autoresearch         │
│                                                  │
│  All register on import, no core modification    │
└─────────────────────────────────────────────────┘

Gateway Pattern

Following the Hermes Agent analysis, the skills use an async message router pattern:

Telegram Gateway ←→ Harness Core ←→ SearXNG/Crawl4AI
     ↑                    ↑                ↑
     │                    │                │
  Human Loop        State Files      Research Loop

Cron Integration

The Deli_AutoResearch skill specifies durable cron for heartbeat watchdog:

# Hourly patrol (L1)
hourly patrol: 
  write timestamp
  check each loop's last_seen against interval×3
  restart if exceeded
  check each task's progress for stalls over 2h
  nudge if stalled

Cross-References