# Mangrove Forest Ai Conservation

> AI-Based Mangrove Forest Monitoring & Conservation — Professional-grade harness for evidence-backed mangrove forest analysis with remote sensing, deforestation detection, health assessment, blue carbon estimation, and restoration planning. Use this skill when users mention mangrove forests, coastal ecosystems, satellite monitoring, deforestation analysis, blue carbon, conservation planning, resto…

- **Type:** Skill
- **Install:** `agentstack add skill-dungnotnull-mangrove-forest-ai-conservation-agent-skill-mangrove-forest-ai-conservation-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/mangrove-forest-ai-conservation-agent-skill

## Install

```sh
agentstack add skill-dungnotnull-mangrove-forest-ai-conservation-agent-skill-mangrove-forest-ai-conservation-agent-skill
```

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

## About

# Mangrove Forest AI Conservation Skill

## Skill Registry & Metadata

| Property | Value |
|----------|-------|
| **Skill ID** | `mangrove-forest-ai-conservation` |
| **Version** | 1.0.0 |
| **Status** | Production Ready |
| **Primary Domain** | Mangrove Forest Remote Sensing & Conservation |
| **Dependencies** | Python 3.11+, Claude Code with skill support |
| **Compatibility** | Claude Code, Claude.ai (with adaptations) |

## Skill Resolution & Execution

### Resolution Path

When a user invokes `/mangrove-forest-ai-conservation`, Claude Code resolves this skill through:

1. **Name Resolution**: Matches skill name in available skills registry
2. **File Location**: Loads `skills/main.md` as entry point
3. **Dependency Check**: Verifies SECOND-KNOWLEDGE-BRAIN.md availability
4. **Language Detection**: Pre-flight Vietnamese/English detection
5. **Sub-Skill Chain**: Sequentially invokes required sub-skills

### Input Schema

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "MangroveConservationInput",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "User's analysis request",
      "examples": [
        "Analyze mangrove forest extent and health in the Mekong Delta",
        "Assess deforestation rates in the Sundarbans from 2015 to present"
      ]
    },
    "language": {
      "type": "string",
      "enum": ["en", "vi", "auto"],
      "default": "auto",
      "description": "Output language (English/Vietnamese/auto-detect)"
    },
    "region": {
      "type": "string",
      "description": "Geographic region for analysis (optional if specified in query)"
    },
    "timeframe": {
      "type": "string",
      "description": "Analysis timeframe (optional)"
    },
    "analysis_type": {
      "type": "string",
      "enum": ["standard", "deforestation", "restoration", "carbon", "health", "comprehensive"],
      "default": "comprehensive"
    }
  },
  "required": ["query"]
}
```

### Output Schema

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "MangroveConservationReport",
  "type": "object",
  "properties": {
    "report_type": {
      "type": "string",
      "const": "AI-Based Mangrove Forest Monitoring & Conservation — Report"
    },
    "metadata": {
      "type": "object",
      "properties": {
        "date": {"type": "string", "format": "date"},
        "analyst": {"type": "string", "pattern": "^mangrove-forest-ai-conservation v"},
        "language": {"type": "string", "enum": ["English", "Tiếng Việt"]}
      }
    },
    "executive_summary": {"type": "string"},
    "inputs_scope": {
      "type": "object",
      "properties": {
        "region": {"type": "string"},
        "timeframe": {"type": "string"},
        "analysis_type": {"type": "string"}
      }
    },
    "evidence_collected": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "source": {"type": "string"},
          "tier": {"type": "string", "enum": ["Tier 1", "Tier 2", "Tier 3", "Tier 4"]},
          "date": {"type": "string"},
          "findings": {"type": "string"}
        }
      }
    },
    "analysis_scorecard": {
      "type": "object",
      "properties": {
        "extent_change": {"type": "string"},
        "deforestation_hotspots": {"type": "string"},
        "health_status": {"type": "string"},
        "species_composition": {"type": "string"},
        "blue_carbon": {"type": "string"},
        "restoration_suitability": {"type": "string"}
      }
    },
    "academic_evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "citation": {"type": "string"},
          "tier": {"type": "string"},
          "relevance": {"type": "string"}
        }
      }
    },
    "disclosure_limitations": {"type": "string"},
    "verdict": {
      "type": "string",
      "enum": [
        "Strong Conservation Plan",
        "Conditional (data gaps)",
        "High Degradation",
        "Inconclusive"
      ]
    },
    "scenarios": {
      "type": "object",
      "properties": {
        "best": {"type": "string"},
        "base": {"type": "string"},
        "worst": {"type": "string"}
      }
    },
    "quality_gates_passed": {
      "type": "array",
      "items": {"type": "string", "pattern": "^[UuG][1-6]$"}
    }
  },
  "required": ["report_type", "metadata", "executive_summary", "verdict", "disclosure_limitations"]
}
```

## Harness Architecture

```
┌─────────────────────────────────────────────────────────────────┐
│                     USER INPUT                                   │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 0] Pre-Flight: Language Detection & Input Validation      │
│  Detect Vietnamese/English → Validate input schema               │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 1] sub-gather-requirements                               │
│  Clarify object, scope, timeframe, inputs, audience, language   │
│  Quality Gate: ≥1 object confirmed                              │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 2] sub-evidence-collector                                │
│  Fetch authoritative real-time and reference data                │
│  Quality Gate: current data + 1 doc OR limitation flag          │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 3] sub-core-analysis                                     │
│  Execute extent mapping, deforestation detection, health          │
│  assessment, carbon estimation, restoration planning             │
│  Quality Gate: extent + deforestation + health + carbon           │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 4] sub-knowledge-updater                                 │
│  Query SECOND-KNOWLEDGE-BRAIN.md for academic evidence           │
│  Quality Gate: ≥1 academic source + coverage rating              │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 5] sub-advisor                                            │
│  Synthesize verdict, scenarios, risks, evidence chain            │
│  Quality Gate: verdict in set + disclosure before conclusion     │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│  [STEP 6] Quality Gate Review (Main Harness)                     │
│  Verify U1-U6 + G1-G4 with auto-fix & enforcement               │
│  Exit: All gates pass OR explicit limitation flagged             │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│                   FINAL OUTPUT DELIVERY                          │
│  Full report with evidence citations, disclosure, scenarios      │
└─────────────────────────────────────────────────────────────────┘
```

## Validation & Quality Assurance

### Quality Gates

**Universal Gates (U1-U6)**:
- U1: ≥3 sources cited, ≥1 academic/authoritative
- U2: Disclosure/limitations before recommendation
- U3: Evidence hierarchy stated per source (Tier 1-4)
- U4: Language matches user preference
- U5: Output uses declared template (all sections)
- U6: Every claim traceable to ≥1 source or flagged

**Domain Gates (G1-G4)**:
- G1: Extent mapped with AI/satellite
- G2: Deforestation/degradation detected
- G3: Health & blue carbon assessed
- G4: Restoration suitability & threats identified

### Auto-Fix Logic

Each gate has:
- **Auto-Fix Procedure**: Action to remediate failed gate
- **Max Retries**: 2 attempts per gate
- **Fallback Strategy**: Explicit limitation flag on failure
- **Enforcement Level**: Block / Warn / Continue

### Output Validation

The skill validates output against:
1. **Structural Validation**: All required sections present
2. **Content Validation**: Minimum evidence thresholds met
3. **Schema Validation**: Output matches declared JSON schema
4. **Language Validation**: Output language matches detection
5. **Disclosure Validation**: Limitations appear before recommendations

## Error Handling & Graceful Degradation

### Degradation Levels

| Level | Description | Limitation Banner |
|-------|-------------|-------------------|
| 0 | Full data available | None |
| 1 | Some secondary sources unavailable | Minor limitation notice |
| 2 | Primary sources degraded | Moderate limitation notice |
| 3 | Most sources unavailable | Severe limitation notice |
| 4 | All sources failed | Critical limitation + DATA UNAVAILABLE |

### Error Recovery

Each sub-skill implements:
1. **Primary Source Attempt**: Try authoritative sources first
2. **Fallback Chain**: Secondary → Knowledge base → Cached data
3. **Explicit Flagging**: Clear DATA UNAVAILABLE markers
4. **Never Silent**: Always indicate what's missing

## Integration Points

### Required Files

- `skills/main.md` — Main harness orchestrator
- `skills/sub-*.md` — Domain sub-skills (5 files)
- `SECOND-KNOWLEDGE-BRAIN.md` — Living knowledge base
- `tools/knowledge_updater.py` — Crawl pipeline

### Optional Integration

- `config/settings.yaml` — Configuration management
- `references/*.md` — Domain knowledge templates
- `scripts/*.py` — Automation utilities
- `hooks/*.py` — Lifecycle event handlers

### External APIs

- Global Mangrove Watch (web scraping)
- Semantic Scholar (academic search)
- ArXiv (preprint server)
- Domain RSS feeds (news updates)

## Configuration Management

Configuration is loaded from multiple sources in priority order:

1. **Environment Variables**: Override all other settings
2. `config/settings.yaml`: Project-specific configuration
3. `config/defaults.yaml`: Default fallback settings
4. Hardcoded defaults in `KNOWLEDGE_CONFIG`

### Configuration Schema

```yaml
# config/settings.yaml
language:
  default: en
  fallback: en

analysis:
  default_type: comprehensive
  max_sources: 10
  min_academic_sources: 1

knowledge_update:
  enabled: true
  weekly_schedule: "0 8 * * 1"
  daily_schedule: "0 7 * * *"

data_sources:
  timeout_seconds: 30
  retry_attempts: 3
  fallback_to_cache: true

quality_gates:
  strict_mode: false
  auto_fix_enabled: true
  max_retries: 2
```

## Lifecycle Hooks

### Available Hook Points

| Hook Point | Description | Use Case |
|-----------|-------------|----------|
| `pre_analysis` | Before step 1 | Input validation, logging |
| `post_requirements` | After step 1 | Requirements confirmation |
| `post_evidence` | After step 2 | Data quality check |
| `post_analysis` | After step 3 | Intermediate results |
| `post_knowledge` | After step 4 | Citation validation |
| `pre_delivery` | Before step 6 | Final quality checks |
| `post_delivery` | After output | Notification, metrics |

### Hook Implementation

Hooks are Python modules in `hooks/` directory with `execute(context)` function:

```python
# hooks/example_hook.py
def execute(context: dict) -> dict:
    """Hook execution function
    
    Args:
        context: Analysis context with step, data, config
    
    Returns:
        Modified context or None for no changes
    """
    # Hook logic here
    return context
```

## Performance Optimization

### Token Management

- **Progressive Disclosure**: Load reference files on-demand
- **Caching Strategy**: Cache external API responses for 24h
- **Batch Operations**: Aggregate multiple API calls when possible
- **Compression**: Use compact JSON for intermediate data

### Execution Optimization

- **Parallel Sub-Skills**: Independent sub-skills run in parallel where possible
- **Early Exit**: Skip unnecessary analysis based on requirements
- **Lazy Loading**: Load heavy resources only when needed
- **Result Caching**: Cache analysis results for similar queries

## Testing & Validation

### Test Coverage

- **Unit Tests**: Individual sub-skill validation
- **Integration Tests**: Full harness execution
- **Scenario Tests**: 5+ comprehensive scenarios
- **Edge Cases**: Degraded mode, minimal input, conflicts

### Test Execution

```bash
# Run all tests
python tools/run_test_scenarios.py

# Run specific test
python tools/run_test_scenarios.py --scenario standard

# Dry run test
python tools/run_test_scenarios.py --dry-run
```

## Contributing & Extension

### Adding New Analysis Methods

1. Define method in `sub-core-analysis.md`
2. Add quality gate in `main.md`
3. Create test scenario in `tests/test-scenarios.md`
4. Update `SECOND-KNOWLEDGE-BRAIN.md` with references

### Adding New Data Sources

1. Update `KNOWLEDGE_CONFIG` in `tools/knowledge_updater.py`
2. Add fallback logic in `sub-evidence-collector.md`
3. Update data sources table in `README.md`
4. Test with degraded source scenarios

## Version History

| Version | Date | Changes |
|---------|------|---------|
| 1.0.0 | 2026-07-27 | Initial production release |

## License

MIT License — See LICENSE file for details

## Contact & Support

- **Issues**: GitHub Issues
- **Documentation**: README.md
- **Technical Spec**: PROJECT-detail.md

## 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/mangrove-forest-ai-conservation-agent-skill](https://github.com/dungnotnull/mangrove-forest-ai-conservation-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-mangrove-forest-ai-conservation-agent-skill-mangrove-forest-ai-conservation-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%.
