Skip to main content

21 - Copilot Spaces and Memory: Persistent Knowledge for the Team

Copilot Spaces e Memory: Knowledge Persistente per il Team Tra settembre e dicembre 2025, GitHub trasforma radicalmente il modo in cui gestiamo il...

What do you think about this article?

At a Glance

Copilot Spaces e Memory: Knowledge Persistente per il Team Tra settembre e dicembre 2025, GitHub trasforma radicalmente il modo in cui gestiamo il...

Copilot Spaces and Memory: Persistent Knowledge for the Team

Between September and December 2025, GitHub will radically transform how we manage context in Copilot. The launch of Copilot Spaces in General Availability (September 24) introduces i curated context bundles for teams. Mandatory migration of Knowledge Bases from October 17 to November 1, 2025 marks the end of an era. And finally, Copilot Memory in public preview on December 19, 2025 adds persistence of the personal context that crosses chat, code review and CLI.

In this twenty-first article in the GitHub Copilot series, we'll explore how in detail these three pillars redefine knowledge management: Spaces for teams, Memory for individuals, and how to prepare for sunset of the Knowledge Bases that have provided persistent context to projects for years.

What You Will Learn

  • What are Copilot Spaces and how curated context bundles work
  • Components of a Space: repository, code, pull requests, issues, notes, files
  • How to create, configure, share and pin files in a Space
  • Knowledge Bases sunset timeline and migration strategy
  • Public Spaces for OSS maintainer and individual sharing in December
  • Copilot Memory: user scope vs. repository scope and how it persists
  • When to use Memory vs. Spaces in your daily practice
  • Optimal setup for Angular+Spring Boot monorepo with Memory and Spaces
  • Privacy considerations and GitHub-hosted data residency (April 2026)

Complete Series Overview

#ItemFocus
1Introduction to GitHub CopilotWhat it is and how it works
2Engineering Prompts for CopilotAdvanced techniques
3Code Generation PatternsCode generation pattern
4Testing with CopilotTest generation and debugging
5Code Review AutomationReview and suggestions
6Security and Best PracticesSecurity of the generated code
7Automatic DocumentationDocstring generation
8Assisted RefactoringCode improvement
9Copilot CLICommand line
10GitHub Copilot in VS CodeEditor integration
11GitHub Copilot in JetBrainsJetBrains IDE
12GitHub Copilot in Visual StudioVisual Studio
13Copilot ChatConversational chat
14Knowledge Bases v1Persistent context (legacy)
15Copilot Workspaces (Beta)Development environments
16Copilot Extensions (Beta)Plugins and extensions
17Model Selection & Fine-TuningChoice and customization
18Enterprise FeaturesSAML, seat management
19Performance & Cost OptimizationEconomic optimization
20GitHub Universe 2025 RecapMain news
21Copilot Spaces and Memory (you are here)Persistent knowledge team+user

1. The Repeated Context Problem

For years, Copilot's main challenge has been loss of context between conversations. If you shared the architecture of your Spring Boot project in a chat, that knowledge vanished at the next session. If I wanted Copilot to understand your team's testing strategy, you should repeat it every time.

Knowledge Bases (launched in February 2024) have partially solved the problem, allowing you to upload documents to a persistent knowledge base. But they had limitations: they were poorly indexed, did not support real-time updates of the repositories, and they mismanaged large repositories.

The Progression: Knowledge Bases → Spaces → Memory

SolutionLaunchBroomsPersistenceUpdate
Knowledge Bases Feb 2024 Team/Project Manual (file upload) Semi-auto (requires refresh)
Copilot Spaces Sep 24, 2025 (GA) Team/Project Automatic (repo link) Real-time (live binding)
Copilot Memory Dec 19, 2025 (Preview) User/Preferences Cloud GitHub-hosted Snapshot (AI model memory)

2. Copilot Spaces in General Availability (24 September 2025)

Copilot Spaces they are curated context bundles - collections of repository resources organized for the team. Unlike Knowledge Bases (which required manual uploads), Spaces are alive and always up to date because they are directly connected to your GitHub repositories.

What is a Space?

A Space is a structured collection of context for a project or area of code. You can curate it manually, but GitHub automatically indexes the content from your repositories the moment you pin it.

Anatomy of a Space
┌─ Spring Boot Backend Auth Space (Esempio reale) ────────────────┐
│                                                                   │
├─ Repository Sources                                              │
│  ├─ src/main/java/dev/federicocalo/portfolio/domain/     (pinned)│
│  ├─ src/main/java/dev/federicocalo/portfolio/application/       │
│  ├─ src/main/resources/db/migration/           (Flyway DDL)     │
│  └─ docs/06_compliance/04_refactoring_architetturale/           │
│                                                                   │
├─ Pull Requests (auto-indexed)                                    │
│  ├─ #247: "feat: JWT proprietaria con refresh token"            │
│  ├─ #251: "fix: SSRF guard per External API"                    │
│  └─ #245: "test: AuthControllerTest @Testcontainers"            │
│                                                                   │
├─ Issues (reference automatica)                                   │
│  ├─ #198: "Security: Implement SUPER_ADMIN role"                │
│  └─ #204: "Feature: API Key management for dataset queries"      │
│                                                                   │
├─ Free-text Notes                                                 │
│  ├─ "JWT Strategy: HS256 via JwtService, refresh hash-in-DB"    │
│  ├─ "Roles hierarchy: GUEST

Components of a Space (September 2025)

Supported Context Types

TypeDescriptionAuto-UpdateTypical Use
Repositories Links to Github repos (entire or specific directories) ✓ Real-time Source code, architecture
Code Snippets Specific files or functions from GitHub repo ✓ Live binding Patterns, configurations, helpers
Pull Requests References to PR for discussion context ✓ Car Architectural decisions, trade-offs
Issues GitHub issue for requirements and tracking ✓ Car Requirements, bug reports, decisions
Free-Text Notes Free text written directly in Space ✗ Manual Design principles, team preferences
File Uploads PDFs, images, diagrams uploaded ✗ Manual Architectural diagrams, decision records

3. Create, Configure and Manage a Space

Creating a Space is simple via the GitHub.com interface. In this section let's see the step-by-step flow for the real scenario: a team wanting to document Spring Boot's authentication architecture.

Step 1: Navigate to Spaces

UI flow to create a Space
1. Vai a github.com/settings/copilot/spaces
   (oppure clicca "Copilot" nel menu principale)

2. Clicca "New Space" (pulsante blu in alto a destra)

3. Compila il form:
   Nome Space:           "Spring Boot Backend Auth"
   Descrizione:          "Architecture, JWT strategy, role hierarchy, security"
   Privacy:              "Private" (default, cambiabile a dicembre con Public Spaces)
   Repository (optional): seleziona il repo principale (es. portfolio-backend)

4. Clicca "Create Space"

Step 2: Add Resources

Once created, the Space has a configuration page where you add context. Here is the workflow for our scenario:

Add repositories and files to a Space
Nella pagina dello Space:

1. AGGIUNGI REPOSITORY
   - Clicca "Add Repository" → seleziona portfolio-backend
   - GitHub auto-indexes il contenuto
   - Indicizzazione: real-time su push

2. PINNA FILE SPECIFICI (per focus)
   - Naviga: src/main/java/dev/federicocalo/portfolio/...
   - Clicca ⭐ "Pin" accanto ai file chiave:
     ✓ presentation/controller/AuthController.java
     ✓ application/auth/usecase/LoginUseCase.java
     ✓ domain/auth/JwtTokenProvider.java
     ✓ infrastructure/security/JwtService.java
     ✓ src/main/resources/db/migration/V011__auth_tables.sql
   - I file pinnati appaiono come "High Priority" in Copilot

3. AGGIUNGI PULL REQUESTS
   - Sezione "Pull Requests" → "Add PR"
   - Seleziona PR importanti:
     #247: feat(security): JWT proprietaria con refresh token
     #251: fix(security): SSRF guard per external API
   - Copilot indexa titolo, descrizione, commenti, diff

4. AGGIUNGI NOTE LIBERE
   - Sezione "Notes" → "New Note"
   - Titolo: "JWT Architecture & Refresh Token Flow"
   - Contenuto: (copia-incolla)
     """
     ## JWT Strategy
     - Algoritmo: HS256
     - Issuer: federicocalo.dev
     - Expire: 15 minuti (access), 30 giorni (refresh)
     - Refresh token: hash-in-DB, validazione su ogni refresh
     - Scopo: Autenticazione stateless con sessione backend opzionale

     ## Roles Hierarchy
     GUEST < USER < PRO < MODERATOR < ADMIN < SUPER_ADMIN
     - GUEST: No auth, public content only
     - USER: Basic user, newsletter, comments
     - PRO: Premium features, dataset marketplace
     - MODERATOR: Content moderation, user reports
     - ADMIN: Full admin except SUPER_ADMIN operations
     - SUPER_ADMIN: System administration, user role assignment

     ## Security Constraints
     - SSRF guard blocca IP privati, loopback, link-local
     - Rate limiting Bucket4j: 120 req/min API, 6 req/min AI
     - CORS whitelist: federicocalo.dev, localhost dev
     """

5. AGGIUNGI DIAGRAMMI (file upload)
   - Sezione "Attachments" → "Upload"
   - Carica:
     auth-flow-diagram.png (sequence diagram JWT flow)
     role-hierarchy.svg (grafo gerarchico ruoli)
     database-schema.png (auth tables ER diagram)
   - Copilot li analizza via vision quando rilevante

Step 3: Share the Space

Team Sharing and Permissions
Nella pagina dello Space → Settings:

1. AGGIUNGI TEAM MEMBERS
   - Clicca "Share Space" → "Add People"
   - Seleziona: @frontend-team, @backend-team, @qa-team
   - Permessi: "Read" (default, loro non possono editare)
   - Oppure assegna "Edit" se trusted maintainer

2. GENERA LINK PUBBLICO (dicembre 2025)
   - After dicembre 9: attiva "Public Spaces"
   - Genera link non-discoverable (e.g., /spaces/uuid-xxx)
   - Condividi con OSS community, contractor, auditor

3. VISIBILITÀ
   - Private (default): Solo invitati
   - Public (dicembre): Visibile via link, non su GitHub Spaces directory
   - Future: Discovery directory (roadmap GitHub)

4. Knowledge Bases Sunset (November 1, 2025) - Hard Deadline

Le Knowledge Bases, launched in February 2024, are being deprecated on November 1, 2025. After that date, it is no longer possible to create new ones, and all existing Knowledge Bases will be deleted. Teams still using them need to migrate to Copilot Spaces by October 31, 2025.

Timeline Knowledge Bases Sunset

DateEventAction Required
Aug 20, 2025 Sunset notice announcement Inform the team of the deprecation
Oct 17, 2025 "Convert to Space" button appears Start Migration of Knowledge Bases
Oct 31, 2025 Migration deadline Last days to convert
Nov 1, 2025 Elimination of Knowledge Bases All Knowledge Bases are DELETED, no recovery

Why were Knowledge Bases replaced?

Knowledge Bases had three big problems:

  • Separation from code: The uploaded files did not reflect the changes in real time in the repositories. If you updated a file, you had to re-upload it.
  • Limited scalability: Large repositories (e.g. >100 MB) caused timeouts during indexing.
  • Very tedious management: Manual updates, partial versioning, no support for different branches.

Spaces solve everything by directly connecting GitHub repositories, synchronizing in real time and allowing you to pin specific files without loading gigabytes of data.

How to Migrate from Knowledge Base to Space

Automatic migration procedure
## Passo 1: Individua i tuoi Knowledge Bases
Vai a github.com/settings/copilot/knowledge-bases
Lista tutti i KB che hai creato

## Passo 2: Clicca "Convert to Space" (dal 17 ottobre)
Per ogni Knowledge Base:
  1. Apri il KB
  2. Clicca "Convert to Space" (nuova UI button)
  3. Seleziona il repository principale
  4. Rivedi i file pinned (GitHub proverà a mappare i file caricati)
  5. Clicca "Create Space"

## Passo 3: Verifica il Space
  1. Nuovo Space appare in Copilot Spaces
  2. Controlla che tutti i file key siano pinned
  3. Aggiungi note aggiuntive se necessario
  4. Verifica che PR/Issues siano correttamente indexate

## Passo 4: Decommissiona il Knowledge Base
  1. Torna al KB originale
  2. Clicca "Delete" (non più usato)
  3. Dichiara il nuovo Space come canonical reference

## Timeline (Consigliato)
- Oct 17-24: Converti il 50% dei KB (test veloce)
- Oct 25-31: Converti il 50% rimanente + verifica finale
- Nov 1: Knowledge Bases scompaiono, Spaces sono la nuova norma

Migration Checklist

  • [ ] Complete inventory of all Knowledge Bases in use
  • [ ] Identifies key files within each KB
  • [ ] Create Spaces with equivalent repositories + pinned files
  • [ ] Test Copilot with the new Space (verification prompt)
  • [ ] Add notes and PR/issues to the Space
  • [ ] Communicate the new Space to the team
  • [ ] Delete the Knowledge Base
  • [ ] Document the new context strategy in the ADR

5. Public Spaces and Individual Sharing (9 December 2025)

On December 9, 2025, GitHub enables Public Spaces e individual sharing, transforming Spaces from a team-only tool to an extended collaboration tool.

Public Spaces

A Public Space is accessible via direct link ma It is NOT indexed in the GitHub Spaces directory (privacy-by-design). You can share the link with OSS community, auditor, contractor, or anyone else, but the discovery is explicit (link sharing).

Enable a Space as Public (December 2025)
Nella pagina dello Space → Settings:

1. Visibilità: Cambia da "Private" a "Public"
   - GitHub genera un UUID link: /spaces/abc123def456
   - Non appare su https://github.com/spaces (no directory listing)
   - Chiunque abbia il link può visualizzare (view-only by default)

2. Condividi il link
   - Con community: posta su Twitter/Reddit/Dev.to
   - Con contractor: email the link per onboarding
   - Con auditor: per review architetturale

3. Permessi di View-Only
   - I visitatori possono leggere il contesto
   - NON possono modificare, pinare, o aggiungere file
   - Il team che possiede lo Space rimane gestore esclusivo

Esempio link: https://github.com/spaces/abc123-portfolio-backend-auth

Individual Sharing (December 2025)

Before December, a Space is all-or-nothing: it's either private (invited teams only) or it will be public (anyone with links). From December 9th, you can invite specific users without making it public.

Invite specific users (December 2025)
Nella pagina dello Space → Share → "Invite People":

1. Digita username GitHub (e.g., @john-doe)
2. Seleziona permessi: "View" (default) oppure "Edit"
3. Clicca "Send Invite"
4. L'utente riceve notifica + link privato allo Space
5. Lui è l'unico che può accedere (no link pubblico)

Scenari di utilizzo:
- Contractor che lavora su una feature: invite con "Edit" + repo specifico pinnato
- Client esterno che rivede l'architettura: invite con "View"
- Auditor di sicurezza: invite con "View" + access a decision records & security notes

Add Files from github.com Viewer (December 2025)

Until now, to add a file to a Space, you had to navigate to the Space page and finning. Starting December 9th, you can pin directly from the file viewer on github.com:

Streamlined workflow: pinning from github.com (December 2025)
1. Naviga a github.com/portfolio-backend/blob/main/src/main/java/...JwtService.java
2. Nel file viewer, clicca il menu "..." (three dots)
3. Seleziona "Add to Space"
4. Scegli quale Space (dropdown)
5. Clicca "Add"
6. Il file è ora pinnato; Copilot lo vede istantaneamente

Vantaggi:
- Non serve uscire dal file viewer
- Workflow naturale mentre navigate il codebase
- Gli altri team member vedono subito il file pinnato

6. Copilot Memory: Public Preview (December 19, 2025)

Copilot Memory is the new system personal persistence of the context. Unlike Spaces (which are curated by the team and shared), Memory is individual and cross-tools: Once you tell Copilot something about yourself or your workflow, Copilot remembers this in chat, code review, CLI, everywhere.

What Copilot Memory Stores

Types of Persistent Preferences

CategoryExampleBroomsPersistence
Code Style "I prefer Java records for DTOs (immutability)" User-global All use cases from user
Architecture "We use Clean Architecture 4-layer, no circular deps" Repository-scoped Only in the commands of this repo
Testing Preferences "Unit test with JUnit 5 + Mockito, 80% coverage target" Repository-scoped Apply when I generate tests
Naming Conventions "Use case classes: *UseCase suffix (LoginUseCase.java)" Repository-scoped Generation + refactoring
TechStacks "Spring Boot 3.4, Java 21, PostgreSQL 16, Redis 7" Repository-scoped Configuration suggestions
Performance Targets "APIs <100ms p99, FCP <1.5s, LCP <2.5s" Repository-scoped Code review suggestions

Memory Scope: User vs. Repositories

Copilot Memory has two scopes:

  • User-Level Memory: Apply to ALL your projects. Examples: "I prefer TypeScript strict mode", "I want JSON output every time", "I like tests written first".
  • Repository-Level Memory: Apply ONLY to this repo. Examples: "This project uses Clean Architecture", "Target 80% coverage", "JUnit 5 + Mockito for testing".
Setting Memory in Copilot Chat (December 2025)
Scenario 1: USER-LEVEL MEMORY

In Copilot Chat (qualsiasi progetto), scrivi:
> Remember: I prefer immutability. Always create new objects, never mutate.
> Remember: I want TypeScript strict mode enabled.
> Remember: Test-driven development. Write tests first.

Copilot risponde:
"✓ Remembered: immutability preference
 ✓ Remembered: TypeScript strict mode
 ✓ Remembered: TDD approach"

Ora, in ogni progetto futuro, Copilot appliche questi principi.

---

Scenario 2: REPOSITORY-LEVEL MEMORY

In Copilot Chat (questo repo), scrivi:
> For this repository, remember:
> - Clean Architecture: 4-layer (domain > application > infrastructure > presentation)
> - No circular dependencies allowed
> - Use case classes end with "UseCase" (LoginUseCase.java)
> - Target 80% test coverage
> - Rate limiting via Bucket4j
> - JWT: HS256 via JwtService, refresh token hash-in-DB

Copilot risponde:
"✓ Remembered for portfolio-backend:
 - Architecture: Clean 4-layer
 - No cycles
 - UseCase naming
 - 80% coverage
 - Bucket4j rate limiting
 - JWT strategy"

Solo quando lavori in portfolio-backend, questi constraint si applicano.
Su altri repo, il memory è indipendente.

---

Scenario 3: QUERY CHE ATTIVA MEMORY

Adesso chiedi:
> Implementa il controller per la autenticazione
> Scrivi i test prima

Copilot ricorda:
1. TDD approach (da user memory) → write tests first
2. Clean Architecture (da repo memory) → controller in presentation layer
3. UseCase suffix (da repo memory) → LoginUseCase in application layer
4. 80% coverage target (da repo memory) → comprehensive test cases
5. JWT strategy (da repo memory) → JWT handling specifico

La risposta è personalizzata su TUTTI questi preferenze memorizzate.

Cross-Tool Persistence (Chat, Review, CLI)

The true power of Memory is the cross-tool synchronization. If you tell Copilot Chat something, Copilot Code Review knows it. If you say it in CLI, Chat knows it. Everything is GitHub-hosted and synced.

Memory persists on chat, review, CLI (December 2025+)
Giorno 1: Pomeriggio - Copilot Chat VS Code
> @copilot, remember: For portfolio-backend, use Clean Architecture strictly

Giorno 2: Mattina - Copilot Code Review GitHub
Apri una PR: "#252: Add UserController"
Copilot automaticamente commenta:
"✓ I see Clean Architecture is in effect.
 Suggestion: UserController should be in 'presentation/controller'.
 I also remember: 80% test coverage target. This PR has 45 tests for X changes - on track."

Giorno 3: Sera - Copilot CLI (se lanciato)
$ copilot explain src/main/java/.../UserController.java
Copilot automaticamente applica le Clean Architecture rules e commenta.

=> Memory è sincronizzato ovunque tu sia in GitHub ecosystem.

7. Memory vs. Spaces: When to Use Which?

Now that we've seen both Memory and Spaces, it's natural to ask: which one to use? The answer depends on the scope and nature of the preferences.

Comparison Memory vs. Spaces

I waitCopilot MemoryCopilot Spaces
Brooms Personal (user) + repository Team/Project (shared)
Who creates them Single developer Anyone on the team (moderated by owner)
Visibility Only you (GitHub-hosted, private) Team (private) or anyone with link (public)
Update Automatic (Copilot learns from your use) Manual (pinning) or auto (repo binding)
BestFor Personal preferences, coding style Shared context, reference architecture
Persistence Cloud GitHub (US/EU from Apr 2026) GitHub repo side (public storage)
Cross-Tool ✓ Chat + Review + CLI ✓ Chat + Review (in scope repo)

Decision Matrix

When to use Memory vs. Spaces
┌─ MEMORIA PERSONALE (Memory) ─────────────────┐
│ Domanda: "Voglio che Copilot ricordi sempre…?"      │
│ Risposta: SÌ (memoria personale)                     │
│ Esempi:                                              │
│  - "Preferisco records Java per DTOs"                │
│  - "TypeScript strict mode sempre"                   │
│  - "TDD: test first, implementation secondo"         │
│  - "Niente mutation, immutabilità sempre"            │
│  - "Usa English per i commenti nel codice"           │
│ → Usare: Memory (user-level)                         │
└──────────────────────────────────────────────┘

┌─ MEMORIA TEAM/PROGETTO (Spaces) ──────────────┐
│ Domanda: "Vuoi che il team lo conosca…?"            │
│ Risposta: SÌ (contesto condiviso)                    │
│ Esempi:                                              │
│  - "Usiamo Clean Architecture 4-layer"               │
│  - "Spring Boot 3.4, Java 21, PostgreSQL"            │
│  - "Rate limiting Bucket4j, JWT HS256"               │
│  - "Decision records in docs/"                       │
│  - "PR template: #issue, description, test plan"     │
│ → Usare: Spaces (team-level)                         │
└──────────────────────────────────────────────┘

┌─ CONTESTO REPOSITORY-SPECIFICO ─────────────┐
│ Domanda: "Vale solo per questo repo…?"               │
│ Risposta: SÌ                                         │
│ Esempi:                                              │
│  - "Questo repo: Clean Arch 4-layer"                 │
│  - "Questo repo: 80% test coverage"                  │
│  - "Questo repo: UI TypeScript strict"               │
│ → Usare: Memory (repository-scoped)                  │
│ + Spaces (per contesto vivo: PR, issues)             │
└──────────────────────────────────────────────┘

8. Optimal Setup for Monorepo Angular+Spring Boot

Let's apply everything we've learned to a real-world scenario: a monorepo with Angular 21 SSR frontend and Spring Boot 3.4 backend, like Federico Calò's portfolio.

Memory Strategy (Personal)

User-level memory for Federico Calò (developer)
# Copilot Chat → set user-level memory

> Remember:
> - Immutability first: create new objects, never mutate
> - TypeScript strict mode always
> - Java: prefer records for DTOs (immutable)
> - TDD: write tests first
> - No deep nesting: max 4 levels
> - Functions <50 lines, files <800 lines
> - Explicit error handling everywhere
> - No hardcoded values: use constants or config
> - Code review before commit: readability, naming, structure
> - Performance: think caching, lazy loading, bundling

Copilot risponde:
"✓ User memory set for Federico Calò
 - Immutability enforcement
 - TypeScript strict
 - Java records for DTOs
 - TDD approach
 - Code size limits (4 nesting, 50 line functions, 800 line files)
 - Error handling
 - Constants not hardcoding
 - Pre-commit review
 - Performance mindset"

Da qui in poi, TUTTI i comandi di Copilot (chat, code generation, refactoring, test generation)
useranno questi principi.

Memory Strategy (Repository-Level)

Memory repository-scoped for portfolio-backend
# In Copilot Chat, con la directory backend/ aperta

> For this repository (portfolio-backend), remember:
>
> ## Architecture
> - Clean Architecture 4-layer (domain > application > infrastructure > presentation)
> - Zero circular dependencies
> - Domain layer: business rules, entities, ports (no framework)
> - Application layer: use cases, DTOs, orchestration
> - Infrastructure layer: persistence, external integrations
> - Presentation layer: controllers, REST API, request/response marshaling
>
> ## Code Standards
> - Use case classes: *UseCase suffix (LoginUseCase, PublishArticleUseCase)
> - DTOs: records (immutable)
> - Repositories: interface in domain, impl in infrastructure
> - No service layer (use cases replace it)
> - DTOs use @Builder or records
>
> ## Testing
> - Target: 80%+ coverage
> - JUnit 5 + Mockito
> - Testcontainers for integration (PostgreSQL, Redis)
> - Test naming: testXxxWithYyyExpectZzz
>
> ## Dependencies
> - Spring Boot 3.4.1
> - Java 21
> - PostgreSQL 16 (database)
> - Redis Stack 7 (cache)
> - Bucket4j (rate limiting)
> - Resilience4j (circuit breaker, retry)
> - Spring Security + JWT (HS256)
> - Spring Data JPA + Flyway
>
> ## Security
> - JWT: HS256 via JwtService
> - Refresh token: hash-in-DB (not in JWT)
> - Roles: GUEST - SSRF guard: block private IPs, loopback, link-local
> - Rate limit: 120 req/min API, 6 req/min AI
> - CORS whitelist: federicocalo.dev + localhost
>
> ## Performance Targets
> - API response: <100ms p99
> - Database queries: indexed on common lookups
> - Caching: Spring Cache @Cacheable (1h TTL typical)
> - No N+1 queries
>
> ## Database
> - PostgreSQL 16
> - Flyway migrations (src/main/resources/db/migration/)
> - Migration naming: V###__description.sql
> - No data mutation migration (data fixtures only)
>
> ## External Integrations
> - Stripe SDK: checkout sessions, webhooks (5 event types)
> - Email: self-hosted Postfix+Resend (EmailService)
> - Python ML: fallback provider chain (Cloudflare → Ollama)

Copilot risponde:
"✓ Repository memory set for portfolio-backend:
 - Clean Architecture enforced
 - UseCase naming standard
 - 80% coverage target
 - JUnit 5 + Mockito
 - Spring Boot 3.4.1 with Security/JWT
 - PostgreSQL + Redis
 - Bucket4j rate limiting
 - API <100ms p99 target"

D'ora in poi, quando lavori su portfolio-backend, Copilot applica questi constraint.
Se generi un controller, lo metterà in presentation/. Se scrivi test, userà JUnit 5.

Memory Strategy for Frontend

Memory repository-scoped for portfolio-frontend
# In Copilot Chat, con la directory frontend/ aperta

> For this repository (portfolio-frontend), remember:
>
> ## Framework & Stack
> - Angular 21 with @angular/ssr (Server-Side Rendering)
> - TypeScript 5.9 (strict mode)
> - Standalone components (no modules)
> - OnPush change detection everywhere
> - Signals for state management (no RxJS except HTTP)
> - CSS scoped to component (no global styles)
>
> ## Component Structure
> - One component per file
> - File naming: kebab-case (user-profile.component.ts)
> - Component class: PascalCase (UserProfileComponent)
> - Selector: app-user-profile (app- prefix)
> - Template: inline (unless >100 lines, then separate .html)
> - Styles: inline (unless >50 lines, then separate .css)
>
> ## Routing
> - Lazy-loaded routes (RenderMode.Server for SSR)
> - Route guards for auth (canActivate)
> - 1014 prerendered routes for SEO
>
> ## Testing
> - Jasmine + Karma
> - Target: 80% coverage (currently 2.7%, improving)
> - Test naming: should...when...
> - Mock services with jasmine.createSpyObj
>
> ## I18n
> - XLF translation format
> - 18 languages: IT, EN (compiled), 16 (fallback)
> - i18n keys on every new component (mandatory)
> - Extract with ng extract-i18n
>
> ## Performance Targets
> - FCP <1.5s, LCP <2.5s, TTI <3.5s
> - Bundle <3 MB (initial), <40 kB per lazy route
> - Lighthouse score 90+ (all categories)
> - Image lazy loading + WebP format
>
> ## Accessibility
> - WCAG 2.1 AA compliance
> - Semantic HTML5
> - ARIA labels where needed
> - Keyboard navigation support
> - Focus indicators visible
>
> ## SEO
> - Meta tags (title, description, og:*)
> - JSON-LD structured data
> - Sitemap with 18 language versions
> - Canonical URLs

Copilot risponde:
"✓ Repository memory set for portfolio-frontend:
 - Angular 21 SSR + TypeScript strict
 - Standalone components + OnPush
 - Signals for state
 - Lazy routing
 - 18-language i18n
 - 80% test coverage target
 - Lighthouse 90+
 - WCAG 2.1 AA"

Copilot Spaces Strategy

Spaces for the portfolio-backend-auth team (shared context)
Space Name: "Portfolio Backend - Authentication & Security"
Privacy: Private (team-only, no public for security reasons)

Contents:
1. Repository Links
   ✓ portfolio-backend (full)
   ✓ Pinned: src/main/java/dev/.../auth/
   ✓ Pinned: src/main/resources/db/migration/V0{11-20}*auth*

2. Pull Requests
   ✓ #247: feat(security): JWT proprietaria con refresh token
   ✓ #251: fix(security): SSRF guard per external API
   ✓ #245: test(auth): AuthControllerTest @Testcontainers

3. Issues
   ✓ #198: Security: Implement SUPER_ADMIN role
   ✓ #204: Feature: API Key management
   ✓ #156: Security audit: rate limiting

4. Free-Text Notes
   ### JWT Architecture
   - Algoritmo: HS256
   - Issuer: federicocalo.dev
   - Access token: 15 minuti
   - Refresh token: 30 giorni (hash-in-DB)

   ### Roles Hierarchy
   GUEST

Integrated Daily Workflow

Day-in-the-life: Memory + Spaces in action
Mattina (9:00): Standup backend
- Copilot Chat aperto
- User memory attivo: immutability, TDD, clean architecture
- Repo memory (portfolio-backend) attivo: Clean Architecture 4-layer, JWT, 80% coverage
- Copilot Spaces "Portfolio Auth" in sidebar
=> Federico chiede: "Implementa il controller per user registration"
   Copilot automaticamente:
   - Mette il controller in presentation/
   - Crea la use case in application/ (RegisterUserUseCase)
   - Scaffolda il domain entity e port
   - Scrive i test prima (TDD)
   - Applica Clean Arch (no circular deps)
   - Implementa error handling esplicito
   - Applica rate limiting Bucket4j
   - Usa records per RegistrationRequest/Response DTOs

Pomeriggio (14:00): Code review
- Apre una PR #256
- Copilot Code Review (powered by Memory)
- Commento automatico:
  "✓ Clean Architecture respected (controller → usecase → domain)
   ✓ Tests present (TDD observed)
   ✓ 87 tests (+5 new) = 80.2% coverage target on track
   ✓ Rate limiting applied (Bucket4j)
   ✓ Error handling comprehensive
   🔍 Suggestion: Consider caching password check failures (rate limit brute-force)"

Sera (18:00): Onboarding contractor
- Condividi lo Space "Portfolio Auth" con contractor (individual share, dicembre)
- Contractor può leggere tutta l'architettura
- Copilot sa che contractor ha accesso: limitato a specifico file pinnato
- Team rimane proprietario dello Space

9. Privacy Considerations: Where Do Memory and Spaces Live?

An important question: where does GitHub save the Memory? And the Spaces? The answer is important for compliance (GDPR, EU law, etc.).

GitHub Copilot Data Residency (April 2026)

ComponentStorageDefault ResidenceOptions
Copilot Memory GitHub-hosted USA (region us-east-1) EU residency opt-in (Apr 2026)
Copilot Spaces (private) GitHub repo metadata Where the repo is Repo location (can be EU)
Copilot Spaces (public) GitHub public storage Global CDN N/A (public)
Chat History GitHub (Enterprise/Pro) USA EU opt-in (Apr 2026)

GDPR Compliance

GitHub has stated (Article 27 GDPR, April 2026) that:

  • EU data residence: If you declare the organization/user as EU, Memory and chat history can be hosted in EU (ireland-1) region instead of USA.
  • Training data: GitHub does not use your Copilot prompts for training of the model (opt-out by default, no training on user data).
  • Retention: Memory is retained indefinitely until manual deletion. Chat history can be deleted manually or after 30 days (configurable).
  • Data Subject Rights: You can request access, rectification, cancellation (GDPR rights articles 15-17) via https://support.github.com/request/gdpr.

How to Apply for EU Residency (April 2026)

Setup EU data residency for Copilot (April 2026+)
# Procedure (expected aprile 2026)

1. Vai a GitHub Settings → Copilot → Data Residency
2. Seleziona: "European Union (Ireland)"
3. Conferma che sei una persona/organizzazione EU
4. GitHub migra Memory + Chat history (potrebbe richiedere 24-48 ore)

## Verifica
- Impostazione è salvata in Settings
- Nuovi Copilot prompts sono stored in ireland-1
- Precedente data rimane in us-east-1 (migrazione in corso)

## Note
- Se cambi regione, Memory non viene cancellato
- Solo il NEW data storage location cambia
- Performance could differ slightly (latency ireland vs usa)

10. Future Perspectives: Copilot CLI with Memory Support

While Memory is in public preview on December 19, 2025, GitHub also announces the Public CLI copilot for early 2026, with Memory support from terminal. This means you can do:

Copilot CLI with Memory (early 2026)
$ copilot explain ./src/main/java/auth/JwtService.java

# Copilot legge il file e applica Memory:
# - User memory: immutability, TDD, clean arch
# - Repo memory (portfolio-backend): Clean Architecture 4-layer, JWT specifics
# - Genera spiegazione che rispetta tutti questi constraint

Output:
"JwtService: Provides HS256 JWT generation and validation.

Key methods:
- generateAccessToken(): Creates 15-min JWT
- generateRefreshToken(): Creates 30-day refresh (hash-in-DB, not JWT)
- validateToken(): Validates signature and expiry

Architecture: Application layer service, injected into AuthController.
Immutability: Token claims are final/immutable.
Testing: Full coverage in JwtServiceTest with Mockito.

Note: Remember your memory says 'no circular dependencies' - this class
is imported by AuthController (presentation) correctly."

---

$ copilot generate-code --context "portfolio-backend" --type "usecase"
Enter description: "User password reset with email confirmation"

# Genera un UseCase seguendo Memory:

---

$ copilot review my-branch

# Analizza commit su my-branch applicando Memory:
# - Clean Architecture rules
# - Test coverage target
# - Security constraints
# - Performance targets

11. Checklist: How to Implement Memory and Spaces in Your Team

Here is a practical checklist for migrating and implementing Memory and Spaces in your team by December 2025.

Checklist di Implementazione (Trimestre Q4 2025)

  • [ ] Settembre (lancio Spaces GA)
    • [ ] Inventario di tutti i Knowledge Bases in uso
    • [ ] Pianifica migrazione: quali KB → quali Spaces
    • [ ] Crea il primo Space come pilot (e.g., Auth Space per backend)
    • [ ] Testa Copilot Chat con lo Space: prompt di verifica
    • [ ] Documenta il flusso nel team (wiki, ADR)
  • [ ] Ottobre (migrazione Knowledge Bases)
    • [ ] Dal 17 ott: clicca "Convert to Space" sui KB
    • [ ] Rivedi ogni Space convertito (file, PR, issues)
    • [ ] Crea Spaces aggiuntivi per aree non coperte (QA, DevOps, etc.)
    • [ ] Invita team members a ogni Space
    • [ ] Verifica cross-tool (Chat, Review, CLI)
    • [ ] Elimina Knowledge Bases deprecati (deadline 1 nov)
  • [ ] Dicembre (Memory + Public Spaces)
    • [ ] Memory public preview (19 dic): setup user-level memory per ogni dev
    • [ ] Setup repository-level memory per portfolio-backend e portfolio-frontend
    • [ ] Public Spaces (9 dic): valuta se rendere OSS Spaces pubblici
    • [ ] Individual sharing (9 dic): invita contractor/auditor se necessario
    • [ ] Test cross-tool: Chat, Code Review, CLI con Memory attivo
    • [ ] Docume nta best practices Memory nel team (what to remember, what not)
    • [ ] Privacy check: verificare EU residency se applicabile (apr 2026)
  • [ ] Q1 2026+ (stabilization)
    • [ ] Monitora usage: quali Spaces sono più usati?
    • [ ] Aggiorna Memory sulla base di feedback del team
    • [ ] Copilot CLI pubblico (early 2026): integra nel workflow CI/CD
    • [ ] Reportistica: misurate impact su productivity, code quality

Conclusione: Una Nuova Era di Knowledge Persistente

L'evoluzione da Knowledge Bases → Copilot Spaces → Copilot Memory rappresenta un salto qualitativo nella gestione della conoscenza per team di sviluppo. Non è più sufficiente spiegare l'architettura una volta: ora il contesto vive nel tuo ecosistema GitHub, sempre aggiornato, sempre sincronizzato, sempre disponibile.

Copilot Spaces risolvono il problema del contesto condiviso collegando direttamente i repository e indicizzandoli in tempo reale. Copilot Memory aggiunge una dimensione personale: i tuoi preferimenti di coding persistono, cross-tool, senza ripetizione.

3 Azioni Immediate (Prima di Dicembre 2025)

  • Migra Knowledge Bases a Spaces: Dal 17 ottobre, usa il "Convert to Space" button. Deadline 1 novembre - dopo quella data, tutto è perduto.
  • Configura Memory User-Level: Dic 19, quando Memory esce in preview, settalo per le tue preferenze personali (immutability, TDD, linguaggio, etc.).
  • Crea Repository Memory: Stesso giorno, configura preferenze specifiche per ogni repo (Clean Architecture per backend, TypeScript strict per frontend).

Nel prossimo articolo (serie #22), esploreremo le Copilot Extensions: come creare plugin personalizzati che estendono Copilot con capacità custom per il tuo dominio, sia come mantainer di librerie open-source sia come azienda con processi proprietari.

Try These Tools

Free developer tools related to this topic.

Commenti

Caricamento commenti...

Sign in to comment

Discuss this article in the community

Join the Telegram group to discuss with other developers, ask questions and share your experiences.

Did you like this article?

Explore other content on the blog or discover my projects