{"id":"add-anydoc","name":"add-anydoc","summary":"ローカルオフィス文書からMarkdownへの変換を、ピン留めしたFirecrawl AnyDoc CLIでNanoClawエージェントコンテナに追加してください。","body":"# Add AnyDoc\n\nInstall one pinned CLI and one focused container skill. Keep document conversion inside the agent container; do not change NanoClaw's attachment pipeline or add credentials, an MCP server, or a hosted parser.\n\n## Preflight\n\n1. Read `CONTRIBUTING.md`, `docs/skill-guidelines.md`, and the supply-chain section of `docs/SECURITY.md`.\n2. Run this check against the official npm registry before changing files:\n\n   ```bash\n   curl -fsSL \"https://registry.npmjs.org/@firecrawl%2Fanydoc\" | node -e '\n     let body = \"\";\n     process.stdin.setEncoding(\"utf8\");\n     process.stdin.on(\"data\", (chunk) => (body += chunk));\n     process.stdin.on(\"end\", () => {\n       const metadata = JSON.parse(body);\n       const version = \"0.1.6\";\n       const release = metadata.versions?.[version];\n       const publishedAt = Date.parse(metadata.time?.[version] ?? \"\");\n       const eligibleAt = publishedAt + 72 * 60 * 60 * 1000;\n       if (!release) throw new Error(`${version} is missing from the registry`);\n       if (release.deprecated) throw new Error(`${version} is deprecated: ${release.deprecated}`);\n       if (!Number.isFinite(publishedAt)) throw new Error(`missing publish time for ${version}`);\n       if (Date.now() < eligibleAt) throw new Error(`${version} is gated until ${new Date(eligibleAt).toISOString()}`);\n       console.log(`${version} passed the 72-hour release gate`);\n     });\n   '\n   ```\n\n   Stop on any failure. Do not install a PR commit, add a `minimumReleaseAgeExclude`, enable lifecycle scripts, or silently substitute another version, unless the user explicitly approves it.\n\n3. Inspect `container/cli-tools.json` for `@firecrawl/anydoc` before changing files:\n   - No entry: continue.\n   - Exactly one entry at `0.1.6`: leave it unchanged.\n   - A duplicate or any other version: stop and report the conflict.\n4. Check whether `container/skills/convert-documents-to-markdown/SKILL.md` and `src/anydoc-manifest.test.ts` already exist. Reapplying this skill overwrites only those dedicated files.\n5. If `data/v2.db` exists, inspect per-group image pins before changing files. Standard derived images can be rebuilt from the updated shared image. Stop and report any other pin because its owner must decide how to rebuild it:\n\n   ```bash\n   if [ -f data/v2.db ]; then\n     source setup/lib/install-slug.sh\n     image_base=\"$(container_image_base)\"\n     foreign=0\n     while IFS='|' read -r group_id image_tag package_count; do\n       [ -z \"$group_id\" ] && continue\n       if [ \"$image_tag\" != \"${image_base}:${group_id}\" ]; then\n         echo \"Foreign image pin: $group_id -> $image_tag\" >&2\n         foreign=1\n       elif [ \"$package_count\" -eq 0 ]; then\n         echo \"Derived image cannot be rebuilt: $group_id has no configured packages\" >&2\n         foreign=1\n       elif ! ncl groups get --id \"$group_id\" >/dev/null; then\n         echo \"Cannot reach NanoClaw through ncl for derived image: $group_id\" >&2\n         foreign=1\n       fi\n     done < <(pnpm exec tsx scripts/q.ts data/v2.db \\\n       \"SELECT agent_group_id, image_tag, COALESCE(json_array_length(packages_apt), 0) + COALESCE(json_array_length(packages_npm), 0) FROM container_configs WHERE image_tag IS NOT NULL ORDER BY agent_group_id\")\n     [ \"$foreign\" -eq 0 ]\n   fi\n   ```\n\n## Install\n\nResolve this skill's bundled files from either Claude Code's skill variable or the project skill directory, then copy both files:\n\n```bash\nproject_root=\"$(git rev-parse --show-toplevel)\"\nskill_dir=\"${CLAUDE_SKILL_DIR:-$project_root/.claude/skills/add-anydoc}\"\ntest -f \"$skill_dir/container-skills/convert-documents-to-markdown/SKILL.md\"\ntest -f \"$skill_dir/anydoc-manifest.test.ts\"\nmkdir -p container/skills/convert-documents-to-markdown\ncp \"$skill_dir/container-skills/convert-documents-to-markdown/SKILL.md\" \\\n  container/skills/convert-documents-to-markdown/SKILL.md\ncp \"$skill_dir/anydoc-manifest.test.ts\" src/anydoc-manifest.test.ts\n```\n\nIf the manifest has no AnyDoc entry, append this exact object to its JSON array. Do not add `onlyBuilt`; the package and its prebuilt Linux bindings have no install lifecycle script.\n\n```json\n{ \"name\": \"@firecrawl/anydoc\", \"version\": \"0.1.6\" }\n```\n\n## Validate and build\n\nRun validation before building the image:\n\n```bash\npnpm exec vitest run src/anydoc-manifest.test.ts container/cli-tools.test.ts\npnpm run build\n./container/build.sh\n```\n\nIf pnpm rejects the package as too new, stop. Do not bypass the release-age policy.\n\nRebuild standard per-group images so groups with custom packages inherit the updated shared image:\n\n```bash\nif [ -f data/v2.db ]; then\n  source setup/lib/install-slug.sh\n  image_base=\"$(container_image_base)\"\n  while IFS='|' read -r group_id image_tag; do\n    [ -z \"$group_id\" ] && continue\n    if [ \"$image_tag\" != \"${image_base}:${group_id}\" ]; then\n      echo \"Foreign image pin appeared during install: $group_id -> $image_tag\" >&2\n      exit 1\n    fi\n    ncl groups restart --id \"$group_id\" --rebuild\n  done < <(pnpm exec tsx scripts/q.ts data/v2.db \\\n    \"SELECT agent_group_id, image_tag FROM container_configs WHERE image_tag IS NOT NULL ORDER BY agent_group_id\")\nfi\n```\n\nResolve this install's image name and exercise the native binding, not only the help path:\n\n```bash\nsource setup/lib/install-slug.sh\nimage=\"$(container_image_base):latest\"\ndocker run --rm --entrypoint anydoc \"$image\" --version\nprintf 'name,count\\nalpha,2\\n' | \\\n  docker run --rm -i --entrypoint anydoc \"$image\" - --format csv | grep -q alpha\ndocker run --rm --entrypoint sh \"$image\" -c 'command -v timeout'\n```\n\nIf `timeout` is absent, remove its wrapper from the installed container skill; do not add another dependency. Convert local DOCX, PPTX, and XLSX fixtures when available. Do not add private or large binary fixtures to the repository.\n\n## Restart\n\nRestart this NanoClaw service only, so its running containers stop and default `skills: \"all\"` groups receive the new shared skill on their next spawn:\n\n```bash\nsource setup/lib/install-slug.sh\n# macOS\nlaunchctl kickstart -k \"gui/$(id -u)/$(launchd_label)\"\n# Linux\nsystemctl --user restart \"$(systemd_unit)\"\n```\n\nRun only the command for the current platform. If NanoClaw is not service-managed, stop this install's running agent containers by their `nanoclaw-install=<install-slug>` label instead of matching every `nanoclaw-v2` container on the host.\n\n## Smoke test\n\nUse one real channel attachment and verify the complete path:\n\n1. Confirm the message supplies an absolute local path such as `/workspace/inbox/<message-id>/<file>`, and use that exact path.\n2. Convert it to `/workspace/agent/converted/` and summarize only the relevant Markdown sections.\n3. Confirm an image-only PDF fails clearly and is not uploaded anywhere.\n4. For agents open to unknown senders, recommend an operator-set `CONTAINER_MEMORY_LIMIT`; AnyDoc's parser caps decompression, but NanoClaw containers have no memory limit by default.\n\nReport that office documents now convert locally. Call out that scanned PDFs need OCR, embedded visuals may be incomplete, and spreadsheet Markdown is not authoritative for calculations.","author":"@nanocoai","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/nanocoai/nanoclaw/tree/main/.claude/skills/add-anydoc","license":"MIT","category":"document","lang":"en","tokens":1758,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"anydoc-manifest.test.ts","size":4311,"sha256":"c35b6b29917b8d8812ee7991dfafa6c9a7a85309159b1a4707a457a6362c2ed6"},{"path":"REMOVE.md","size":3970,"sha256":"bfc84f97c9fdb0d9c7f1b91b9b2e7542f3724f7e2483e849cdd41e2ad3e61687"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[{"code":"net.endpoints","kind":"exfiltration","excerpt":"registry.npmjs.org","message":"bundled scripts reach 1 external host(s)","severity":"warn"}],"scannedAt":"2026-08-22","hasScripts":true,"networkEndpoints":["registry.npmjs.org"]}}