Machine Learning pathway increased my salary by 40%
Agent Memory, Knowledge Graphs and HR Context Engineering
An agent is only as good as the context it was given, and context is not a prompt-writing problem — it is a data problem. Memory and knowledge modelling decide whether the system answers about the right person, under the right policy, at the right point in time.
This chapter separates three things that are usually conflated: memory (what the agent retains), knowledge (what the enterprise knows) and context (what is assembled for a specific moment). It sets out the memory tiers and their retention and entitlement obligations, then builds the case for an HR knowledge graph — people, positions, skills, policies, organisational structure and their relationships — as the structure that makes entity resolution, eligibility and multi-hop questions tractable. It closes with context engineering as a discipline with budgets, ordering rules and tests, because choosing the right five paragraphs is an engineering decision with measurable consequences.
What this covers
- Who this is for
- HR technology architects, data and analytics leads, knowledge managers and platform engineers responsible for what an agent can retrieve, retain and reason over.
- What it assumes
- Chapters 01–05. Some familiarity with data modelling or HR reporting helps, but the concepts are introduced from first principles.
- What you will be able to do
- Specify memory tiers with retention and entitlement rules, model an HR knowledge graph for eligibility and mobility questions, and design context assembly with explicit budgets and tests.
- Reading time
- About 24 minutes, including the knowledge check and question bank.
Memory, knowledge and context are different systems
Memory is what a specific agent run or case retains: the conversation, the artefacts, the decisions. Knowledge is what the enterprise holds independently of any run: policy, job architecture, records, taxonomy. Context is the assembly at a given moment — the subset of memory and knowledge placed in front of the model for one step. Confusing the three produces systems where conversation history becomes the source of truth, where policy lives in prompts and where the agent's view of the enterprise is whatever happened to fit.
The distinction matters operationally because each has different owners, different change cadence and different regulatory treatment. Memory retention is a data protection question. Knowledge accuracy is a curation question. Context assembly is an engineering question with a cost profile. When a system underperforms, identifying which of the three is at fault is the first diagnostic step, and teams that skip it usually buy a bigger model.
A useful discipline is to make the boundaries explicit in the architecture: a case store for memory, a curated retrieval and graph layer for knowledge, and a context assembler with a declared budget. That structure also makes evaluation possible, because failure can be attributed to a store rather than to 'the AI'.
- Memory: per-run and per-case state, with retention and entitlement obligations.
- Knowledge: enterprise-held, curated, versioned facts and structures independent of any run.
- Context: the deliberate subset supplied to the model at each step, under a token budget.
- Different owners, change cadences and legal treatment — do not merge them into one store.
- Attribute failures to the correct layer before changing models.
Memory tiers in an HR agent estate
Session memory holds the current interaction: the conversation turns, intermediate tool results, the working draft. It is discarded at the end and should never be the only record of a decision. Case memory holds the artefacts of one process instance — documents, extractions, proposals, approvals — and is the evidence store; it must be retained for the audit period and made immutable once the case closes. Profile memory holds durable facts about a person or organisation that persist across cases, and it is the tier with the greatest privacy exposure because it accumulates silently.
Each tier needs three answers: who may write, who may read, and how long it survives. Session memory is read by the agent and its orchestrator only. Case memory is read by the case handler, the owner, auditors and the subject under access rights. Profile memory should be limited to facts with a business justification, reviewed periodically, and never widened because it seems convenient.
The most common design error is allowing conversation history to double as case evidence. Conversations are lossy — summarised, truncated, rephrased — and in a dispute the question is what the system knew at the moment it acted, which only structured case artefacts can answer.
- Session memory
- Interaction-scoped context, discarded at the end. Convenient, not evidential.
- Case memory
- Process-scoped artefacts retained for the audit period, immutable once closed. The evidence layer.
- Profile memory
- Durable person or organisation facts across cases. Highest privacy risk; requires purpose limitation and review.
- Retention schedule
- Per-tier rule stating what is kept, for how long, under which legal basis, and what is deleted.
Why an HR knowledge graph earns its cost
Many HR questions are multi-hop. What is this employee's notice period requires the person, their contract, their grade, their jurisdiction and the policy effective at the relevant date. A relational query can answer it if someone wrote the join. An agent asked a slightly different question needs a different join. A knowledge graph expresses these relationships once — person to position, position to grade, grade to policy applicability, policy to jurisdiction and effective period — and lets many questions be answered from the same structure.
The graph also solves identity. Nodes for the person, candidate, contractor and user account, linked by resolved identifiers, let an agent follow a relationship rather than guess from a name. Skill nodes linked to job architecture, learning content and certifications turn 'who could do this' into a traversal rather than a keyword search.
The cost is real: graph modelling requires governance, and a graph without an owner decays into an expensive diagram. The pragmatic route is to start from the questions the business actually asks — eligibility, mobility, coverage, compliance exposure — and model only the nodes and edges those questions require. Extending a small, owned graph is far cheaper than maintaining a comprehensive one nobody reviews.
- Model around questions the business asks, not around a theoretical universal schema.
- Start with person, position, org unit, job, grade, policy, jurisdiction and effective dates.
- Use the graph for identity resolution across systems — one node per person, many identifiers.
- Add skills and learning links to make internal mobility tractable.
- Assign an owner and a change process; an unowned graph is worse than none.
HR ontologies and semantic employee profiles
An ontology is the agreed vocabulary and its relationships: what counts as a job, a role, a skill, a competency, a grade, a position, a cost centre. Without one, three systems describe the same reality three ways, and every analytical or agentic answer inherits the inconsistency. The ontology does not need to be academically elaborate; it needs to be authoritative, versioned and small enough to be maintained.
Semantic employee profiles are the practical expression: a worker represented by attributes, relationships and provenance rather than a flat record. Provenance matters — an agent stating that someone has five years of experience should be able to say whether that comes from the HCM hire date or an inferred CV extraction, because the two carry very different reliability.
Skills taxonomies deserve specific caution. Inferring skills from job titles or text is probabilistic and unevenly accurate across populations, which is how bias enters mobility decisions. Keep inferred skills labelled as inferred, keep a human-verifiable path for consequential uses, and evaluate coverage across groups — Chapter 28 returns to this with fairness testing.
- Ontology
- The authoritative vocabulary and relationship definitions for a domain, versioned and owned.
- Semantic profile
- A worker representation of attributes, relationships and provenance rather than a single flat record.
- Inferred attribute
- A value derived by model or rule rather than sourced from a system of record; must be labelled and treated as lower confidence.
- Provenance
- The source, version and date behind each fact — what allows a claim to be defended or corrected.
Context engineering as a discipline
Context engineering is the practice of deciding what enters the prompt, in what order, with what compression, under what budget. The default behaviour of naive implementations — stuff the conversation, the whole policy and every record field into the window — produces cost, latency and worse answers. Models attend unevenly, and irrelevant material competes with the material that matters.
A workable assembly order for an HR question is: the asker's identity and entitlements, the task instruction and output contract, the applicable policy evidence with citations, the specific record fields required, the case state, and finally constraints and refusal rules. Each block has a token budget and a truncation strategy that preserves meaning — clauses before examples, headings with content, never a truncated sentence that changes an obligation.
Two tests keep assembly honest. The ablation test removes each block in turn and measures quality, which reveals blocks that cost tokens without contributing. The adversarial context test supplies a distractor — a plausible but inapplicable policy from another jurisdiction — and checks whether the agent selects the right evidence. Both are cheap and both catch the failures that look like model weakness.
- Define the required blocks and their token budgets per agent step.
- Order identity and constraints first and last, evidence in the middle; never bury constraints.
- Compress by structure — drop examples before dropping clauses.
- Run an ablation test per block to eliminate dead context.
- Run adversarial context tests with plausible distractors from other jurisdictions.
- Log the assembled context hash with each case for reproducibility.
Knowledge governance, lineage and corpus operations
A knowledge layer is a product with a backlog. Documents are added, edited by people who do not know an agent depends on them, superseded by newer versions, and quietly contradicted by a local annex. Without operations, retrieval quality degrades with no error signal — the classic silent failure of Chapter 01.
The operating model needs four things: named ownership per source, effective dates and version control, a change process that triggers evaluation, and lineage linking answers back to the exact document version used. Lineage is what lets an organisation respond to a challenge in a dispute or to a regulator's question months later.
Measure retrieval as a system, not as a component. Track recall on a labelled question set, the rate at which answers cite superseded documents, the share of questions with no retrieved evidence, and the age distribution of sources being cited. Those four numbers explain most quality complaints, and none of them appear in a typical infrastructure dashboard.
- Named owner per source; unowned content should not enter the index.
- Effective dates and version control mandatory; retrieval must respect them.
- Every corpus change triggers the evaluation suite before release.
- Store the document version and chunk identifiers with each answer for lineage.
- Monitor recall, superseded-document citation, evidence gaps and source age.
Vector databases, hybrid search and enterprise retrieval
A vector database stores embeddings and returns nearest neighbours by similarity. That is one operation, and on its own it is rarely sufficient for HR. Exact identifiers — policy codes, grade names, statutory references, form numbers — need lexical matching, because an embedding of 'Form 12BB' is close to many tax-related passages and precise to none. Hybrid retrieval combines lexical and dense search, then reranks the merged candidates, which is why it consistently outperforms either method alone on enterprise content.
Metadata filtering is the mechanism that makes retrieval safe and correct. Jurisdiction, effective dates, audience, version and source owner are applied as filters before ranking, so a query from an employee in one country never returns another country's policy, and a question about last year's entitlement retrieves the version that applied then. Access entitlements belong in the same filter layer, evaluated against the requesting identity rather than the agent's own.
Index operations are a recurring cost that plans frequently omit. Changing the embedding model requires reindexing the corpus, and switching index technology requires re-embedding and re-validating recall. Keep the index version in the case record so historical answers remain explicable, and plan reindexing as a migration with validation, not as a routine deployment.
Scale characteristics matter less than teams expect at HR volumes — even a large enterprise generates modest query load compared with consumer search — but the corpus changes continuously, so incremental update, deletion propagation and consistency after a policy withdrawal are the operational priorities. A retrieval system that cannot promptly stop returning a withdrawn document has the exact failure discussed earlier in this chapter.
- Combine lexical and dense retrieval, then rerank; neither alone is adequate for enterprise policy.
- Filter by jurisdiction, effective dates, audience and entitlement before ranking.
- Evaluate recall at k on labelled questions, independently of generation quality.
- Treat embedding-model changes as migrations requiring full reindex and recall validation.
- Propagate deletions and withdrawals into the index promptly and verify the effect.
- Record index version with each answer to keep historical cases explicable.
Memory and knowledge in practice
Both scenarios are illustrative constructions, not reports of specific deployments.
A global manufacturer with 70,000 employees could not answer mobility questions reliably because skills were stored as free text in three systems and job architecture had drifted. They built a graph limited to five question families — eligibility for a role, required certifications, notice period, reporting line and site coverage — with a single person node per employee and explicit provenance on every inferred skill. Scope discipline kept the graph maintainable, and mobility questions became traversals rather than searches.
A shared-services provider discovered that its agent cited superseded policies in roughly one in twenty answers. The cause was not the model: documents were indexed by upload date rather than effective date, and annexes were chunked without their parent scope. Adding effective-date metadata, structural chunking and a lineage field removed the failure class within a release.
Memory and knowledge failure modes
Memory creep: profile memory accumulates facts nobody justified, and the agent begins treating stale inferences as current truth. Mitigate with purpose limitation, review cadence and deletion schedules. Evidence loss: case artefacts live only in conversation logs, so a dispute cannot be reconstructed. Mitigate with structured case storage written by the orchestrator, not the model.
Identity confusion: two people with similar names, a merged record, a rehired employee with a new worker ID. Mitigate with a single person node and explicit identifier mapping, and fail closed on ambiguity. Ontology drift: three definitions of 'manager' and unowned job architecture, producing plausible nonsense in coverage and eligibility answers.
Context poisoning is the newest: an untrusted document enters the retrieval corpus and influences answers because nobody controlled source ingestion. Corpus admission must be a governed process, not a crawl.
- Memory creep — unjustified profile accumulation, stale inferences treated as fact.
- Evidence loss — conversation logs used as the record of a decision.
- Identity confusion — similar names, merged records, rehires with new identifiers.
- Ontology drift — multiple definitions and unowned job architecture.
- Context poisoning — uncontrolled ingestion letting untrusted content shape answers.
- Unbounded context — cost and quality degradation from stuffing the window.
Subject access, correction and memory in practice
Memory design determines whether an organisation can answer an individual's request for their data within statutory deadlines. A case store with provenance can enumerate what was held, why, on what basis and what was derived. A conversation log cannot: it is narrative, lossy and full of incidental detail with no purpose attached. This is the practical reason to invest in structured memory rather than treating transcripts as the record.
Correction is harder than access. If an agent's answer was based on an incorrect record field, the correction must propagate to the system of record, to the case artefacts that cited it, and to any profile memory derived from it. Designs that copy facts into multiple stores without lineage cannot do this reliably, and the failure is visible to the individual as a repeat of the same wrong answer.
Deletion obligations run against retention obligations. Employment law frequently requires records to be kept for years, while data protection principles require that unrelated personal detail not be retained indefinitely. The reconciliation is a per-store schedule with a stated legal basis per field, applied by the platform rather than by an operator remembering to do it.
Finally, memory design should make the individual's position legible: what the assistant knows about them, where each fact came from, and how to dispute it. That transparency reduces disputes, shortens investigations, and is the cheapest form of trust available to an HR function deploying agents at scale.
- Structured case memory makes subject access answerable within deadline; transcripts do not.
- Provenance is required to correct a fact everywhere it was used, including derived stores.
- Reconcile deletion with statutory retention through a per-field schedule and legal basis.
- Apply retention and deletion in the platform, not through operator discipline.
- Show individuals what is held, its source and the dispute route.
Key takeaways
Memory, knowledge and context are separate systems with separate owners and obligations. Memory tiers need retention and entitlement answers. Knowledge needs a graph and an ontology scoped to real questions. Context needs a budget, an order and tests.
Chapter 07 moves from what the agent knows to how work is executed: orchestration, workflow engineering and the durable state machines that make multi-agent HR automation operable.
- Separate memory, knowledge and context; attribute failures before changing models.
- Three memory tiers, each with write, read and retention rules; case memory is the evidence.
- Model the graph around real questions; own it and review it.
- Label inferred attributes and preserve provenance for every fact.
- Assemble context under budget, ordered, compressed by structure, tested by ablation.
- Govern corpus admission and lineage, and monitor retrieval as a system.
5 questions to test the model
Which memory tier constitutes the evidence of what an agent did in a specific case?
What is the strongest reason to build an HR knowledge graph rather than more relational joins?
Why must inferred skills be labelled as inferred?
What does a context ablation test reveal?
An agent cites a withdrawn policy in five per cent of answers. What is the most likely root cause?
Questions this page answers
Do we need a knowledge graph to start?
How long should case memory be retained?
Is profile memory ever justified?
How do we resolve identity across systems?
What is the practical difference between a taxonomy and an ontology?
How big should the context be?
What should be logged for lineage?
How do we stop untrusted content entering the corpus?
Should conversation history be stored at all?
How do we handle rehires and merged records?
What does 'context poisoning' look like in HR?
How often should the corpus be reviewed?
Is a graph database required?
How do we evaluate retrieval separately from generation?
What is a reasonable context budget per step?
How do we keep two agents from duplicating memory work?
What about employee access requests?
How does a graph help with policy applicability?
What is the most common context engineering mistake?
What comes next in the course?
What does Session memory mean in Agent Memory, Knowledge Graphs and HR Context Engineering (Memory tiers in an HR agent estate)?
What does Case memory mean in Agent Memory, Knowledge Graphs and HR Context Engineering (Memory tiers in an HR agent estate)?
What does Profile memory mean in Agent Memory, Knowledge Graphs and HR Context Engineering (Memory tiers in an HR agent estate)?
What does Retention schedule mean in Agent Memory, Knowledge Graphs and HR Context Engineering (Memory tiers in an HR agent estate)?
What does Ontology mean in Agent Memory, Knowledge Graphs and HR Context Engineering (HR ontologies and semantic employee profiles)?
What does Semantic profile mean in Agent Memory, Knowledge Graphs and HR Context Engineering (HR ontologies and semantic employee profiles)?
What does Inferred attribute mean in Agent Memory, Knowledge Graphs and HR Context Engineering (HR ontologies and semantic employee profiles)?
What does Provenance mean in Agent Memory, Knowledge Graphs and HR Context Engineering (HR ontologies and semantic employee profiles)?
What does Memory, knowledge and context are different systems explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Memory tiers in an HR agent estate explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Why an HR knowledge graph earns its cost explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does HR ontologies and semantic employee profiles explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Context engineering as a discipline explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Knowledge governance, lineage and corpus operations explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Vector databases, hybrid search and enterprise retrieval explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Memory and knowledge in practice explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Memory and knowledge failure modes explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Subject access, correction and memory in practice explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
What does Key takeaways explain about Agent Memory, Knowledge Graphs and HR Context Engineering?
Which risks or limitations apply to Memory, knowledge and context are different systems in Agent Memory, Knowledge Graphs and HR Context Engineering?
Sources and standards
- W3C RDF 1.1 and OWL 2 — knowledge representation standards
Foundational standards for graph data models and ontologies.
- ISO 30414:2018 — Human capital reporting guidelines
Definitions for workforce metrics that inform ontology and metric design.
- NIST AI 600-1 — Generative AI Profile (data privacy and information integrity)
Risk framing for data provenance and information integrity.
- GDPR — storage limitation, data minimisation and access rights
Basis for retention schedules and subject access in memory design.
- ISO/IEC 42001:2023 — AI management system
Lifecycle and data governance requirements for AI systems.
- Neo4j GraphAcademy — graph data modelling
Practical modelling patterns for entity and relationship graphs.
- LangChain documentation — memory and retrieval patterns
Reference patterns for conversation memory, retrieval chains and evaluation.
- DAMA-DMBOK — Data Management Body of Knowledge
Data governance, lineage and stewardship practices applied to corpus operations.
Continue through the chapters
Next: orchestration and workflow engineering — durable state, supervision, retries and the patterns that make an agent estate operate reliably.
Continue this lesson with a subscription
Multi-Agentic AI HR Tech Automations is part of the paid catalogue. You have read the free preview. A subscription opens the rest of this lesson, the classroom slides and the assessment questions.
- The full lesson for this topic and every other catalogue topic
- Every classroom slide deck and worked example
- All assessments, with a verifiable certificate on completion
The Free-To-Learn library stays open to everyone and is not affected by this.
