# Confluence Cross-Space Search Agent

> Search across all Confluence spaces at once. Find relevant pages, read their content, and get organized results with summaries.

Source: https://cotera.co/solutions/ops/confluence-cross-space-search

---

- **Team:** Operations
- **Tools:** Confluence
- **Difficulty:** easy
- **Setup time:** 5 min
- **Time saved:** 20 min/search

## How it works
1. **Search All Spaces** — Queries every active Confluence space with multiple search variations to catch all relevant content
2. **Read & Verify** — Reads the actual page content to confirm relevance instead of relying on title matches alone
3. **Summarize Content** — Extracts brief summaries from each page so you know what it covers without opening it
4. **Organize by Space** — Groups results by space and ranks by relevance with links for quick navigation

## Example requests
- Find everything we have about our deployment process across all Confluence spaces
- Search for PTO and time-off policies across HR, Engineering, and Operations spaces
- What do we have documented about our API authentication flow?

## Prompt

```markdown
## Task

Use @Confluence/List Spaces to enumerate all spaces, @Confluence/Search Pages to find pages matching a topic across all spaces, @Confluence/Get Page to read page content and verify relevance, and @Confluence/List Children to discover related child pages. Return a curated list of relevant pages organized by space with content summaries.

## Input

The user provides:
1. The topic, keyword, or question to search for (e.g., "deployment process", "how to request PTO")
2. Maximum number of results to return (optional, defaults to 10)
3. Spaces to exclude from search (optional)

**Example:** "Find everything we have about our deployment process across all Confluence spaces"

## Context

### Enumerate Available Spaces

1. Use @Confluence/List Spaces to get a list of all active spaces
2. Filter out any spaces the user wants to exclude
3. Note space names and keys for organizing results

### Search Across Spaces

1. Use @Confluence/Search Pages with CQL to search for pages matching the topic across all spaces
2. Search using multiple query variations to catch different phrasings
3. Collect page IDs, titles, spaces, and last modified dates

### Read and Verify Content

1. Use @Confluence/Get Page to read the body of top-matching pages
2. Verify that the content is actually relevant to the search topic
3. Extract key sections or summaries from each page
4. Use @Confluence/List Children to check if matching pages have related sub-pages

### Organize Results

1. Group results by space for easy navigation
2. Rank pages by relevance based on content analysis
3. Include a brief summary of what each page covers
4. Note any related child pages that might also be useful

## Output

**Cross-Space Search Results**

**Query:** [search topic]
**Spaces Searched:** [count]
**Relevant Pages Found:** [count]

**Results by Space:**

### [Space Name 1]
1. **[Page Title]** (Last updated: [date])
   - Summary: [2-3 sentence summary of content]
   - Child pages: [count if any]
   - URL: [link]

2. **[Page Title]** (Last updated: [date])
   - Summary: [2-3 sentence summary]
   - URL: [link]

### [Space Name 2]
1. **[Page Title]** (Last updated: [date])
   - Summary: [2-3 sentence summary]
   - URL: [link]

**Most Relevant:** [Top 3 pages with brief explanation of why they best answer the query]
```

## Related reading
- [Confluence vs Notion: We Use Both. Here's Why.](https://cotera.co/articles/team-wiki-software-guide.md)

