get_page_templates Architecture

Derive page templates on-the-fly from existing architecture facets — no new pipeline step

Overview

Part of the Architecture Toolkit. Returns the set of page templates for a clone job, derived on-the-fly each call by joining facets already in the database: route patterns, design system clusters, dominant content types, and ordered shared page elements. The tool is read-only and stateless — it adds no DB rows and runs no LLM calls. Because it derives results live, outputs may shift after any underlying facet is re-extracted. Template IDs are deterministic hashes (tpl_<16hex>) and labels are auto-synthesized, not curated. Missing facets degrade gracefully and are reported in extraction_status.missing_inputs.

How It Works

  1. For each page, the tool joins the deepest matching route pattern, the page's design system cluster (canonical preferred), the dominant content type for the page's route (highest page-count association), and the ordered list of shared page element IDs the page is associated with.
  2. These four facets are concatenated into a deterministic signature, hashed to produce a stable template_id (tpl_<16-hex>).
  3. Pages with identical signatures are grouped into one template. Missing facets degrade gracefully — they appear as empty slots in the signature and the template is still returned.
  4. Each template gets a synthesized label preferring '<content type label> — <route pattern>', falling back to the route pattern, then to a hash-suffixed placeholder.
  5. Templates are returned sorted by page_count descending. A representative sample of up to 50 pages is always included; pass include_pages=true (or template_id=...) to get the full page list, capped by pages_per_template_limit.

Input Parameters

ParameterTypeRequiredDescription
job_id string required Cloning job ID
include_pages boolean optional If true, include the full page list per template (capped by pages_per_template_limit). Default false.
pages_per_template_limit number optional Max pages per template when include_pages or template_id is set. Default 100, hard max 10000.
template_id string optional Optional: return only this template with its full page list.
representative_pages_limit number optional Max pages in representative_pages per template (always returned). Default 50, hard max 200.

What You Get Back

Example Use Case

Before scaffolding a clone, an agent calls get_page_templates to learn the source site has 7 distinct templates: Product Detail (47 pages), Blog Post (23), Category Listing (12), and four singletons. Each template returns its route pattern, design system, content type, and ordered shared elements (header → nav → product-card-grid → footer), so the agent can build one component skeleton per template instead of one per page.

Tips

Run after route patterns, content types, design systems, and shared elements have all completed — missing facets still work but produce coarser groupings.
Template IDs are deterministic across runs as long as the underlying facet IDs are stable.
Use template_id with include_pages implicit to drill down on a single template's full page list.
Singletons (page_count=1) often indicate one-off pages or facets that haven't been clustered yet.
This tool does no LLM calls and adds no database state — it is safe to call frequently.

Related Tools