# Vertical Farming Mobile Container Agent Skill

> A Claude skill from dungnotnull/vertical-farming-mobile-container-agent-skill.

- **Type:** Skill
- **Install:** `agentstack add skill-dungnotnull-vertical-farming-mobile-container-agent-skill-vertical-farming-mobile-container-agent-skill`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [dungnotnull](https://agentstack.voostack.com/s/dungnotnull)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [dungnotnull](https://github.com/dungnotnull)
- **Source:** https://github.com/dungnotnull/vertical-farming-mobile-container-agent-skill

## Install

```sh
agentstack add skill-dungnotnull-vertical-farming-mobile-container-agent-skill-vertical-farming-mobile-container-agent-skill
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# SKILL.md — Skill Registry Documentation

> **Project:** `vertical-farming-mobile-container` (vfmc)
> **Version:** 1.1.0
> **Purpose:** The single, authoritative reference for how skills are
> **registered, resolved, executed, and validated** in the vfmc agent runtime.

This document describes the modular skill-registry architecture that powers
the vertical-farming harness. The runtime lives in `src/vfmc/agents/`; the
declarative skill specs also exist as markdown in `skills/` for human review
and LLM grounding.

---

## 1. Architecture Overview

```
                ┌──────────────────────────────────────────────┐
                │                 Orchestrator                  │
                │   (src/vfmc/agents/orchestrator.py)           │
                └───────────────┬──────────────────────────────┘
                                │
        ┌───────────────────────┼───────────────────────────┐
        ▼                       ▼                           ▼
┌──────────────┐       ┌──────────────────┐         ┌──────────────┐
│  Router      │       │  HookRegistry    │         │ ToolRegistry │
│ (chain-of-   │       │ (lifecycle hooks)│         │ (JSON-schema │
│  thought)    │       │                  │         │  tools)      │
└──────┬───────┘       └────────┬─────────┘         └──────┬───────┘
       │                        │                          │
       ▼                        ▼                          ▼
┌──────────────────────────────────────────────────────────────┐
│                     SkillRegistry                             │
│   resolves SkillBase instances by name + validates prereqs    │
└──────────────────────────────────────────────────────────────┘
       │
       ▼
┌─────────────────────────────────────────────────────────────┐
│  Skills (SkillBase subclasses)                                │
│  sub-gather-requirements → sub-evidence-collector →          │
│  sub-core-analysis → sub-knowledge-updater → sub-advisor     │
└─────────────────────────────────────────────────────────────┘
```

### Design principles

1. **Modular skill-registry pattern.** Adding a skill is a registration, not
   a refactor. Each skill is a self-contained `SkillBase` subclass with a
   declared input/output JSON schema and a quality gate.
2. **Chain-of-thought router.** The router emits an explicit reasoning trace
   that selects which skills to run, in what order, and which to skip.
3. **Tools as the only I/O boundary.** Sub-agents never touch the network or
   filesystem directly; they call schema-validated tools via `ToolRegistry`.
4. **Lifecycle hooks cross-cut every step.** Logging, metrics, degradation,
   token-budget guards, state sync, and audit trail are reusable hooks.
5. **Fail-fast configuration.** `src/vfmc/config/` validates the full config
   (env vars, LLM params, feature flags) at load time.
6. **Graceful degradation, never fabrication.** Every degraded run emits an
   explicit `LIMITATION NOTICE`; the universal gates (U1–U6) and domain gates
   (G1–G4) are enforced after the pipeline.

---

## 2. Core Types

### 2.1 `SkillBase` (abstract contract)

```python
class SkillBase(ABC):
    name: str                       # unique registry key, e.g. "sub-core-analysis"
    step: str                       # harness step number, e.g. "3"
    description: str
    category: str                   # intake | evidence | domain | knowledge | synthesis | general
    requires: list[str]             # prerequisite skill names
    input_schema: dict              # JSON Schema for the skill's inputs
    output_schema: dict             # JSON Schema for the skill's outputs
    feature_flag: str | None        # FeatureFlags attribute gating this skill

    def execute(self, context: AgentContext) -> SkillResult: ...
    def evaluate_gates(self, context, result) -> list[dict]: ...
```

### 2.2 `SkillResult`

```json
{
  "skill_name": "sub-core-analysis",
  "step": "3",
  "status": "ok",                  // ok | degraded | error
  "output": { /* skill-specific */ },
  "gate_passed": true,
  "gate_failures": [],
  "degradation_level": 0,
  "tokens_used": 6000,
  "elapsed_ms": 42.5,
  "error": null
}
```

### 2.3 `AgentContext`

The mutable cross-step state shared by the orchestrator and every sub-agent:

| Field | Type | Purpose |
|-------|------|---------|
| `run_id` | str | Unique run identifier |
| `user_query` | str | The originating user message |
| `language` | str | Detected output language (en/vi) |
| `climate_zone`, `crop_type`, `racking_layers` | enum/int | Parsed requirements |
| `requirements` | `Requirements` | Structured intake output |
| `evidence` | `EvidenceBundle` | Step-2 evidence bundle |
| `analysis` | `AnalysisResult` | Step-3 simulation result |
| `knowledge_citations` | list[dict] | Step-4 citations |
| `degradation_level` | int (0–4) | Current degradation level |
| `limitation_banner` | str | Auto-set when degraded |
| `gate_failures` | list[dict] | All gate failures this run |
| `logs`, `events` | list | Structured log + event streams |
| `budget` | `TokenBudget` | Token accounting |
| `extra` | dict | Hook scratchpad (metrics, audit) |

---

## 3. Registered Skills

The default registry (`default_registry`) registers five canonical skills
mirroring `skills/sub-*.md`. They run in order; each declares its prerequisites.

| Step | Skill name | Category | Requires | Feature flag | Quality gates |
|------|------------|----------|----------|--------------|---------------|
| 1 | `sub-gather-requirements` | intake | — | — | intake.object_confirmed |
| 2 | `sub-evidence-collector` | evidence | sub-gather-requirements | web_search_enabled | evidence.min_sources |
| 3 | `sub-core-analysis` | domain | sub-gather-requirements, sub-evidence-collector | simulation_engine_enabled | G1, G2, G3 |
| 4 | `sub-knowledge-updater` | knowledge | sub-core-analysis | knowledge_crawl_enabled | knowledge.min_academic |
| 5 | `sub-advisor` | synthesis | sub-core-analysis, sub-knowledge-updater | — | verdict_valid, U2, G4 |

### Input/Output JSON Schemas (summary)

**sub-gather-requirements**
- Input: `{ "user_query": string }`
- Output: `{ "object_of_analysis": string, "climate_zone": string, "crop_type": string,
  "racking_layers": integer, "language": string, "power_budget_kw": number|null,
  "water_budget_l_day": number|null }`

**sub-evidence-collector**
- Input: `{ "requirements": object }`
- Output: `{ "current_data": array, "authoritative_docs": array, "recent_news": array,
  "reference_benchmarks": array, "web_status": string }`

**sub-core-analysis**
- Input: `{ "climate_zone": string, "crop_type": string, "racking_layers": integer,
  "language": string }`
- Output: `{ "verdict": string, "led_plan": array, "climate_control": object,
  "hydroponic_design": object, "resource_efficiency": object, "scenarios": array }`

**sub-knowledge-updater**
- Input: `{ "keywords": array, "limit": integer }`
- Output: `{ "citations": array, "coverage": string, "gaps": array, "search_status": string }`

**sub-advisor**
- Input: `{ "analysis": object, "citations": array }`
- Output: `{ "verdict": string, "evidence_chain": array, "key_risks": array,
  "disclosure": array, "recommended_actions": array, "scenarios": array,
  "degradation_level": integer }`

Full JSON Schemas are in `assets/schemas/skill.schema.json` (for the skill
contract) and the per-skill `input_schema`/`output_schema` declared on each
`SkillBase` subclass.

---

## 4. Registration, Resolution, Execution, Validation

### 4.1 Registration

```python
from vfmc.agents.registry import default_registry

registry = default_registry()        # pre-loads the 5 canonical skills
# Or register a custom skill:
registry.register(MyCustomSkill(tools=registry.tools, hooks=registry.hooks))
# Or lazily via factory:
registry.register_factory("my-skill", lambda t, h: MyCustomSkill(tools=t, hooks=h))
```

Duplicate names raise `ValueError`. Prerequisites are validated by
`registry.validate_prerequisites()`, which returns a list of any missing
prerequisite skills.

### 4.2 Resolution

```python
skill = registry.get("sub-core-analysis")     # None if missing
skill = registry.require("sub-core-analysis") # raises KeyError if missing
```

### 4.3 Execution

The orchestrator is the only entry point that executes skills:

```python
from vfmc.agents import Orchestrator
report = Orchestrator().run("analyze arctic lettuce 4 layers 10kw")
```

The orchestrator:
1. Builds a fresh `AgentContext`.
2. Asks the router for the execution plan.
3. Fires `pre_step` hooks, runs the skill (with retries), fires `post_step` /
   `on_step_error` / `on_degradation` hooks.
4. Runs the universal quality gates U1–U6 after the pipeline.
5. Fires `on_finalize` + `post_run` hooks.
6. Returns a serializable `RunReport`.

### 4.4 Validation

Three layers of validation run on every invocation:

1. **Per-skill quality gates** (e.g. `G1.led_per_stage`, `U2.disclosure_first`)
   evaluate after each skill. Each gate has an auto-fix callable and a retry
   cap (`max_retries`, default 2). Failures are recorded on the context and
   surfaced in `SkillResult.gate_failures`.
2. **Universal quality gates U1–U6** run at the harness level after the
   pipeline (see §5).
3. **Schema validation** for tool inputs (`Tool.validate_input`) and the
   `assets/schemas/*.schema.json` files (validated by
   `scripts/validate_schemas.py` and the test suite).

---

## 5. Quality Gates

### Universal gates (U1–U6) — enforced by the orchestrator

| Gate | Check | Enforcement |
|------|-------|-------------|
| U1 | ≥3 sources cited, ≥1 academic/authoritative | record failure if not met |
| U2 | Disclosure present before recommendation | record failure if not met |
| U3 | Evidence hierarchy (tier label) per source | record failure if not met |
| U4 | Language matches detected user preference | record failure if not met |
| U5 | All output sections present | record failure if not met |
| U6 | Every claim traceable to ≥1 source | record failure if not met |

### Domain gates (G1–G4) — enforced by the relevant sub-skill

| Gate | Skill | Check |
|------|-------|-------|
| G1 | sub-core-analysis | LED spectrum & DLI per growth stage (≥3 stages, blue/red/far-red) |
| G2 | sub-core-analysis | Climate control targets stated (VPD, CO2, T, RH) |
| G3 | sub-core-analysis | Resource efficiency quantified (water L/kg, energy kWh/kg, yield kg/m2/yr) |
| G4 | sub-advisor | ≥2 Tier-1 authoritative sources cited |

Each gate: on failure, run auto-fix; after 2 failed retries, record the
limitation explicitly and continue. The harness never silently proceeds.

---

## 6. Tools (the I/O boundary)

Tools are registered in `ToolRegistry` and gated by feature flags. Each tool
declares a JSON Schema for its input and a deterministic handler returning a
plain dict (never raising on expected failures).

| Tool | Category | Side effects | Feature flag | Description |
|------|----------|--------------|--------------|-------------|
| `simulate_farm` | simulation | no | simulation_engine_enabled | Run the deterministic engine for climate×crop |
| `knowledge_search` | knowledge | no | knowledge_crawl_enabled | Search SECOND-KNOWLEDGE-BRAIN.md |
| `knowledge_append` | knowledge | yes | knowledge_auto_append | Append entries to the knowledge base |
| `knowledge_crawl` | knowledge | yes | knowledge_crawl_enabled | Crawl ArXiv/Scholar/RSS |
| `web_search` | web | no | web_search_enabled | Live web search (synthetic offline fallback) |
| `web_fetch` | web | no | web_fetch_enabled | Fetch URL content |
| `compile_evidence` | knowledge | no | — | Build an EvidenceBundle from raw sources |
| `climate_profile` | reference | no | — | Default climate profile for a zone |
| `crop_profile` | reference | no | — | Default crop profile for a crop type |

Tool definitions are emitted by `ToolRegistry.to_dict()` / `.to_json()` and
validated against `assets/schemas/tool.schema.json` by the test suite.

`ToolRegistry.invoke(name, params, ctx, flags)` enforces: unknown tool →
`{"status":"error"}`; disabled feature flag → `{"status":"disabled"}`;
retryable tools retry up to `max_retries`.

---

## 7. Hooks (lifecycle)

`HookRegistry` dispatches callables at well-defined phases. Built-in hooks
(`vfmc.agents.hooks.default_registry`) provide baseline observability:

| Phase | Built-in hooks |
|-------|----------------|
| `pre_run` | audit_trail |
| `pre_step` | logging, token_budget_guard |
| `post_step` | metrics, state_sync, audit_trail |
| `on_step_error` | logging |
| `on_gate_failure` | audit_trail |
| `on_degradation` | degradation (escalate + banner), audit_trail |
| `post_run` | metrics, audit_trail |
| `on_finalize` | state_sync, audit_trail |

Custom hooks register via `registry.register("post_step", my_hook)`. Hook
exceptions are caught and logged (never crash the run) unless they raise
`HookError` (e.g. token-budget exhaustion → graceful degradation).

---

## 8. Router (chain-of-thought)

`ChainOfThoughtRouter.plan(query)` returns a `RoutingDecision` with:

- `skills`: ordered list of skill names to run
- `skipped`: skills skipped (with reason in `reasoning`)
- `reasoning`: explicit, ordered reasoning trace
- `short_circuit`: true for trivial lookups (e.g. "list zones")

The router:
1. Detects trivial lookups and short-circuits (no analysis pipeline).
2. Starts from the full 5-skill pipeline.
3. Skips skills whose feature flag is disabled.
4. Drops skills whose prerequisites were skipped.
5. Guarantees `sub-core-analysis` is present for any analysis query.

---

## 9. Configuration (`src/vfmc/config/`)

Type-safe, validated configuration with three priority layers:

1. **Environment variables** (prefix `VFMC_`, nested via `__`, e.g.
   `VFMC_FLAGS_WEB_SEARCH_ENABLED=false`).
2. **Config file** (`config/settings.yaml`, path override via `VFMC_CONFIG`).
3. **Built-in defaults** (`SystemDefaults`).

```python
from vfmc.config import get_config
cfg = get_config()
cfg.llm.server              # LLMServer.SIMULATION
cfg.flags.web_search_enabled  # True
cfg.agent.max_sub_agent_retries  # 2
```

`validate_config(config)` enforces cross-field rules (token budget ordering,
temperature range, degradation floor/ceiling, evidence minimums) and raises
`ValueError` on any violation. Config schemas: `assets/schemas/system-config.schema.json`.

---

## 10. End-to-End Run

```python
from vfmc.agents import run_harness
report = run_harness("analyze arctic lettuce 4 layers 10kw")
# report.verdict           -> "Feasible & Efficient"
# report.universal_gates    -> {"U1": True, ..., "U6": True}
# report.degradation_level -> 2 (offline web fallback)
# report.limitation_banner  -> "LIMITATION NOTICE: ..."
# report.output             -> structured analysis dict
```

CLI equivalent:

```bash
python scripts/run_harness.py "analyze arctic lettuce 4 layers 10kw" --pretty
# or via the installed entry point:
vfmc analyze --query "analyze arctic lettuce 4 layers 10kw"
```

---

## 11. Testing the Registry

```bash
python -m pytest tests/test_agents.py tests/test_config.py -q
```

The test suite exercises:
- Tool input validation (good + bad params)
- Hook firing across all phases
- Skill registry resolution + prerequisite validation
- Router planning (full pipeline, trivial short-circuit, flag-disabled skips)
- Orchestrator end-to-end with all universal gates passing
- Config loading from YAML + env overrides + validation errors

---

## 12. File Map

| Path | Purpose |
|------|---------|
| `src/vfmc/agents/context.py` | `AgentContext`, `TokenBudget`, `LogEntry` |
| `src/vfmc/agents/base.py` | `SkillBase`, `SkillResult`, `QualityGate` |
| `src/vfmc/agents/hooks.py` | `HookRegistry` + built-in hooks |
| `src/vfmc/agents/tools.py` | `Tool`, `ToolRegistry` + built-in tools |
| `src/vfmc/agents/registry.py` | `SkillRegistry`, `default_registry` |
| `src/vfmc/agents/router.py` | `ChainOfThoughtRouter`, `RoutingDecision` |
| `src/vfmc/agents/orchestrator.py` | `Orchestrator`, `RunReport`, `run_har

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [dungnotnull](https://github.com/dungnotnull)
- **Source:** [dungnotnull/vertical-farming-mobile-container-agent-skill](https://github.com/dungnotnull/vertical-farming-mobile-container-agent-skill)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-dungnotnull-vertical-farming-mobile-container-agent-skill-vertical-farming-mobile-container-agent-skill
- Seller: https://agentstack.voostack.com/s/dungnotnull
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
