Easypaper interactive metadata build

From tsinghua-fib-lab/AgentSociety · View interactive version

Easypaper interactive metadata build is an AI agent skill from the GitHub repository tsinghua-fib-lab/AgentSociety. Interactively build EasyPaper metadata from a research-materials folder using Claude Code's file-investigation tools. Output is JSON consumable by the `easypaper-paper-from-metadata` skill.

How to use this skill

Skill file

Use this skill when the user has a folder of research materials and wants Claude to co-author the metadata in conversation instead of running the one-shot SDK pipeline silently.

The two paths are complementary:

| Path | Driver | Interaction | Use when |

|------|--------|-------------|----------|

| SDK one-shot (generate_metadata_from_folder) | EasyPaper internal LLM | None | Batch, CI, or fast autonomous extraction |

| This skill | Claude Code | High | Single high-value paper, atypical folder, or ambiguity requiring user input |

Both paths produce metadata that can be consumed by easypaper-paper-from-metadata.

Output Contract

The final JSON must validate as PaperGenerationRequest and include:

Each figure/table object follows the SDK shape:

{
  "id": "fig:h<12hex>",
  "caption": "...",
  "description": "...",
  "section": "",
  "file_path": "relative/posix/path/to/asset.png",
  "wide": false,
  "auto_generate": false,
  "generation_prompt": null
}

Tables use the same shape with tab: ids.

Path Handling

Folder-derived metadata uses the SDK convention:

Downstream generation resolves figure/table assets via materials_root first. The generation command or example loader normalizes operational fields such as template_path and local code_repository.path before calling the SDK.

ID Generation

When operating in cold mode, generate stable ids the same way as the SDK:

import hashlib

def figure_id(rel_posix_path: str) -> str:
    digest = hashlib.sha256(rel_posix_path.lower().encode("utf-8")).hexdigest()[:12]
    return f"fig:h{digest}"

def table_id(rel_posix_path: str) -> str:
    digest = hashlib.sha256(rel_posix_path.encode("utf-8")).hexdigest()[:12]
    return f"tab:h{digest}"

Figures lowercase the relative path before hashing; tables do not.

Modes

The first interaction must present these options and wait for an explicit choice:

Choose how you want to build the metadata:

  [1] cold        — Claude walks the folder alone, no Python SDK call.
                    Best for small folders or when full transparency is required.

  [2] warm-start  — (recommended) Run ep.generate_metadata_from_folder() once
                    to get a draft, then refine each field with Claude.
                    Best signal-to-effort ratio.

  [3] refine      — Load an existing metadata JSON and walk through fixing
                    validation failures and warnings.

Reply with 1 / 2 / 3, or the mode name.

Then ask for:

Workflow

Phase 1: Discovery

Use read-only file tools to map the folder:

Output a concise folder map before drafting fields.

Phase 2: Field Drafting

Draft and confirm the five prose fields in order:

For each field, cite the files that support the draft and surface unresolved questions.

Phase 3: Asset Selection

Glob candidates:

For each retained asset:

Phase 4: References

Parse BibTeX files when present and store entries as raw BibTeX strings. Empty references is a warning, not a save blocker.

Phase 5: Validate and Save

Before writing, run public schema validation plus explicit checks:

Only save when the hard checks pass:

import json
from pathlib import Path

out_path = Path(materials_root) / "easypaper_metadata.json"
out_path.write_text(
    json.dumps(metadata_dict, ensure_ascii=False, indent=2),
    encoding="utf-8",
)

Phase 6: Handoff

Report:

Error Handling

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.