# Historical Cadastral Map Restoration

> Restoration & Digitization of Historical Cadastral Maps — Production-grade evidence-backed analysis harness for Historical Cartography Restoration & GIS Digitization with flexible agent/skill architecture, comprehensive quality gates, and self-improving knowledge pipeline.

- **Type:** Skill
- **Install:** `agentstack add skill-dungnotnull-historical-cadastral-map-restoration-agent-skill-historical-cadastral-map-restoration-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/historical-cadastral-map-restoration-agent-skill

## Install

```sh
agentstack add skill-dungnotnull-historical-cadastral-map-restoration-agent-skill-historical-cadastral-map-restoration-agent-skill
```

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

## About

# Historical Cadastral Map Restoration — Skill Registry

## Overview

`historical-cadastral-map-restoration` is a production-grade harness that transforms Claude into a domain expert in **Historical Cartography Restoration & GIS Digitization**. It combines:

- **Real-time evidence aggregation** from authoritative sources
- **Recognized domain methods** for conservation, digitization, and georeferencing
- **Academic research integration** with tiered evidence hierarchy
- **Self-improving knowledge pipeline** with automated crawl
- **Flexible agent/skill architecture** with graceful degradation
- **Comprehensive quality gates** with auto-fix and enforcement

## Architecture

```
┌─────────────────────────────────────────────────────────────────┐
│                    USER INPUT                                    │
│  /historical-cadastral-map-restoration [query]                  │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                    MAIN HARNESS                                   │
│  skills/main.md — orchestrates 6-step execution protocol         │
└─────────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        │                     │                     │
        ▼                     ▼                     ▼
┌──────────────┐    ┌──────────────┐    ┌──────────────┐
│  Step 1      │    │  Step 2      │    │  Step 3      │
│  REQUIREMENTS │    │  EVIDENCE    │    │  CORE        │
│  gather      │    │  collector   │    │  analysis    │
└──────────────┘    └──────────────┘    └──────────────┘
        │                     │                     │
        └─────────────────────┼─────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        │                     │                     │
        ▼                     ▼                     ▼
┌──────────────┐    ┌──────────────┐    ┌──────────────┐
│  Step 4      │    │  Step 5      │    │  Step 6      │
│  KNOWLEDGE   │    │  ADVISOR    │    │  QUALITY     │
│  updater     │    │  synthesizer │    │  GATE        │
└──────────────┘    └──────────────┘    └──────────────┘
                              │
                              ▼
                    ┌──────────────────┐
                    │   FINAL OUTPUT   │
                    │  Risk-disclosed  │
                    │  Evidenced report │
                    └──────────────────┘
```

## Skill Registration

### Main Skill

**Path:** `skills/main.md`
**Name:** `historical-cadastral-map-restoration`
**Trigger:** `/historical-cadastral-map-restoration [query]`

The main harness orchestrates all sub-skills through a 6-step protocol with pre-flight language detection and quality gate enforcement.

### Sub-Skills

| Sub-Skill | File | Purpose | Trigger |
|-----------|------|---------|---------|
| `sub-gather-requirements` | `skills/sub-gather-requirements.md` | Clarify analysis object, constraints, inputs, audience, language | Auto-invoked by main |
| `sub-evidence-collector` | `skills/sub-evidence-collector.md` | Fetch authoritative real-time and reference data | Auto-invoked by main |
| `sub-core-analysis` | `skills/sub-core-analysis.md` | Restore and digitize historical cadastral maps | Auto-invoked by main |
| `sub-knowledge-updater` | `skills/sub-knowledge-updater.md` | Query knowledge base for academic evidence | Auto-invoked by main |
| `sub-advisor` | `skills/sub-advisor.md` | Synthesize into risk-disclosed conclusion | Auto-invoked by main |

### Skill Resolution

Skills are resolved through the standard Claude Code skill mechanism:

1. **Frontmatter parsing:** Each skill file starts with YAML frontmatter defining `name` and `description`
2. **Skill directory:** All skills live in `skills/` directory
3. **Invocation:** Use `Skill("skill-name")` tool to invoke
4. **Sequential execution:** Main orchestrates sub-skills in strict order
5. **Gate enforcement:** Each step must pass its internal gate before proceeding

## Input/Output Schemas

### Main Skill Input Schema

```json
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "User's request for historical cadastral map restoration and digitization",
      "examples": [
        "Analyze this historical cadastral map from 1920s Hanoi",
        "Digitize and georeference the land parcel map",
        "Compare historical and current boundaries for District 1"
      ]
    },
    "language": {
      "type": "string",
      "enum": ["vi", "en", "auto"],
      "default": "auto",
      "description": "Output language (Vietnamese, English, or auto-detect)"
    },
    "files": {
      "type": "array",
      "items": {"type": "string"},
      "description": "Optional file paths for map images or reference documents"
    }
  },
  "required": ["query"]
}
```

### Requirements Schema (Step 1 Output)

```json
{
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "description": "Primary object of analysis (e.g., specific map, region, timeframe)"
    },
    "scope": {
      "type": "string",
      "enum": ["full_restoration", "digitization_only", "georeferencing_only", "comparison", "assessment"],
      "description": "Analysis scope boundaries"
    },
    "timeframe": {
      "type": "object",
      "properties": {
        "historical_period": {"type": "string"},
        "target_completion": {"type": "string"}
      }
    },
    "available_inputs": {
      "type": "array",
      "items": {"type": "string"},
      "description": "Available maps, documents, GIS data, control points"
    },
    "target_audience": {
      "type": "string",
      "enum": ["practitioner", "researcher", "decision_maker", "learner", "general"]
    },
    "language": {
      "type": "string",
      "enum": ["vi", "en"]
    },
    "analysis_type": {
      "type": "string",
      "enum": ["combined", "conservation", "digitization", "georeferencing", "extraction", "comparison"],
      "default": "combined"
    }
  },
  "required": ["object", "language"]
}
```

### Evidence Bundle Schema (Step 2 Output)

```json
{
  "type": "object",
  "properties": {
    "current_data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "source": {"type": "string"},
          "data": {"type": "object"},
          "timestamp": {"type": "string"},
          "tier": {"type": "integer", "minimum": 1, "maximum": 4}
        }
      }
    },
    "authoritative_docs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {"type": "string"},
          "url": {"type": "string"},
          "type": {"type": "string"},
          "tier": {"type": "integer", "minimum": 1, "maximum": 4}
        }
      }
    },
    "recent_news": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {"type": "string"},
          "url": {"type": "string"},
          "date": {"type": "string"},
          "summary": {"type": "string"}
        }
      }
    },
    "reference_benchmarks": {
      "type": "object",
      "description": "Cached benchmarks from SECOND-KNOWLEDGE-BRAIN.md"
    }
  }
}
```

### Core Analysis Schema (Step 3 Output)

```json
{
  "type": "object",
  "properties": {
    "condition_assessment": {
      "type": "object",
      "properties": {
        "material": {"type": "string"},
        "damage_types": {"type": "array", "items": {"type": "string"}},
        "severity": {"type": "string", "enum": ["minimal", "moderate", "severe"]},
        "conservation_plan": {"type": "string"}
      }
    },
    "digitization": {
      "type": "object",
      "properties": {
        "resolution_dpi": {"type": "integer"},
        "color_profile": {"type": "string"},
        "file_format": {"type": "string"},
        "storage_path": {"type": "string"}
      }
    },
    "georeferencing": {
      "type": "object",
      "properties": {
        "control_points": {"type": "integer"},
        "transformation": {"type": "string"},
        "rmse_meters": {"type": "number"},
        "confidence": {"type": "string"}
      }
    },
    "feature_extraction": {
      "type": "object",
      "properties": {
        "parcels_extracted": {"type": "integer"},
        "toponyms_extracted": {"type": "integer"},
        "method": {"type": "string"}
      }
    },
    "gis_integration": {
      "type": "object",
      "properties": {
        "layers_created": {"type": "array", "items": {"type": "string"}},
        "metadata_standard": {"type": "string"},
        "topology_valid": {"type": "boolean"}
      }
    }
  }
}
```

### Final Output Schema

```json
{
  "type": "object",
  "properties": {
    "report": {
      "type": "object",
      "properties": {
        "title": {"type": "string"},
        "date": {"type": "string"},
        "language": {"type": "string"},
        "version": {"type": "string"},
        "executive_summary": {"type": "string"},
        "inputs_and_scope": {"type": "object"},
        "evidence_collected": {"type": "array"},
        "analysis_scorecard": {"type": "object"},
        "action_plan": {"type": "array"},
        "academic_evidence": {"type": "array"},
        "disclosure": {"type": "string"},
        "recommendation": {
          "type": "object",
          "properties": {
            "verdict": {
              "type": "string",
              "enum": [
                "Accurately Restored & Georeferenced",
                "Conditional (control points)",
                "Poor Accuracy",
                "Inconclusive"
              ]
            },
            "scenarios": {"type": "array"},
            "key_risks": {"type": "array"},
            "evidence_chain": {"type": "array"},
            "remediation": {"type": "string"}
          }
        },
        "gate_checklist": {"type": "object"}
      }
    },
    "metadata": {
      "type": "object",
      "properties": {
        "degradation_level": {"type": "integer", "minimum": 0, "maximum": 4},
        "sources_used": {"type": "integer"},
        "execution_time_seconds": {"type": "number"},
        "gates_passed": {"type": "array"},
        "gates_failed": {"type": "array"}
      }
    }
  }
}
```

## Quality Gates

### Universal Gates (U1-U6)

Applied to ALL outputs regardless of domain:

| Gate | Criterion | Auto-Fix | Enforcement |
|------|-----------|----------|-------------|
| U1 | ≥3 sources cited, ≥1 academic/authoritative | Fetch from knowledge base | Append before delivery |
| U2 | Disclosure before recommendation | Prepend standard | Block until present |
| U3 | Evidence hierarchy per source (Tier 1-4) | Annotate tiers | Tag each source |
| U4 | Language matches user preference | Translate | Auto-detect on pre-flight |
| U5 | Output uses template (all sections) | Reformat | Check sections present |
| U6 | Claims traceable to source or flagged | Mark unsupported | Flag each claim |

### Domain Gates (G1-G4)

Historical Cartography & GIS Digitization specific:

| Gate | Criterion | Auto-Fix | Enforcement |
|------|-----------|----------|-------------|
| G1 | Condition assessed & conservation planned | Run assessment | Verify conservation plan |
| G2 | Georeferenced with RMSE reported | Compute georeferencing | Verify RMSE value |
| G3 | Features (parcels/toponyms) extracted | Run extraction | Verify feature count |
| G4 | GIS integration & metadata present | Add GIS layers | Verify metadata standard |

### Gate Enforcement Logic

```
FOR EACH gate IN ordered_gate_list:
    status = check(gate)
    IF status == PASS:
        CONTINUE
    ELSE:
        FOR attempt IN [1, 2]:
            apply_auto_fix(gate)
            status = check(gate)
            IF status == PASS:
                CONTINUE to next gate
        IF all attempts failed:
            emit_limitation_notice(gate)
            CONTINUE to next gate
```

## Graceful Degradation

### Degradation Levels

| Level | Condition | Behavior |
|-------|-----------|----------|
| 0 | All sources reachable | Full evidenced analysis |
| 1 | Some primary sources fail | Use secondary; flag substituted |
| 2 | Most live sources fail | Knowledge base only; flag "historical context" |
| 3 | Required input missing | Proceed with available; mark "DATA UNAVAILABLE" |
| 4 | All sources + knowledge base fail | Emit notice; do NOT fabricate |

### Limitation Banner

```markdown
---
⚠️ LIMITATION NOTICE
This output was generated with reduced data availability (Level [0-4]).
Cross-check with current data before acting on it.
Substituted/missing sources are flagged inline.
---
```

## Error Recovery

| Error Type | Detection | Recovery | Retry Limit |
|------------|-----------|----------|-------------|
| Source timeout | No response 30s | Retry alternate source | 3 |
| Invalid input | Out-of-range/mismatch | Ask user to confirm | 2 |
| Missing input | Field absent | Proceed + flag | n/a |
| Stale reading | Timestamp old | Flag + request refresh | 1 |
| Knowledge base miss | No matches | WebSearch gap-fill | 2 |
| Conflicting actions | Mutually exclusive | Apply precedence | n/a |

## Knowledge Pipeline

### Crawl Configuration

Located in `tools/knowledge_updater.py`:

```python
KNOWLEDGE_CONFIG = {
    "domain": "Historical Cartography Restoration & GIS Digitization",
    "keywords": [...],
    "arxiv_categories": ["cs.CV", "cs.DL", "cs.IR", "stat.AP"],
    "rss_feeds": [...],
    "authoritative_docs": [...],
    "scoring_weights": {"recency": 0.4, "keyword_relevance": 0.4, "citation_count": 0.2}
}
```

### Crawl Schedule

```cron
# Weekly academic update (Mondays 8:00 AM)
0 8 * * 1 python tools/knowledge_updater.py >> logs/knowledge_update.log 2>&1

# Daily news update (Daily 7:00 AM)
0 7 * * * python tools/knowledge_updater.py --news-only >> logs/knowledge_news.log 2>&1
```

### Knowledge Update Log

Entries appended to `SECOND-KNOWLEDGE-BRAIN.md` Section 7 with:
- Date stamp
- Title
- Authors
- Venue
- DOI/URL
- Relevance score (0-10)
- Key finding

## Hooks & Tools

### Lifecycle Hooks

Hooks are defined in `config/hooks.yaml`:

```yaml
pre_execution:
  - validate_inputs
  - detect_language
  - initialize_logging

pre_step_1:
  - log_requirements_start

post_step_1:
  - validate_requirements
  - log_requirements_complete

# ... similar for each step

post_execution:
  - run_quality_gates
  - format_output
  - log_execution_complete
```

### Tool Definitions

Tools are defined with JSON schemas in `config/tools.yaml`:

```yaml
WebSearch:
  description: "Search for domain information"
  input_schema:
    type: object
    properties:
      query: {type: "string"}
      max_results: {type: "integer", default: 10}
  output_schema:
    type: array
    items:
      type: object
      properties:
        title: {type: "string"}
        url: {type: "string"}
        snippet: {type: "string"}

WebFetch:
  description: "Fetch and parse web content"
  input_schema:
    type: object
    properties:
      url: {type: "string"}
      format: {type: "string", enum: ["markdown", "text"]}
  output_schema:
    type: object
    properties:
      content: {type: "string"}
      metadata: {type: "object"}
```

## Configuration Management

### Environment Variables

Set in `.env` or environment:

```bash
# Optional: Custom paths
HISTORICAL_MAPS_DATA_PATH=/path/to/maps
HISTORICAL_MAPS_CACHE_DIR=/path/to/cache

# Optional: API keys (if using external services)
HISTORICAL_MAPS_IIIF_API_KEY=your_key
```

### Feature Flags

Set in `config/features.yaml`:

```yaml
enable_ml_extraction: true
enable_automated_georeferencing: true
enable_iiif_integration: true
enable_crawl_pipeline: true
verbose_logging: false
```

## Modular Directories

### Directory Structure

```
historical-cadastral-map-restorat

…

## 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/historical-cadastral-map-restoration-agent-skill](https://github.com/dungnotnull/historical-cadastral-map-restoration-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:** yes
- **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-historical-cadastral-map-restoration-agent-skill-historical-cadastral-map-restoration-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%.
