# Rare Book Manuscript Conservation

> Rare Book & Manuscript Conservation Assessment — Paper Heritage Conservation & Preservation Science evidence-backed analysis harness. Use when user requests conservation assessment, preservation planning, condition analysis, treatment recommendations, storage environment design, digitization prioritization, or any Paper Heritage Conservation & Preservation Science domain analysis including book/m…

- **Type:** Skill
- **Install:** `agentstack add skill-dungnotnull-rare-book-manuscript-conservation-agent-skill-rare-book-manuscript-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/rare-book-manuscript-conservation-agent-skill

## Install

```sh
agentstack add skill-dungnotnull-rare-book-manuscript-conservation-agent-skill-rare-book-manuscript-conservation-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 — Rare Book & Manuscript Conservation Skill Registry

## Overview

This skill provides a **production-grade, evidence-backed analytical workflow** for Paper Heritage Conservation & Preservation Science. It implements a flexible agent architecture with sequential sub-skill orchestration, quality gates, graceful degradation, and self-improving knowledge pipeline.

## Quick Start

```bash
# Install dependencies
pip install -r requirements.txt

# Run test scenarios
python tools/run_test_scenarios.py --all

# Update knowledge base manually
python tools/knowledge_updater.py --dry-run

# In Claude Code
/rare-book-manuscript-conservation Analyze this 18th-century manuscript for conservation needs
```

## Architecture

### Harness Flow Pattern

```
USER INPUT → Language Detection → Step 1 (Requirements) → Step 2 (Evidence) → 
Step 3 (Core Analysis) → Step 4 (Knowledge) → Step 5 (Advisor) → 
Quality Gate (U1-U6, G1-G4) → Final Output
```

### Agent & Skill Registration

#### Main Agent
- **File:** `skills/main.md`
- **Role:** Orchestration harness with quality gates
- **Entrypoint:** `/rare-book-manuscript-conservation`

#### Sub-Skills
| Skill ID | File | Purpose | Trigger |
|---------|------|---------|---------|
| sub-gather-requirements | skills/sub-gather-requirements.md | Clarify analysis object, constraints, inputs | Step 1 |
| sub-evidence-collector | skills/sub-evidence-collector.md | Fetch real-time authoritative data | Step 2 |
| sub-core-analysis | skills/sub-core-analysis.md | Condition assessment & treatment planning | Step 3 |
| sub-knowledge-updater | skills/sub-knowledge-updater.md | Query knowledge base for citations | Step 4 |
| sub-advisor | skills/sub-advisor.md | Synthesize risk-disclosed conclusions | Step 5 |

### Skill Resolution Protocol

1. **Main skill invoked** via `/rare-book-manuscript-conservation`
2. **Language detection** from user input (Vietnamese/English/Other)
3. **Sequential skill invocation** through `Skill(tool="skill-name")`
4. **Gate enforcement** after each step with auto-fix retry (max 2)
5. **Quality gate review** before final output
6. **Graceful degradation** if sources fail (Levels 0-4)

## Input/Output Schemas

### Input Schema

```json
{
  "user_query": "string (free-form text)",
  "language": "string (auto-detected: vi/en/other)",
  "provided_inputs": {
    "imagery": ["string (file paths or URLs, optional)"],
    "metadata": "object (optional: date, origin, dimensions)",
    "constraints": "string (optional: timeframe, budget, access)"
  }
}
```

### Output Schema

```json
{
  "report": {
    "header": {
      "title": "string",
      "date": "YYYY-MM-DD",
      "analyst": "rare-book-manuscript-conservation v1.0",
      "language": "Vietnamese/English",
      "domain": "Paper Heritage Conservation & Preservation Science"
    },
    "executive_summary": "string (2-3 sentences)",
    "inputs_scope": {
      "object": "string",
      "constraints": "string",
      "timeframe": "string",
      "available_inputs": "array"
    },
    "evidence_collected": [
      {
        "source": "string",
        "data": "object",
        "tier": "number (1-4)",
        "date": "YYYY-MM-DD"
      }
    ],
    "analysis_scorecard": {
      "materials": "object",
      "condition": "object",
      "environment": "object",
      "treatment": "object",
      "storage": "object"
    },
    "action_plan": [
      {
        "action": "string",
        "magnitude": "string",
        "safety_limits": "string (optional)"
      }
    ],
    "academic_evidence": [
      {
        "citation": "string",
        "tier": "number (1-4)",
        "relevance": "string"
      }
    ],
    "disclosure": "string (mandatory)",
    "conclusion": {
      "verdict": "string (Stable Preservation Plan/Conditional/High Deterioration Risk/Inconclusive)",
      "scenarios": "object",
      "key_risks": "array",
      "evidence_chain": "array",
      "remediation": "string"
    },
    "gate_checklist": "string"
  }
}
```

## Hooks & Tool System

### Available Hooks

#### Lifecycle Hooks
| Hook | Trigger | Purpose |
|------|---------|---------|
| `before_step` | Before each step execution | Logging, validation |
| `after_step` | After each step completion | State update, cleanup |
| `on_error` | When any step fails | Error recovery, degradation |
| `before_output` | Before final output delivery | Final quality check |
| `on_knowledge_update` | When knowledge base updates | Cache invalidation |

#### Hook Configuration

```yaml
# config/hooks.yaml
hooks:
  before_step:
    - logger: log_step_start
    - validator: validate_inputs
  after_step:
    - state_manager: save_step_state
    - metrics: record_step_metrics
  on_error:
    - recovery: graceful_degradation
    - logger: log_error_context
```

### Tool Definitions

#### Domain-Specific Tools

**Image Analysis Tool** (`tools/image_analyzer.py`)
```python
def analyze_condition(image_path: str) -> dict:
    """
    Analyze book/manuscript condition from imagery.
    
    Returns:
        dict: {
            "materials": {"paper_type": "rag/wood", "binding": "..."},
            "condition": {"acid": bool, "foxing": bool, "tears": bool},
            "severity": "low/medium/high",
            "confidence": float
        }
    """
```

**Environment Calculator** (`tools/environment_calculator.py`)
```python
def calculate_environment(recommendation: dict) -> dict:
    """
    Calculate storage environment per BS 4971.
    
    Returns:
        dict: {
            "temperature": {"min": 16, "max": 19, "unit": "C"},
            "humidity": {"min": 50, "max": 55, "unit": "%"},
            "light": {"lux_limit": 50, "uv_filter": true},
            "pollutants": ["NOx", "SOx", "VOCs"],
            "air_filtration": "HEPA+ activated carbon"
        }
    """
```

**Treatment Planner** (`tools/treatment_planner.py`)
```python
def plan_treatment(condition: dict, constraints: dict) -> dict:
    """
    Generate conservation treatment plan.
    
    Returns:
        dict: {
            "priority": "immediate/short-term/long-term",
            "treatments": [
                {"type": "surface_cleaning", "method": "...", "materials": "..."},
                {"type": "tear_repair", "method": "...", "materials": "..."}
            ],
            "risks": ["..."],
            "alternatives": ["..."]
        }
    """
```

## Modular Directory Structure

```
rare-book-manuscript-conservation/
├── SKILL.md                    # This file - skill registry
├── CLAUDE.md                    # Project identity & harness
├── README.md                    # Public documentation
├── PROJECT-detail.md            # Technical specification
├── PROJECT-DEVELOPMENT-PHASE-TRACKING.md  # Build roadmap
├── SECOND-KNOWLEDGE-BRAIN.md    # Living knowledge base
├── requirements.txt            # Python dependencies
├── .gitignore
│
├── skills/                      # Skill definitions
│   ├── main.md                  # Main orchestration harness
│   ├── sub-gather-requirements.md
│   ├── sub-evidence-collector.md
│   ├── sub-core-analysis.md
│   ├── sub-knowledge-updater.md
│   └── sub-advisor.md
│
├── scripts/                     # Automation & setup
│   ├── setup_environment.sh    # Initial environment setup
│   ├── run_all_tests.sh        # Execute full test suite
│   ├── deploy_skill.sh         # Deploy to Claude skills directory
│   └── backup_knowledge.sh     # Backup knowledge base
│
├── tools/                       # Executable tools
│   ├── knowledge_updater.py    # Crawl pipeline
│   ├── test_knowledge_updater.py
│   ├── run_test_scenarios.py
│   ├── image_analyzer.py       # NEW: Image condition analysis
│   ├── environment_calculator.py  # NEW: BS 4971 calculations
│   ├── treatment_planner.py    # NEW: Treatment planning
│   └── validator.py            # NEW: Output validation
│
├── references/                  # Domain knowledge & templates
│   ├── standards/
│   │   ├── BS4971.md           # British Standard 4971
│   │   ├── ISO11799.md         # ISO requirements
│   │   └── AIC_guidelines.md   # AIC Book & Paper guidelines
│   ├── materials/
│   │   ├── paper_chemistry.md  # Paper aging, lignin, acid
│   │   ├── binding_types.md    # Leather, vellum, cloth
│   │   └── media_types.md      # Inks, pigments
│   ├── treatment/
│   │   ├── cleaning_methods.md
│   │   ├── repair_techniques.md
│   │   └── deacidification.md
│   └── templates/
│       ├── output_template.md  # Standard output format
│       ├── treatment_report.md
│       └── condition_report.md
│/
├── assets/                      # Static resources
│   ├── images/
│   │   └── condition_examples/  # Reference condition images
│   ├── diagrams/
│   │   ├── harness_flow.svg
│   │   └── degradation_levels.svg
│   └── schemas/
│       ├── input_schema.json
│       └── output_schema.json
│
├── config/                      # Configuration management
│   ├── sources.yaml            # Data sources configuration
│   ├── quality_gates.yaml      # Gate definitions
│   ├── hooks.yaml              # Hook configuration
│   ├── logging.yaml            # Logging configuration
│   └── environment.yaml        # Environment-specific config
│
└── tests/                       # Test suite
    ├── test-scenarios.md
    ├── TEST_RESULTS.md
    └── integration/
        └── test_harness_flow.py
```

## Configuration Management

### Source Configuration (`config/sources.yaml`)

```yaml
domain_sources:
  library_of_congress:
    url: "https://www.loc.gov/preservation/"
    tier: 1
    update_frequency: weekly
    enabled: true

  british_library:
    url: "https://www.bl.uk/help-with-preservation"
    tier: 1
    update_frequency: weekly
    enabled: true

academic_sources:
  jaic:
    journal: "Journal of the American Institute for Conservation"
    publisher: "Taylor & Francis"
    tier: 2
    crawl: true

  studies_conservation:
    journal: "Studies in Conservation"
    publisher: "Maney"
    tier: 2
    crawl: true
```

### Quality Gates Configuration (`config/quality_gates.yaml`)

```yaml
universal_gates:
  U1:
    name: "Source count"
    check: "sources_cited >= 3 and academic_sources >= 1"
    auto_fix: "fetch_from_knowledge_base"
    enforcement: "append_before_delivery"

  U2:
    name: "Disclosure"
    check: "disclosure_present_before_recommendation"
    auto_fix: "prepend_standard_disclosure"
    enforcement: "block_until_present"

domain_gates:
  G1:
    name: "Materials & condition"
    check: "materials_assessed and condition_assessed"
    auto_fix: "assess_materials_condition"

  G2:
    name: "Environment"
    check: "environment_specified_with_BS4971"
    auto_fix: "specify_environment_BS4971"
```

## Execution & Quality Standards

### Production-Grade Error Handling

```python
# tools/error_handler.py
class ConservationError(Exception):
    """Base exception for conservation analysis errors."""
    pass

class SourceUnavailableError(ConservationError):
    """Raised when primary data source is unavailable."""
    def __init__(self, source: str, fallback_available: bool):
        self.source = source
        self.fallback_available = fallback_available
        self.degradation_level = 1 if fallback_available else 2

class ImageAnalysisError(ConservationError):
    """Raised when image analysis fails."""
    def __init__(self, image_path: str, reason: str):
        self.image_path = image_path
        self.reason = reason
        self.fallback = "manual_assessment_required"
```

### Logging Strategy

```yaml
# config/logging.yaml
logging:
  version: 1
  formatters:
    standard:
      format: '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
  handlers:
    file:
      class: logging.FileHandler
      filename: logs/conservation.log
      level: INFO
    console:
      class: logging.StreamHandler
      level: WARNING
  loggers:
    conservation:
      level: INFO
      propagate: false
      handlers: [file, console]
```

### Token Optimization

- **Caching strategy:** Reuse knowledge base entries across sessions
- **Context management:** Load reference files on-demand only
- **Output compression:** Use concise report templates
- **Parallel execution:** Run sub-skills in parallel where safe

## Knowledge Pipeline

### Crawl Configuration

The knowledge pipeline is configured via `tools/knowledge_updater.py`:

```python
KNOWLEDGE_CONFIG = {
    "KEYWORDS": [
        "paper conservation", "manuscript preservation", "book conservation",
        "iron gall ink", "foxing treatment", "deacidification",
        "BS 4971", "climate control storage", "rare book conservation"
    ],
    "ARXIV_CATEGORIES": [],
    "RSS_FEEDS": [],
    "AUTHORITATIVE_DOCS": [
        "https://www.loc.gov/preservation/",
        "https://www.bl.uk/help-with-preservation"
    ],
    "SCORING_WEIGHTS": {"recency": 0.4, "relevance": 0.4, "citation": 0.2}
}
```

### Update 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
```

## Testing & Validation

### Test Scenarios

See `tests/test-scenarios.md` for 5+ concrete test scenarios covering:
- Standard conservation assessment
- Minimal input handling
- Risk/conflict scenarios
- Degraded mode operation
- Multi-language support

### Running Tests

```bash
# Run all test scenarios
python tools/run_test_scenarios.py --all

# Run specific scenario
python tools/run_test_scenarios.py --scenario standard_assessment

# Run knowledge updater tests
python tools/test_knowledge_updater.py
```

## Deployment

### Installation

```bash
# Clone or copy to project directory
cd rare-book-manuscript-conservation

# Install dependencies
pip install -r requirements.txt

# Deploy to Claude skills directory
bash scripts/deploy_skill.sh

# Run initial tests
bash scripts/run_all_tests.sh
```

### Version Management

- Current version: 1.0.0
- Semantic versioning: MAJOR.MINOR.PATCH
- Changelog maintained in PROJECT-DEVELOPMENT-PHASE-TRACKING.md

## Support & Maintenance

### Monitoring

- Log files in `logs/` directory
- Knowledge update logs: `logs/knowledge_update.log`
- Test results: `tests/TEST_RESULTS.md`

### Issue Reporting

When reporting issues, include:
- Skill version
- Input query
- Error messages
- Log excerpts
- Expected vs actual behavior

## License

MIT License - see LICENSE file

## Citation

```bibtex
@software{rare_book_manuscript_conservation,
  title = {rare-book-manuscript-conservation: Rare Book & Manuscript Conservation Assessment},
  author = {972026 Skill Library},
  year = {2026},
  version = {1.0.0},
  url = {https://github.com/972026/rare-book-manuscript-conservation}
}
```

## 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/rare-book-manuscript-conservation-agent-skill](https://github.com/dungnotnull/rare-book-manuscript-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-rare-book-manuscript-conservation-agent-skill-rare-book-manuscript-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%.
